Skip to content
Memory corruption Disclosed report Advanced CVE-2019-9023

Heap overflow in utf32be_mbc_to_code

A heap buffer overflow existed in PHP's mbstring functions that convert UTF-32 and UTF-16 encoded strings to code points, because the code assumed a fixed buffer length. An attacker could trigger memory leakage or corruption by supplying crafted multibyte strings.

haquaman Follow

Originally disclosed on HackerOne

Bounty$1,500 Critical 9.8 View original
  • Triaged in 4 months
  • Fixed in 21 months
  • Paid in 21 months
  • Disclosed after 22 months

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

Buffer overflow in mbc_to_code functions for UTF32BE, UTF32LE, UTF16BE, and UTF16LE due to incorrect length assumptions of a buffer. Provided a patch that was adapted to check the length of the buffer prior to using it.

Impact

Memory leakage and/or corruption

The original report as published on HackerOne, by haquaman. 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 conversion functions assumed a fixed buffer size instead of checking the actual remaining length before writing converted code points.

Impact

An attacker could cause memory leakage and/or corruption, though the text does not state whether this leads to code execution.

What the attacker needed

Ability to supply crafted multibyte strings

The fix

The bug was fixed by a patch that checks the buffer length before using it.

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.

PHP has functions for handling text in different encodings, such as UTF-16 and UTF-32. A bug in these functions meant that when they read certain specially crafted text, they could write past the end of a memory buffer. This can crash the program or leak or corrupt memory, which an attacker might exploit.

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.

More by haquaman

View all

28 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.

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.