# GHSA-52vm-mxx8-f227: Phantom: Arbitrary file write and decode-bomb DoS via unconfined MCP tool paths

> Attackers can write arbitrary files or cause DoS via unconfined paths and missing decode limits in Phantom MCP tools, enabling local code execution.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 9 Jul 2026

## What is GHSA-52vm-mxx8-f227?

GHSA-52vm-mxx8-f227 is a path traversal vulnerability in phantom-audio, published on 9 Jul 2026. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

### Impact

In Phantom <= 1.3.0, when `PHANTOM_OUTPUT_DIR` was unset (the default), the MCP tools accepted arbitrary absolute output paths with no confinement. Anything able to send tool calls (e.g. an AI agent driving the MCP interface) could **write or overwrite arbitrary files** the process user can write — including shell startup files (`~/.zshrc`) or a Reaper `__startup.lua`, which is effectively local code execution on a developer workstation.

Separately, the stem-separation and render paths decoded input audio with no size/duration cap (the analysis path was already guarded). A small, highly compressed FLAC/OGG could expand to multi-gigabyte PCM, causing memory-exhaustion DoS, and widened exposure to decoder bugs including libsndfile CVE-2026-37555.

### Patches
Fixed in **1.3.1**:
- File writes are always confined to `PHANTOM_OUTPUT_DIR` (default `~/.phantom/output`); symlinks resolved and re-verified on the final path.
- Decode/duration/size guards mirrored onto the separation and render paths (plus ffmpeg `-max_alloc`/`-t`/`-fs`).
- Atomic `O_CREAT|O_EXCL` output creation in reference matching and symlink-TOCTOU hardening on confined input reads.

### Workarounds
Set `PHANTOM_OUTPUT_DIR` (and optionally `PHANTOM_AUDIO_DIR`) to dedicated directories before starting the server.

### Credit
Found during an internal security audit.

## Which versions are affected by GHSA-52vm-mxx8-f227?

2 open source packages ship an affected version, including phantom-audio.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `phantom-audio` | PyPI | All versions | 1.3.1 |
| `phantom-audio` | PyPI | All versions | 1.3.1 |

## How do I fix GHSA-52vm-mxx8-f227?

Upgrade phantom-audio to 1.3.1 or later.

## Is GHSA-52vm-mxx8-f227 being exploited?

There is no known exploitation of GHSA-52vm-mxx8-f227 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-52vm-mxx8-f227 and fix it if it is affected.

What it is: GHSA-52vm-mxx8-f227 is a path traversal vulnerability in phantom-audio, published on 9 Jul 2026. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-52vm-mxx8-f227 in the wild and no public exploit code.

Affected packages and fixed versions:
- phantom-audio (PyPI): affected all versions; fixed in 1.3.1
- phantom-audio (PyPI): affected all versions; fixed in 1.3.1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-52vm-mxx8-f227/ (Markdown: https://insights.sbomify.com/GHSA-52vm-mxx8-f227/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-52vm-mxx8-f227

---
From sbomify Insights: https://insights.sbomify.com/GHSA-52vm-mxx8-f227/
Summaries are generated and may contain mistakes; the official description above is the record.
