🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.bugs.dist
Article #3742

Bug#1153395: cpio: out-of-bounds stack read in from_ascii() on malformed newc header

#3742
From: 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)
Technical Details
Message-ID: <NX3Ng-ayJ0-15@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!3.eu.feeder.erje.net!feeder.erje.net!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!3.eu.feeder.erje.net!feeder.erje.net!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod
From: Nawaf Al-Thurwi <nawafalthurwi@gmail.com>
Newsgroups: linux.debian.bugs.dist
Subject: Bug#1153395: cpio: out-of-bounds stack read in from_ascii() on malformed newc header
Date: Sun, 08 Nov 2026 06:40:02 +0100
Message-ID: <NX3Ng-ayJ0-15@gated-at.bofh.it>
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org  Sun Nov  8 05:31:09 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: 1.827
Reply-To: Nawaf Al-Thurwi <nawafalthurwi@gmail.com>, 1153395@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: security@debian.org, anibal@debian.org
X-Debian-Pr-Message: report 1153395
X-Debian-Pr-Package: cpio
X-Debian-Pr-Keywords: security upstream
X-Debian-Pr-Source: cpio
X-Gm-Message-State: APuU4Z8qvODjyeKZFxjaOL3xR8pzFRIAgcPlHgft1HjRi7266umthqtN
	qbjC52mqdXmLkKJQMcMwMekN8Ut5FzkzlkA1J1dWRs0tsy4CSUaNUZGVMq2kC5Ol
X-Gm-Gg: AYBFou1VdBiZ+NeHH/RMBEOvlkGiM9HA3JEp1U/hnRL7sCjUbIyf9SFIcHfiPV+jJWB
	UW2A1B+YlYIUew+KpxzSbHsQnlufKzCsRhLxWDo5ufgv2XhEMIFIFf+wfiyzr5cMQsnAoYFjCBh
	D1ge+2PeUEwiET564s+N2pYhN0RJcPHFKZkT+UmD/R1hurrsGHdm+eUb9OzRXMy9qL4LBpb+F3o
	5Kj8Y/DCUmfhgXssgHvMg3keNqjbkXw2V+45sRto5btFWA77mIa7fFtmrLcGko52MrriN85hHYv
	g+Fv+bb21cEpbsl2LzW8ZK0RGU5LjaSyz2TeVXtRDriCerGNIw+LMzRyfE+y4VxXgkuaKizhoVn
	6W3U3RGuaw5c2nTKft5xc/wI5eEJOumlOd7hJtNtq3SfkmR+Ic+n//gBiqfLfVvifx2zuQuGZe6
	JnmOzJiNkQvbkofM6tPrXgc2bciMsMjQ5FXCBOi2c+0fu0xLL9Ymb/SNvGQou73dcfjhDWvUlD3
	d34DM/of1ZYPqo4WHSNGaX+ey1MzFU09PsaAOyixeXTXNXGZK8IboTo9QswfdxJYTtUeuCnC0Hw
	sCIJ2kxi20S7sso5ODpwxyQBRl5KCJeSN086BlgBNmk6XRLbC0dHN0C/IwA6FhJi6RNpaqH499Y
	Q5Ewe347591K5rK/oB8L7uoBXSpoDFTpe9aZKj+uXepgHm7HyHWEbAWmO/eTMYtNwD+fpO9za
X-Received: by 2002:a05:600c:83c8:b0:4a3:18ca:806 with SMTP id 5b1f17b1804b1-4b963c6bc6amr10626805e9.20.1794115740495;
        Sat, 07 Nov 2026 21:29:00 -0800 (PST)
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/2001391
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 88
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Sun, 08 Nov 2026 05:28:55 -0000
X-Original-Message-ID: <179411573568.2823322.10313261712175133390@gmail.com>