Summary
audio-separator can execute attacker-controlled code when it loads a malicious Demucs .th model using torch.load with weights_only=False. The risk arises when an attacker can place or supply an untrusted model and a victim runs Demucs separation with it.
Affected context
The issue affects audio-separator workflows that load Demucs .th model files through an unsafe PyTorch deserialization path. Risk depends on whether an untrusted party can write to the shared /tmp/audio-separator-models/ directory or influence the source of downloaded models, and whether a victim subsequently loads the model for separation.
Exploit preconditions
- Attack surface: Local model files or model download sources used by audio-separator
- Required access: Ability to write to the shared default model directory or control an unverified model source
- Trigger point: A victim runs Demucs separation and loads the supplied
.thmodel - Why exploitation is possible: Deserialization with
weights_only=Falsecan reconstruct attacker-controlled objects and execute code during model loading
Why this happens
The underlying bug is unsafe deserialization of model data. Using torch.load with weights_only=False on a file that may be attacker-controlled allows more than passive tensor loading: deserialization can invoke object reconstruction behavior. This maps to CWE-502: Deserialization of Untrusted Data.
Potential impact
- An attacker could execute code with the privileges of the process loading the model.
- The audio-separator environment may be compromised.
- Local files or credentials accessible to the process could be exposed or modified.
- A compromised environment could be used for further activity, depending on its permissions and network access.
General mitigation guidance
Defensive patterns include:
- Prefer restricted, weights-only model loading or other formats and APIs that do not permit arbitrary object reconstruction.
- Treat downloaded and locally supplied model files as untrusted unless their origin and integrity are verified.
- Avoid shared writable model directories; use controlled ownership and permissions or isolated per-user storage.
- Run separation processes with least privilege and limit their access to sensitive files and services.
- Apply validation and integrity checks before model loading, while recognizing that validation alone does not make unsafe deserialization safe.
How teams detect issues like this
- Use static analysis to identify model-loading calls that allow unrestricted deserialization, including
torch.loadconfigurations that disable weights-only restrictions. - Review code paths that load models from temporary directories, shared locations, or downloads without integrity checks.
- Enforce policies that require restricted model-loading modes and trusted model provenance.
- Monitor model directories and download workflows for unexpected file creation or changes; automated code review tools may help flag risky loading patterns.

