Vulnerabilities in pkg:pypi/dspy

PACKAGE
Advisory Identifier: GHSA-vvw2-h478-xwr3
Advisory Summary

CVE-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.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:pypi/dspy

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:pypi/dspy. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-vvw2-h478-xwr3 CVE-2025-12695 MODERATE DSPy does not properly restrict file reads

CVE-2025-12695 at a Glance

CVE Identifier CVE-2025-12695
GHSA Identifier GHSA-vvw2-h478-xwr3
Severity MODERATE
CVSS v3.1 Base Score 5.9
CWE Classification CWE-653: Improper Isolation or Compartmentalization
Affected Product Dspy
Package Ecosystem PyPI
Published Date
Last Updated

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).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (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.

dspy fixed: Latest secure release
pip install dspy>=Latest secure release
Verify Direct and Transitive Dependencies

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

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.

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?
CVE-2025-12695 is a security vulnerability in Dspy involving DSPy does not properly restrict file reads under CWE-653: Improper Isolation or Compartmentalization.
Which Dspy versions are affected?
Affected versions include releases prior to current release patches across affected packages: dspy.
What version fixes CVE-2025-12695?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is dspy affected?
Yes, dspy is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2025-12695?
CVE-2025-12695 has a CVSS v3.1 base score of 5.9 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2025-12695?
CVE-2025-12695 is classified under CWE-653: Improper Isolation or Compartmentalization (The product does not properly compartmentalize or isolate functionality, processes, or resources that require different privilege levels, rights, or permissions.).
How can I check PyPI dependencies for CVE-2025-12695?
Run the dependency tree command: 'pip show dspy'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "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"
  }
}