summaryrefslogtreecommitdiff
path: root/ext/standard/tests/serialize/bug70219.phpt
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2015-09-01 11:40:15 -0700
committerStanislav Malyshev <stas@php.net>2015-09-01 11:40:15 -0700
commit48cfd1160b4667115f33c4398215759d5e0643d8 (patch)
tree400a688b74adb2d1577c46f37a2a870f00988663 /ext/standard/tests/serialize/bug70219.phpt
parent9ff333439721dd42faa2e1c838c178633703ef0c (diff)
parent7c31203935589ab4fcb104041ef9d87f747bfee4 (diff)
downloadphp-git-48cfd1160b4667115f33c4398215759d5e0643d8.tar.gz
Merge branch 'PHP-5.4.45' into PHP-5.4
* PHP-5.4.45: Improve fix for #70172 Fix bug #70312 - HAVAL gives wrong hashes in specific cases fix test add test Fix bug #70366 - use-after-free vulnerability in unserialize() with SplDoublyLinkedList Fix bug #70365 - use-after-free vulnerability in unserialize() with SplObjectStorage Fix bug #70172 - Use After Free Vulnerability in unserialize() Fix bug #70388 - SOAP serialize_function_call() type confusion Fixed bug #70350: ZipArchive::extractTo allows for directory traversal when creating directories Improve fix for #70385 Fix bug #70345 (Multiple vulnerabilities related to PCRE functions) Fix bug #70385 (Buffer over-read in exif_read_data with TIFF IFD tag byte value of 32 bytes) Fix bug #70219 (Use after free vulnerability in session deserializer) Fix for bug #69782
Diffstat (limited to 'ext/standard/tests/serialize/bug70219.phpt')
-rw-r--r--ext/standard/tests/serialize/bug70219.phpt38
1 files changed, 38 insertions, 0 deletions
diff --git a/ext/standard/tests/serialize/bug70219.phpt b/ext/standard/tests/serialize/bug70219.phpt
new file mode 100644
index 0000000000..84a059f365
--- /dev/null
+++ b/ext/standard/tests/serialize/bug70219.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Bug #70219 Use after free vulnerability in session deserializer
+--FILE--
+<?php
+class obj implements Serializable {
+ var $data;
+ function serialize() {
+ return serialize($this->data);
+ }
+ function unserialize($data) {
+ session_start();
+ session_decode($data);
+ }
+}
+
+$inner = 'ryat|a:1:{i:0;a:1:{i:1;';
+$exploit = 'a:2:{i:0;C:3:"obj":'.strlen($inner).':{'.$inner.'}i:1;R:4;}';
+
+$data = unserialize($exploit);
+
+for ($i = 0; $i < 5; $i++) {
+ $v[$i] = 'hi'.$i;
+}
+
+var_dump($data);
+?>
+--EXPECTF--
+Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
+array(2) {
+ [0]=>
+ object(obj)#%d (1) {
+ ["data"]=>
+ NULL
+ }
+ [1]=>
+ array(0) {
+ }
+}