CVE-2025-12695 Insecure configuration in DSPy lead to arbitrary file read when running untrusted code inside the sandbox

Medium 5.9 Published Updated

Attackers can read sensitive files by exploiting an overly permissive sandbox configuration in DSPy when processing untrusted input.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
None listed

What is CVE-2025-12695?

CVE-2025-12695 is a medium-severity path traversal vulnerability in dspy, published on 4 Nov 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

The overly permissive sandbox configuration in DSPy allows attackers to steal sensitive files in cases when users build an AI agent which consumes user input and uses the “PythonInterpreter” class.

Weakness: CWE-653

Which versions are affected by CVE-2025-12695?

3 open source packages ship an affected version, including dspy.

PackageAffectedFixed in
dspy PyPIAll versions to 3.0.3None
dspy PyPIAll versions to 3.0.3None
dspy PyPIAll versions to 3.0.3None

How do I fix CVE-2025-12695?

No fix has been published for CVE-2025-12695 yet. Limit exposure of the affected software until one is available.

Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.

Is CVE-2025-12695 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-12695 exists.

Sources

Also known as GHSA-vvw2-h478-xwr3, PYSEC-2026-1318.

Is CVE-2025-12695 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free