Skip to content
Memory corruption Write-up Advanced

Exploiting memory corruption bugs in PHP

A use-after-free vulnerability in PHP's unserialize function allows an attacker to craft a serialized object that leaks arbitrary memory contents. By manipulating the serialized data, an attacker can read sensitive information such as the PHP binary, SSL certificates, and memory addresses, which could aid in further exploitation.

inulledmyself.com

Published on inulledmyself.com

In Part 1, we figured out how to locally exploit CVE-2014-8142 and CVE-2015-0231. In Part 2, we'll discuss remotely exploiting this vulnerability, and what we can steal from the application using the methods we discover.

The author, on inulledmyself.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely a use-after-free vulnerability in PHP's unserialize function where a freed zval can be referenced, allowing an attacker to control a pointer and read arbitrary memory.

What the attacker needed

PHP application using unserialize on user input; ability to send serialized data

How it was found

  1. Create an array of integers
  2. Free the array we just created
  3. Create our string from the previous example
  4. Point to the reference of an integer that we just freed

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 write-up has not been written yet. The Original tab links to the source.

This report describes a bug in PHP's unserialize function that lets an attacker read memory they shouldn't be able to. By sending a specially crafted serialized string, an attacker can trick PHP into revealing data from its own memory, like parts of the program or encryption keys. This is dangerous because it can help attackers take over the server.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.