Skip to content

Fix GH-25089: Heap buffer over-read via crafted alias size in zip-based phar - #25099

Closed
lazerg wants to merge 2 commits into
php:PHP-8.4from
lazerg:fix/gh-25089-phar-zip-alias-len
Closed

lazerg wants to merge 2 commits into
php:PHP-8.4from
lazerg:fix/gh-25089-phar-zip-alias-len

Conversation

@lazerg

@lazerg lazerg commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

phar_parse_zipfile() set the alias length from the size claimed in the zip headers before reading the alias, but the buffer only holds what was actually decompressed. A smaller payload made phar_validate_alias() and Phar::getAlias() read past the buffer, so the length is now taken after the read.

Fixes #25089

@ndossche ndossche left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving final review for Weilin, but based on past review experience of phar, this is good.

@LamentXU123 LamentXU123 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you.

LamentXU123 added a commit that referenced this pull request Nov 1, 2026
* PHP-8.6:
  Fix GH-25089: Heap buffer over-read via crafted alias size in zip-based phar (#25099)
SyntX34 pushed a commit to SyntX34/php-src that referenced this pull request Nov 1, 2026
* PHP-8.4:
  Fix phpGH-25089: Heap buffer over-read via crafted alias size in zip-based phar (php#25099)
SyntX34 pushed a commit to SyntX34/php-src that referenced this pull request Nov 1, 2026
* PHP-8.5:
  Fix phpGH-25089: Heap buffer over-read via crafted alias size in zip-based phar (php#25099)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants