wddx_deserialize null dereference
The wddx_deserialize function did not check the return value of php_base64_decode, which can return NULL for invalid base64 input. An attacker could cause a null pointer dereference, leading to a crash or denial of service.
- Fixed in 32 days
- Paid in 32 days
- Disclosed after 3.2 years
Upstream Bug
https://bugs.php.net/bug.php?id=72750
Summary
When wddx deserialize tries to parse an invalid base64 binary value, php_base64_decode return NULL. The return value is not checked and used.
https://github.com/php/php-src/blob/master/ext/wddx/wddx.c#L896
if (!strcmp((char *)name, EL_BINARY)) {
zend_string *new_str = php_base64_decode(
(unsigned char *)Z_STRVAL(ent1->data), Z_STRLEN(ent1->data));
zval_ptr_dtor(&ent1->data);
ZVAL_STR(&ent1->data, new_str);
}
Patch
http://git.php.net/?p=php-src.git;a=commit;h=698a691724c0a949295991e5df091ce16f899e02
Fixed for PHP 5.6.25, PHP 7.0.10
http://php.net/ChangeLog-5.php http://php.net/ChangeLog-7.php
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The code failed to check whether php_base64_decode returned NULL before using the result.
Impact
Using the NULL result could cause a null pointer dereference, potentially crashing the PHP process.
What the attacker needed
Ability to supply wddx data with invalid base64
The fix
The issue was fixed in PHP 5.6.25 and PHP 7.0.10, per the linked patch.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A function that decodes base64 data can fail and return nothing (NULL) when given bad input. The code used that nothing as if it were a real string, which can crash the program. This means a malicious input could make the server crash.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.