Skip to content
Memory corruption Disclosed report Advanced CVE-2016-0799

CVE-2016-0799 memory issues in BIO_*printf functions

The BIO_*printf functions in OpenSSL had an integer overflow when calculating the length of a very long string, leading to an out-of-bounds read, and a separate out-of-bounds write on memory allocation failure. An attacker who can supply large amounts of untrusted data to these functions could trigger these memory issues, potentially causing a crash or other undefined behaviour.

guido Follow

Originally disclosed on HackerOne

  • Fixed in 31 days
  • Paid in 31 days
  • Disclosed after 31 days

Summary by the program

Severity: Low

The internal |fmtstr| function used in processing a "%s" format string in the BIO_*printf functions could overflow while calculating the length of a string and cause an OOB read when printing very long strings.

Additionally the internal |doapr_outch| function can attempt to write to an OOB memory location (at an offset from the NULL pointer) in the event of a memory allocation failure. In 1.0.2 and below this could be caused where the size of a buffer to be allocated is greater than INT_MAX. E.g. this could be in processing a very long "%s" format string. Memory leaks can also occur.

The first issue may mask the second issue dependent on compiler behaviour. These problems could enable attacks where large amounts of untrusted data is passed to the BIO_*printf functions. If applications use these functions in this way then they could be vulnerable. OpenSSL itself uses these functions when printing out human-readable dumps of ASN.1 data. Therefore applications that print this data could be vulnerable if the data is from untrusted sources. OpenSSL command line applications could also be vulnerable where they print out ASN.1 data, or if untrusted data is passed as command line arguments.

Libssl is not considered directly vulnerable. Additionally certificates etc received via remote connections via libssl are also unlikely to be able to trigger these issues because of message size limits enforced within libssl.

This issue affects OpenSSL versions 1.0.2 and 1.0.1.

OpenSSL 1.0.2 users should upgrade to 1.0.2g OpenSSL 1.0.1 users should upgrade to 1.0.1s

This issue was reported to OpenSSL on February 23rd by Guido Vranken. The fix was developed by Matt Caswell of the OpenSSL development team.

The report

https://github.com/openssl/openssl/commit/9cb177301fdab492e4cfef376b28339afe3ef663

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

These problems could enable attacks where large amounts of untrusted data is passed to the BIO_*printf functions, but libssl is not considered directly vulnerable and remote connections are unlikely to trigger the issues due to message size limits.

What the attacker needed

Application passes large untrusted data to BIO_*printf; OpenSSL version 1.0.2 or 1.0.1

The fix

The issue was fixed by upgrading to OpenSSL 1.0.2g or 1.0.1s.

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.

OpenSSL is a widely used library for secure communication. Some of its functions that format text for printing had bugs: when given an extremely long piece of text, they could read or write memory outside the intended area. This could crash the program or, in rare cases, lead to other problems, but only if the program passes very large untrusted input to these functions.

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 guido

View all

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