Skip to content
RCE Disclosed report Advanced CVE-2015-2158

pngcrush_measure_idat() off-by-one error (CVE-2015-2158)

An off-by-one error in pngcrush's pngcrush_measure_idat() function can cause a write outside the buff buffer when length is zero. Attackers could potentially exploit this to execute arbitrary code or cause a denial-of-service.

geeknik Follow

Originally disclosed on HackerOne

  • Fixed in 9 months
  • Disclosed after 4.3 years

This is an off-by-one error in the "pngcrush_measure_idat()" function in pngcrush.c, introduced by commit http://sourceforge.net/p/pmt/code/ci/e1a36a9639e2db16494d90459c7c2b78677a20bf/ in version 1.7.83.

The code in pngcrush.c line 7405: if (length < 28) for (ib=27; ib >= length; ib--) buff[ib] = 0;

If length is 0, the last iteration will set "ib" to -1, thus buff[ib] = 0; will write outside of the "buff" buffer.

Attackers could potentially exploit this issue to execute arbitrary code in the context of the user running the affected applications. Failed exploit attempts will likely cause a denial-of-service condition. This issue was fixed in version 1.7.84 by commit http://sourceforge.net/p/pmt/code/ci/a1ce646d00a400fd9ec321ab5cb522f40b7bdfe6/.

I reported this to the project maintainer on February 27th 2015 via email, he reported it fixed on February 28th 2015.

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

Attackers could potentially exploit this issue to execute arbitrary code in the context of the user running the affected applications. Failed exploit attempts will likely cause a denial-of-service condition.

What the attacker needed

Length value of zero in pngcrush_measure_idat(); affected application processes input reaching this function

The fix

This issue was fixed in version 1.7.84 by commit [redacted].

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 buffer is a fixed-size area of memory. An off-by-one error means the program writes one step past the end of that area. This can crash the program or, in rare cases, let an attacker run their own code.

What is RCE?

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

More by geeknik

View all

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

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.