🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.debian.bugs.dist
1 messages
1 total messages Started by Nawaf Al-Thurwi Sun, 08 Nov 2026 05:40
Bug#1153395: cpio: out-of-bounds stack read in from_ascii() on malformed newc header
#3742
Author: Nawaf Al-Thurwi
Date: Sun, 08 Nov 2026 05:40
88 lines
6521 bytes
Package: cpio
Version: 2.15+dfsg-2
Severity: normal
Tags: security upstream
X-Debbugs-Cc: security@debian.org

Dear cpio maintainers and Debian Security Team,

Please triage an out-of-bounds read in GNU cpio 2.15's newc header
parser, and consider backporting the existing upstream fix.

This report covers ONLY the from_ascii() read issue, not the separate
ustar output issue mentioned in my original email of 7 November 2026.
That original report was sent to security@debian.org and bug-cpio@gnu.org.
Collin Funk correctly pointed out that bug-cpio is public. Accordingly,
I am not requesting an embargo or describing this as a private report.
I am filing this here to provide proper package tracking, per Debian's
security FAQ. Please merge/redirect if an existing ticket covers it.

Affected source and root cause
-----------------------------
In GNU cpio 2.15, src/copyin.c, from_ascii() skips leading spaces with:

    for (; *buf == ' '; buf++)
      {
        if (buf == end)
          return 0;
      }

The loop condition dereferences buf before the end-of-field check.
For the final c_chksum field of the stack-allocated 110-byte newc header,
an all-spaces value causes a one-byte read beyond that header buffer.
Other fields can also be read beyond their individual field boundary.

Minimal reproducer
------------------
Generate a malformed 112-byte input in a disposable directory:

    python3 -c "from pathlib import Path; Path('poc.cpio').write_bytes(b'070701' + b' ' * (13 * 8) + b'x\x00')"

Then run an AddressSanitizer-instrumented GNU cpio 2.15 build:

    ASAN_OPTIONS=detect_leaks=0 /path/to/asan/cpio -it -F poc.cpio

This uses listing mode; extraction is not required. The existing report's
ASan reproduction identified a stack-buffer-overflow, READ of size 1,
in from_ascii(), called by read_in_new_ascii(), with the access just
past ascii_header. I can provide the original test artifacts on request.
A normal, non-sanitized binary is not guaranteed to crash.

Expected: reject the malformed header without reading beyond its buffer.
Observed in the prior instrumented reproduction: out-of-bounds stack read.

Impact and limitations
----------------------
This is a memory-safety violation reachable while parsing an untrusted
archive (CWE-125). The demonstrated consequence is an ASan abort.
I am NOT claiming a demonstrated attacker-visible memory leak, RCE,
privilege escalation, or a reliable crash of production builds. In
particular, downstream disclosure and availability impact need separate
validation. Severity is left conservative pending maintainer assessment.

Existing upstream fix
---------------------
The fix identified in my original investigation is upstream commit
bf16382, dated 2025-05-29, subject "Fix invalid memory access". It bounds
leading-space scanning before dereferencing buf. Please verify the full
commit and applicability to Debian's current source before backporting.

The original investigation reported Debian 2.15+dfsg-2 and
2.15+dfsg-2.1 without this fix; that is a prior assessment, not a fresh
claim about every currently shipped distribution or package revision.
I am not asserting that I originally discovered the upstream bug: the
upstream fix predates my independent reproduction on 7 November 2026.

Requested action
----------------
Please confirm the issue and affected Debian versions, track/backport the
upstream fix as appropriate, and advise whether an existing CVE covers
this root cause or whether CVE coordination is warranted. I do not want
a duplicate CVE request or to presume CVE eligibility from an ASan trace.

Credit for this report/reproduction, if applicable:
JailBr3ak (Nawaf Al-Thurwi), nawafalthurwi@gmail.com

Thank you,
Nawaf Al-Thurwi (JailBr3ak)
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads