Skip to content

Commit 2d9a1c1

Browse files
committed
Update bug72434.phpt UAF test and move it to ext/zip/tests
bug72434.phpt tested a UAF via unserialize() of ZipArchive. With NOT_SERIALIZABLE, unserialize() rejects the class entirely, preventing the UAF by construction. Update the test to verify the rejection and move it to ext/zip/tests since it requires the zip extension.
1 parent 3283293 commit 2d9a1c1

2 files changed

Lines changed: 17 additions & 29 deletions

File tree

ext/standard/tests/strings/bug72434.phpt

Lines changed: 0 additions & 29 deletions
This file was deleted.

ext/zip/tests/bug72434.phpt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
Bug #72434: ZipArchive class Use After Free Vulnerability in PHP's GC algorithm and unserialize
3+
--EXTENSIONS--
4+
zip
5+
--FILE--
6+
<?php
7+
$free_me = array(new StdClass());
8+
$serialized_payload = 'a:3:{i:1;N;i:2;O:10:"ZipArchive":1:{s:8:"filename";'.serialize($free_me).'}i:1;R:4;}';
9+
try {
10+
$unserialized_payload = unserialize($serialized_payload);
11+
var_dump($unserialized_payload);
12+
} catch (Exception $e) {
13+
echo $e->getMessage() . "\n";
14+
}
15+
?>
16+
--EXPECT--
17+
Unserialization of 'ZipArchive' is not allowed

0 commit comments

Comments
 (0)