REDHAT-BUG-2571892: Low severity GNU cpio vulnerability
A flaw was found in GNU cpio through version 2.15. An out-of-bounds read vulnerability exists in src/copyin.c:fromascii() when parsing newc and crc format archive headers.
The loop in fromascii() that skips leading whitespace dereferences the buffer pointer (buf) prior to validating whether the pointer has reached the end boundary (buf == end). When parsing the final field (cchksum, offset 102..109) of struct newasciiheader, an all-spaces value causes the loop to read one byte past asciiheader[110] on the stack of readinnewascii(). If subsequent stack memory contains spaces, the pointer continues advancing into adjacent stack data and decodes those bytes into parsed header values (such as cchksum or cnamesize).
Affected Software
Event History
Frequently Asked Questions
What does an attacker need to provide to trigger the issue?
The attacker needs a crafted newc or crc format archive whose final header field, c_chksum, is filled with spaces. GNU cpio must parse that archive header.
Which deployments are exposed?
Deployments using GNU cpio through version 2.15 are affected when they process newc or crc archives. Exposure is most relevant where cpio is used to handle archives from untrusted or insufficiently validated sources.
What is the effect of the out-of-bounds read?
GNU cpio can read past the end of the archive header buffer into adjacent stack memory. If the adjacent bytes are spaces, they may be interpreted as header data such as the checksum or name-size fields.