[php-src] PR #21694: Fix GH-21682: Add NOT_SERIALIZABLE to ZipArchive, XMLWriter, XMLReader, SNMP, tidy, tidyNode
| From: | iliaal | Date: | Thu, 09 Apr 2026 18:25:43 +0000 |
| Subject: | [php-src] PR #21694: Fix GH-21682: Add NOT_SERIALIZABLE to ZipArchive, XMLWriter, XMLReader, SNMP, tidy, tidyNode | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-35640@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/21694
Author: iliaal
Fixes #21682
Six classes wrap native C handles but allow serialization. Unserializing them produces objects with
NULL internal pointers.
Segfault:
-
tidyNode (ext/tidy): crashes on hasChildren(), dangling
TidyNode pointer
Silent data loss:
- ZipArchive (ext/zip): numFiles returns 0, archive contents gone
- tidy (ext/tidy): body() returns NULL, cleanRepair() no-ops
- SNMP (ext/snmp): methods run against a dead session without error
Throws on use:
- XMLWriter (ext/xmlwriter): methods throw "Invalid or uninitialized XMLWriter
object"
- XMLReader (ext/xmlreader): read() throws "Data must be loaded
before reading"
Adds @not-serializable to all six so serialize() throws instead of
producing broken objects.
Two existing UAF exploit tests (bug72479.phpt, bug72434.phpt) relied on
unserialize() instantiating SNMP and ZipArchive objects. With
NOT_SERIALIZABLE, unserialize() rejects these classes outright, removing
the UAF vector.