Skip to content
RCE Disclosed report Advanced

Free called on unitialized pointer in exif.c

A use-after-free or uninitialised pointer flaw in PHP's exif.c allowed an attacker who can control heap layout to make PHP call free() on an arbitrary pointer, potentially leading to remote code execution. The reporter demonstrated a proof of concept showing control over the pointer value passed to free().

endeavor Follow

Originally disclosed on HackerOne

  • Fixed in 3 months
  • Paid in 3 months
  • Disclosed after 9 days

This bug was reported directly to php:

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

It has been patched in the 5.4, 5.5 and 5.6 branch.

5.4 branch http://git.php.net/?p=php-src.git;a=commit;h=2fc178cf448d8e1b95d1314e47eeef610729e0df

5.5 branch http://git.php.net/?p=php-src.git;a=commit;h=55001de6d8c6ed2aada870a76de1e4b4558737bf

5.6 branch http://git.php.net/?p=php-src.git;a=commit;h=21bc7464f454fec18a9ec024c738f195602fee2a

If an attacker can gain determinism in the heap, he/she can cause PHP to call free() on an arbitrary pointer. This can lead to a variety of outcomes, including RCE.

In my bug writeup, I demonstrated a PoC which showed control over the value which free() was called on.

The bug report has now been made public by PHP. Additionally, PHP 5.5.21 was released today. This release publicly discloses the issue and corresponding CVE by the php project maintainers.

Please let me know if this qualifies for a bug bounty, or if there are any other details I need to provide.

The original report as published on HackerOne, by endeavor. 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

Impact

An attacker who can gain determinism in the heap could cause PHP to free an arbitrary pointer, leading to a variety of outcomes including remote code execution.

What the attacker needed

Ability to influence heap layout; PHP with vulnerable EXIF extension

The fix

The issue was fixed in the PHP 5.4, 5.5 and 5.6 branches.

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.

This is a memory corruption bug in PHP's EXIF code. If an attacker can make heap memory predictable, PHP can be made to free an arbitrary pointer, which may crash the server or, in some cases, allow code execution.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

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.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.