Skip to content
Memory corruption Advisory Advanced CVE-2022-36788

Slic3r libslic3r TriangleMesh clone heap-based buffer overflow vulnerability

A heap-based buffer overflow exists in the TriangleMesh clone functionality of Slic3r libslic3r. A specially crafted STL file can trigger the overflow, potentially leading to code execution or a crash.

Francesco Benvenuto Follow

Originally disclosed on Cisco Talos

High 8.1 View original

A heap-based buffer overflow vulnerability exists in the TriangleMesh clone functionality of Slic3r libslic3r 1.3.0 and Master Commit b1a5500. A specially-crafted STL file can lead to a heap buffer overflow.

Francesco Benvenuto, 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 copy constructor copies the facets_malloced count without adjusting it to the actual allocated size after degenerate facets are removed, so later code believes there is more space than actually exists.

Impact

An attacker could cause a heap buffer overflow, potentially leading to code execution or a crash.

What the attacker needed

Malicious STL file; victim opens file in Slic3r

How it was found

  1. Craft an STL file that causes degenerate facets to be removed during topology check.
  2. Load the STL file into Slic3r, triggering the TriangleMesh copy constructor.
  3. The copy constructor allocates a smaller array but copies the larger facets_malloced value.
  4. When adding a facet, the check against facets_malloced passes, and a write occurs beyond the allocated buffer.

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.

This report describes a memory corruption bug in a 3D printing program. When the program reads a specially crafted 3D model file, it miscounts how much memory it needs and writes data past the end of a buffer, 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 Francesco Benvenuto

View all

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