Code injection
A .3mf can carry text a slicer later runs. In CVE-2024-8374, UltiMaker Cura
5.7.0-beta.1 to 5.7.2 passed the 3MF metadata value drop_to_buildplate to
Python eval(), so a crafted file ran code the moment Cura opened it
(GHSA-rvg9-cwv8-3543).
Why does it matter?
Opening a model could run any program on your computer, with your rights. This is CVE-2024-8374, class CWE-94.
Which slicers did it work on?
Cura 5.7.0-beta.1 to 5.7.2. Its 3MF reader handed the value of each object's
drop_to_buildplate setting to eval()
(ThreeMFReader.py).
Cura 5.8.0 reads it as a plain true or false
(commit 285a241).
Are current slicers exposed?
Cura 5.8.0 and later are not. PrusaSlicer and the slicers built on it are written in C++ and read every setting as a value, never as code. No case like this one is known for them.
What does preslice check?
Every text file and metadata field, for the Cura case and for code-like text:
| Finds | Result |
|---|---|
A drop_to_buildplate value that is not true, false, 1 or 0 |
Fail |
eval(, exec(, os.system(, __import__(, subprocess, {% %} or ${ } |
Warn |
What does a warning mean?
Finding a pattern does not prove an attack. Custom G-code sometimes uses ${,
and a comment can mention exec(. Read the named file in the
Raw tab and decide.
What do I do when the check fails?
A fail is the Cura attack itself. Do not open the file in Cura 5.7, delete it, and update Cura to 5.8.0 or later either way. The named file in the Raw tab shows the Python it would have run.