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.
Originally disclosed on Cisco Talos
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…
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
- Generate a certificate with a long localityName field using openssl.
- Supply the certificate to the certfields example application.
- 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.