Prusa Research PrusaSlicer Obj.cpp load_obj() out-of-bounds write vulnerability
A heap-based buffer overflow exists in PrusaSlicer's OBJ file parser due to a mismatch between the number of allocated facets and the number of facets written when processing certain vertex counts. An attacker could provide a malicious OBJ file to trigger an out-of-bounds write, potentially leading to code execution.
Originally disclosed on Cisco Talos
An out-of-bounds write vulnerability exists in the Obj.cpp loadobj() functionality of Prusa Research PrusaSlicer 2.2.0 and Master (commit 4b040b856). A specially crafted obj file can lead to code execution.
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 memory for facets based on a count that can be smaller than the number of facets actually written, because the write loop can increment the facet index twice per iteration while the allocation count only increments once per face.
Impact
An attacker could potentially execute arbitrary code by convincing a victim to open a malicious OBJ file, though the report only demonstrates a crash under AddressSanitizer.
What the attacker needed
Victim opens a malicious .obj file
The fix
The vulnerability was fixed by the vendor, as indicated in the timeline.
How it was found
- Craft an OBJ file with a vertex count such that the total number of vertices modulo 4 equals 3.
- Open the malicious OBJ file in PrusaSlicer.
- The parser processes the file and triggers an out-of-bounds write during facet conversion.
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 writes data past the end of a memory buffer, which can crash the program or allow an attacker to 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.