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

Negative size parameter in mb_split

The mb_split function in PHP mishandled strings ending in an incomplete multibyte character, computing a negative length that was passed to an internal string-creation routine. This could cause a crash and potentially memory corruption or leakage.

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=77367

mb_split doesn't correctly detect the length when the $string has an unfinished multibyte character at the end of the string. This causes a crash due to a negative parameter to add_next_index_stringl, which calls zend_string_init and memcpy.

Could reproduce on master.

Impact

This could be used to cause memory corruption/leakage.

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 length calculation in mb_split did not account for a trailing incomplete multibyte sequence, producing a negative length that was passed unchecked to add_next_index_stringl.

Impact

This could be used to cause memory corruption or leakage, and the text reports a crash.

What the attacker needed

Call mb_split on a string ending mid-character

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 multibyte character is a single letter that takes more than one byte to store, such as many non-English characters. If a string ends halfway through such a character, the splitting function miscounts the length and ends up with a negative number, which it then uses as if it were a real size. That can crash the program and may let an attacker corrupt or read memory.

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.