InsideSecure MatrixSSL x509 certificate SubjectDomainPolicy Remote Code Execution Vulnerability
A heap buffer overflow exists in MatrixSSL's parsing of the X509 SubjectDomainPolicy PolicyMappings extension. A specially crafted certificate can cause a buffer overflow on the heap, potentially leading to remote code execution.
Originally disclosed on Cisco Talos
An exploitable heap buffer overflow vulnerability exists in the X509 certificate parsing functionality of InsideSecure MatrixSSL 3.8.7b. A specially crafted x509 certificate can cause a buffer overflow on the heap resulting in remote code execution.
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 code allocates an array using the ASN1 length field but then copies a number of OIDs that can exceed that length due to how OIDs are parsed.
What the attacker needed
Victim connects to attacker-controlled server; or attacker supplies a crafted certificate
The fix
The fix is to allocate the array using the actual number of parsed OIDs (oidlen) instead of the ASN1 length (len).
How it was found
- Craft an X509 certificate with a PolicyMappings extension containing an ASN1 OID sequence of length N but encoding N+1 OIDs.
- Present the certificate to a vulnerable client or server during a secure connection initiation.
- The parsing function allocates an array of size N but copies N+1 elements, causing a heap buffer overflow.
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 must carefully check the size of data before copying it into memory. Here, the program allocated space based on one size but then copied more data than that, overflowing the buffer. This can crash the program or 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.