Skip to main content

PHAR archive entry injection via integer overflow in TAR parser

Publication Date 2026-09-25
Severity Moderate
Type PHP Object Injection
Affected PHP Versions
  • 7.2.0-7.2.34
  • 7.3.0-7.3.33
  • 7.4.0-7.4.33
  • 8.1.0-8.1.34
  • 8.2.0-8.2.33
  • 8.3.0-8.3.34
  • 8.4.0-8.4.25
  • 8.5.0-8.5.10
Fixed Product Versions
  • ZendPHP 7.2
  • ZendPHP 7.3
  • ZendPHP 7.4
  • ZendPHP 8.1
  • ZendPHP 8.2
  • ZendPHP 8.3
  • ZendPHP 8.4
  • ZendPHP 8.5
  • ZendServer 2021.4.8

CVE Details

phar_tar_number() parses the octal size field of a TAR header into a uint32_t with no overflow check. The field is 11 octal digits wide and holds values up to 0x1FFFFFFFF, so a size above 0xFFFFFFFF silently wraps. The parser then skips the wrong number of data blocks and interprets attacker-controlled file content as the next TAR header, which lets a crafted archive inject entries that PharData reports and extracts as if they were genuine, causing the parser to miscalculate data boundaries and treat file content as valid header data. This allows an attacker to inject unauthorized entries that the application extracts as authentic files, potentially leading to unauthorized data modification.

Recommendations

Never use untrusted PHAR archives. If you cannot validate the origin and contents of a PHAR archive, we recommend updating to a patched version of PHP.