Skip to content
Memory corruption Advisory Intermediate CVE-2020-28599

Openscad import_stl.cc:import_stl() stack-based buffer overflow vulnerability

A stack-based buffer overflow in Openscad's STL import function allows an attacker to execute arbitrary code by providing a specially crafted STL file with more than three vertex lines in an outer loop.

Lilith >_> Follow

Originally disclosed on Cisco Talos

High 8.8 View original

A stack-based buffer overflow vulnerability exists in the importstl.cc:importstl() functionality of Openscad openscad-2020.12-RC2. A specially crafted STL file can 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

The code does not check the index `i` before writing to the fixed-size array `vdata[3][3]`, allowing writes beyond its bounds when more than three vertex lines appear in an outer loop.

Impact

An attacker could achieve code execution by convincing a user to import a malicious STL file.

What the attacker needed

Victim opens a malicious STL file in Openscad

The fix

The vulnerability was fixed by the vendor.

How it was found

  1. Create an STL file with an outer loop containing more than three vertex lines.
  2. Import the file into Openscad using the import command.
  3. The parser writes each vertex coordinate into the fixed-size array, overflowing the stack.

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 Openscad reads an STL file, it stores vertex coordinates in a fixed-size array on the stack. If the file contains more than three vertices in one loop, the program writes past the array, corrupting memory. An attacker can exploit this to run their own code on the victim's computer.

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.