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

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.

Aleksandar Nikolic Follow

Originally disclosed on Cisco Talos

High 8.1 View original

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.

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

  1. Craft an X509 certificate with a PolicyMappings extension containing an ASN1 OID sequence of length N but encoding N+1 OIDs.
  2. Present the certificate to a vulnerable client or server during a secure connection initiation.
  3. 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.

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.