Skip to content
DoS Disclosed report Advanced

wddx_deserialize null dereference in php_wddx_pop_element

A null pointer dereference occurs in PHP's WDDX deserialiser when an element is added to a boolean leaf of an XML struct and then popped. An attacker supplying crafted WDDX data could crash the process handling it.

fms Follow

Originally disclosed on HackerOne

Bounty$500 View original
  • Disclosed after 3.2 years

Upstream Bug

https://bugs.php.net/bug.php?id=72799

Summary

If we add an element to boolean leaf of XML struct, a null pointer dereference will happen when the element is popped.

Source code:
https://github.com/php/php-src/blob/PHP-5.6.24/ext/wddx/wddx.c#L985

static void php_wddx_pop_element(void *user_data, const XML_Char *name)
{
...
  if (Z_TYPE_P(ent2->data) == IS_ARRAY || Z_TYPE_P(ent2->data) == IS_OBJECT) {
    target_hash = HASH_OF(ent2->data);
...

Patch

http://git.php.net/?p=php-src.git;a=commit;h=1f6078e4a5c67733bfdbd20bb2706501ac56a344

Fixed for PHP 5.6.25, PHP 7.0.10

http://php.net/ChangeLog-5.php http://php.net/ChangeLog-7.php

The original report as published on HackerOne, by fms. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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

Likely the pop handler assumes the current element's data is always an array or object before calling HASH_OF, without checking for scalar types such as boolean.

Impact

A crafted WDDX document could cause a null pointer dereference and crash the PHP process handling it.

What the attacker needed

Ability to supply WDDX data to PHP

The fix

It was fixed in PHP 5.6.25 and PHP 7.0.10 via an upstream commit.

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.

WDDX is an old format for packing data into XML, and PHP can unpack it. When the unpacking code met an unexpected structure, it tried to use a pointer that was empty, which crashes the program instead of failing safely. A crash like this can take down the service that processes the data.

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.

More by fms

View all

33 more disclosed reports, best first.

More from Internet Bug Bounty

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.