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

Prusa Research PrusaSlicer _3MF_Importer::_handle_end_model() use-after-free vulnerability

A use-after-free vulnerability in PrusaSlicer's handling of 3MF files allows an attacker to execute code by providing a specially crafted file. The flaw arises because the importer deletes objects from a vector while iterating over a map that references indices in that vector, leading to out-of-bounds access and double-free.

Lilith >_> Follow

Originally disclosed on Cisco Talos

High 8.8 View original

A use-after-free vulnerability exists in the 3MFImporter::handleendmodel() functionality of Prusa Research PrusaSlicer 2.2.0 and Master (commit 4b040b856). A specially crafted 3MF 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 importer iterates over a map of object IDs to indices while deleting objects from a vector, causing the indices to become stale and leading to out-of-bounds access and double-free.

Impact

An attacker could execute arbitrary code by convincing a user to open a malicious 3MF file, potentially leading to full compromise of the user's system.

What the attacker needed

Victim opens a malicious 3MF file

How it was found

  1. Create a 3MF file containing a .3dmodel file with multiple <object> elements whose IDs are not in ascending order.
  2. Ensure that the objects are not built or instantiated (i.e., not referenced in the <build> section).
  3. Open the 3MF file in PrusaSlicer, triggering the _handle_end_model function.
  4. The function iterates over the m_objects map and deletes objects from m_model->objects vector, but the map's indices become invalid as the vector shrinks.
  5. Subsequent iterations access out-of-bounds indices, causing a use-after-free and potentially code execution.

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 frees memory but then uses it again, that's a use-after-free. Here, the program deletes objects from a list but keeps using old references, which can let an attacker run their own code by opening a malicious 3D model file.

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.