the_open_door
coffee
ESEN
← Back to index

PrusaSlicer post_process (CVE-2023-47268)

PrusaSlicer is an open-source slicer: it turns a 3D model into G-code for a printer. CVE-2023-47268 is a command injection via the post_process config directive. PrusaSlicer lets you define post-processing scripts that run automatically after slicing; if that directive contains a system command, PrusaSlicer runs it unrestricted. It affects versions up to and including 2.6.1.

Where the command lives. 3MF projects (3D Manufacturing Format, a ZIP with the model and its configuration) contain a Metadata/Slic3r_PE.config file. That file has a post_process = ... line. Since the attacker supplies the .3mf, they supply the post_process line too: opening (or processing with -s) that project runs the command.

Why the execution context matters. The command inherits the privileges PrusaSlicer is launched with. The classic vector is a misconfigured sudo: if a user can run PrusaSlicer as root without a password, post_process runs as root. So the first step is checking sudo -l:

sudo -l
# (ALL) NOPASSWD: /opt/PrusaSlicer/prusaslicer

Practical exploitation. Create a .3mf (with PrusaSlicer's own UI on any machine) and, inside its Slic3r_PE.config, set a post_process that stages the escalation, e.g. making a copy of bash (or /bin/bash itself) SUID. Then process the project as root and spawn the privileged shell:

sudo /opt/PrusaSlicer/prusaslicer -s poc.3mf   # slicing fires post_process as root
/bin/bash -p                                    # shell with root's effective privileges

If slicing fails over the output filename format, just tweak the output_filename_format line in Slic3r_PE.config so processing completes and post_process runs. It's a concrete case of command injection combined with SUID abuse or a permissive sudo.

How to detect it. The use is recorded in /var/log/auth.log as a sudo ... prusaslicer over a .3mf, and auditd catches the telltale pattern: prusaslicer spawning sh/chmod u+s//bin/bash as a child, something a slicer never does. On disk, a .3mf (which is a ZIP) whose Metadata/Slic3r_PE.config contains a post_process = line with a system command is the signature; and a binary gaining the SUID bit right after (compared against the find / -perm -4000 baseline) confirms the escalation.

Defence. Update PrusaSlicer to a version newer than 2.6.1. Don't grant sudo NOPASSWD on binaries that process user-supplied files: any format with embedded scripting (like post_process) becomes command execution with the process's privileges.

Machines where it's used