Skip to content
Memory corruption Advisory Advanced CVE-2020-28589

tinyobjloader LoadObj improper array index validation vulnerability

The LoadObj function in tinyobjloader fails to properly validate array indices, allowing a crafted OBJ file to contain negative vertex indices. When a program using the library processes the parsed data, it can access memory out of bounds, potentially leading to code execution.

Lilith >_> Follow

Originally disclosed on Cisco Talos

Critical 9.6 View original

An improper array index validation vulnerability exists in the LoadObj functionality of tinyobjloader v2.0-rc1 and tinyobjloader development commit 79d4421. A specially crafted file could lead to code execution.

Lilith >_>, 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

Likely the validation of vertex indices only checks against the upper bound and skips invalid triangles without rejecting the whole face, allowing negative indices to be stored and later used for out-of-bounds access.

Impact

A negative vertex index could cause an out-of-bounds read, and in the worst case, depending on how the values are used, this could lead to code execution.

What the attacker needed

Victim opens a malicious OBJ file; application uses tinyobjloader

How it was found

  1. Craft an OBJ file with a face that references a negative vertex index.
  2. Load the file using tinyobjloader's LoadObj function.
  3. Process the returned shapes and access the vertex data as shown in the example code.
  4. Observe an out-of-bounds read or crash.

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.

A library for loading 3D model files does not check that the numbers it reads for vertices are valid. A malicious file can include negative numbers, and when the program later uses those numbers to look up data, it reads memory it should not, which 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 Lilith >_>

View all

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