Skip to content
Memory corruption Advisory Advanced CVE-2017-2800

WolfSSL library X509 Certificate Text Parsing Code Execution Vulnerability

An off-by-one write in wolfSSL's X509 certificate parsing allows a crafted certificate to overwrite one byte past a buffer, potentially causing denial of service or remote code execution. The attacker must supply a malicious certificate to a client or server using the library.

Aleksandar Nikolic Follow

Originally disclosed on Cisco Talos

High 8.1 View original

An exploitable off-by-one write vulnerability exists in the x509 certificate parsing functionality of wolfSSL library versions up to 3.10.2. A specially crafted x509 certificate can cause a single out of bounds byte overwrite resulting in potential certificate validation vulnerabilities, denial of service and possible…

Aleksandar Nikolic, on Cisco Talos

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 function copies the minimum of the string length and buffer size, then uses that same value as an index to write a null terminator, which can be one past the end of the buffer.

Impact

A crafted certificate could cause a denial of service or potentially remote code execution, depending on how the library is used.

What the attacker needed

Attacker supplies a malicious certificate; victim uses wolfSSL library to parse it

How it was found

  1. Generate a certificate with a long localityName field using openssl.
  2. Supply the certificate to the certfields example application.
  3. Observe the stack-buffer-overflow reported by AddressSanitizer.

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.

When a program reads a certificate, it copies text fields like the common name into a fixed-size buffer. If the text is too long, the code writes one extra null byte just past the buffer, which can corrupt nearby memory. This might crash the program or, in rare cases, let an attacker run their own code.

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 Aleksandar Nikolic

View all

147 more disclosed reports, best first.

More from Cisco Talos

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.