The vulnerability, identified as GHSA-j5gw-2vrg-8fgx, is a PAX header desynchronization issue in the astral-tokio-tar library. The root cause is the incorrect precedence of headers when determining an archive entry's size. The parser was using the size from the standard ustar header while ignoring the size specified in a preceding PAX extended header. An attacker can craft a tar file with a PAX header defining a non-zero size and a ustar header with a size of zero. The vulnerable code would read the zero size and advance the stream by zero bytes, causing the parser to interpret the actual file content as a new sequence of tar headers, leading to a desynchronization attack.
The analysis of the fixing commit 22b3f884adb7a2adf1d3a8d03469533f5cbc8318 confirms this. The core of the vulnerability is in the poll_next_raw function in src/archive.rs. The patch modifies this function to correctly read the size value from the PAX extensions, giving it precedence over the ustar header's size. The Entries::poll_next function, which is the public-facing stream iterator, was also modified to pass the necessary PAX data to poll_next_raw. Therefore, both poll_next_raw (where the faulty logic resided) and Entries::poll_next (the public API entry point that calls it) are identified as the key functions that would be active during the exploitation of this vulnerability.