Skip to content
Memory corruption Advisory Advanced

GHSL-2023-105: Buffer Overflow in uchardet

A crafted byte sequence causes an out-of-bounds read in the uchardet library's GetOrderFromCodePoint function. An attacker could use this to leak internal memory allocation information.

jarlob Follow

Originally disclosed on GitHub Security Lab

A crafted sequence of bytes triggers memory read past the bounds of a globally allocated object buffer.

jarlob, on GitHub Security Lab

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

How it worked

Root cause

The binary search loop can set the index to the maximum value, and the next iteration reads at index i*2 which is one past the end of the charOrderTable buffer.

Impact

This issue may be used to leak internal memory allocation information.

What the attacker needed

Attacker can supply crafted input to uchardet

The fix

The issue was fixed in the master branch after v0.0.8.

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.

uchardet is a library that guesses the character encoding of text. A bug in its search code lets a specially crafted input read one integer beyond the end of a global array, which could reveal memory layout details to an attacker.

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 jarlob

View all

192 more disclosed reports, best first.

More from GitHub Security Lab

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.