CVE-2025-12695: Dspy DSPy Does Not Properly Restrict Vulnerability
MODERATECVE-2025-12695 is a MODERATE (CVSS 5.9) dspy does not properly restrict vulnerability (CWE-653: Improper Isolation or Compartmentalization) affecting Dspy libraries in the PyPI ecosystem. The issue involves dspy does not properly restrict file reads. Remediation is available in the latest vendor maintenance releases.
CVE-2025-12695 at a Glance
Security Impact
CVSS: 5.9
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N).
How to Fix CVE-2025-12695
To remediate this vulnerability, upgrade all affected Dspy dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install dspy>=Latest secure release
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show dspy
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2025-12695, inspect your installed packages using pip:
pip show dspy
Analyze the terminal output to locate any version of Dspy in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.
Note: The pip show dspy command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-653: Improper Isolation or Compartmentalization, where the product does not properly compartmentalize or isolate functionality, processes, or resources that require different privilege levels, rights, or permissions. In Dspy, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2025-12695 Affected Dspy Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
dspy
|
PyPI |
≤ 3.0.3
|
|
References
Frequently Asked Questions
What is CVE-2025-12695?
Which Dspy versions are affected?
What version fixes CVE-2025-12695?
Is dspy affected?
What is the CVSS score of CVE-2025-12695?
What CWE is associated with CVE-2025-12695?
How can I check PyPI dependencies for CVE-2025-12695?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-vvw2-h478-xwr3",
"modified" : "2025-11-04T17:05:45Z",
"published" : "2025-11-04T15:31:35Z",
"aliases" : [ "CVE-2025-12695" ],
"summary" : "DSPy does not properly restrict file reads",
"details" : "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.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "dspy"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"last_affected" : "3.0.3"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-12695"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/stanfordnlp/dspy"
}, {
"type" : "WEB",
"url" : "https://research.jfrog.com/vulnerabilities/dspy-sandbox-escape-arbitrary-file-read-jfsa-2025-001495652"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-653" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2025-11-04T17:05:45Z",
"nvd_published_at" : "2025-11-04T14:15:34Z"
}
}