All of lore.kernel.org
 help / color / mirror / Atom feed
* dtc: 5 memory-safety defect(s) — reports, PoCs and patches attached
@ 2026-10-13 10:15 胡景浩 
  2026-10-14  5:21 ` David Gibson
  0 siblings, 1 reply; 2+ messages in thread
From: 胡景浩  @ 2026-10-13 10:15 UTC (permalink / raw)
  To: devicetree-compiler


[-- Attachment #1.1: Type: text/plain, Size: 2266 bytes --]

Hello,


I found 5 defect(s) in dtc. Each has a minimal PoC, a reproduction command and a proposed patch.


1. Negative size passed to memcpy while reading a flattened device tree property
   CWE-787 / CWE-190 — Medium | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H (7.8 High)
   A negative length (derived from the property header) bypasses the bounds check and is passed to memcpy, producing a huge copy.


2. strchr over-read on a non-terminated property value (alias path checking)
   CWE-125 — Low | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N (5.5 Medium)
   A property value that is not NUL-terminated is passed to strchr() while checking alias paths, reading past the property buffer.


3. fdtdump reads the memory-reserve map at an unvalidated offset
   CWE-125 — heap-buffer-overflow read -> crash | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N (5.5 Medium)
   fdtdump computes the reserve-map pointer straight from the header field off_mem_rsvmap and then walks it without ever comparing against totalsize.


4. fdtdump passes an unvalidated nameoff to printf("%s")
   CWE-125 — heap-buffer-overflow read via printf %s -> information leak and crash | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N (5.5 Medium)
   The property-name offset nameoff from the structure block is added to the string-block pointer without any validation against size_dt_strings or totalsize, and the result is handed to printf("%s").


5. fdtdump walks the structure block without a totalsize bound
   CWE-125 — heap-buffer-overflow read | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N (5.5 Medium)
   dump_blob() starts at p_struct and follows tags without bounding the cursor by totalsize / size_dt_struct; strlen() on a node name is likewise unbounded.


PoC files, harness sources and patches are in the attached archive, one directory per item.


On the CVE side: no CNA covers these projects upstream, so the ID would come from MITRE (CNA of
last resort). MITRE's preferred route is for the upstream project to submit the request; if you would
rather do that I can hand you the completed request fields ready to paste. Otherwise I will file with
MITRE myself once we agree the defects are real. No CVE ID has been assigned yet.


Regards,
hjh_nju
jinghaohu33@163.com


[-- Attachment #1.2: Type: text/html, Size: 3517 bytes --]

[-- Attachment #2: dtc-reports.tar.gz --]
[-- Type: application/x-gzip, Size: 4783 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-14  5:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-13 10:15 dtc: 5 memory-safety defect(s) — reports, PoCs and patches attached 胡景浩 
2026-10-14  5:21 ` David Gibson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.