CVE-2026-33140: Pyspector Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-2gmv-2r3v-jxj2
CWE-79
Published
Advisory Summary

CVE-2026-33140 is a MODERATE cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Pyspector libraries in the PyPI ecosystem. The issue involves stored xss in pyspector html report generation leads to javascript code execution. Remediation is available by upgrading affected packages to version 0.1.7.

CVE-2026-33140 at a Glance

CVE Identifier CVE-2026-33140
GHSA Identifier GHSA-2gmv-2r3v-jxj2
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Pyspector
Package Ecosystem PyPI
Published Date
Last Updated

How to Fix CVE-2026-33140

To remediate this vulnerability, upgrade all affected Pyspector dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

pyspector fixed: 0.1.7
pip install pyspector>=0.1.7
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 pyspector

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-33140, inspect your installed packages using pip:

pip show pyspector

Analyze the terminal output to locate any version of Pyspector in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.1.7), your application is affected.

Note: The pip show pyspector command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Pyspector, 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

### Summary PySpector versions `<= 0.1.6` are affected by a stored Cross-Site Scripting (XSS) vulnerability in the HTML report generator. When PySpector scans a Python file containing JavaScript payloads (i.e. inside a string passed to `eval()` ), the flagged code snippet is interpolated into the HTML report without sanitization. Opening the generated report in a browser causes the embedded JavaScript to execute in the browser's local file context. ### Impact An attacker can craft a malicious Python file (for example, hosted in a public repository), designed to be scanned by PySpector. When a victim scans this file and opens the resulting HTML report, arbitrary JavaScript executes in their browser. While the `file://` context limits the attacker's ability to exfiltrate cookies or make credentialed requests, the following is still achievable: - Arbitrary DOM manipulation - Redirects to attacker-controlled pages - Theft of locally accessible data via `fetch()` or `XMLHttpRequest` to `file://` paths (browser-dependent) Any user of PySpector who scans untrusted code and generates HTML reports, is potentially affected. ### PoC The following steps reproduce the vulnerability on PySpector `<= 0.1.6`: 1. Create a malicious Python file containing a JavaScript payload embedded in a string argument to `eval()`, and run PySpector against the file, generating an HTML report: <img width="871" height="752" alt="image" src="https://github.com/user-attachments/assets/1b0a57f2-3632-4347-a9b7-6a94dc2e82b2" /> 2. Open the generated HTML report in any browser: <img width="1920" height="920" alt="image" src="https://github.com/user-attachments/assets/a4075c4a-6153-41b4-ad77-81d009d7a9f8" />

CVE-2026-33140 Affected Pyspector Versions

1 component(s)
Fixed Versions:
0.1.7
Product / Package Ecosystem Affected Versions Fixed Version
pyspector
PyPI
< 0.1.7
0.1.7

References

Frequently Asked Questions

What is CVE-2026-33140?
CVE-2026-33140 is a security vulnerability in Pyspector involving Stored XSS in PySpector HTML Report Generation leads to Javascript Code Execution under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Pyspector versions are affected?
Affected versions include releases prior to 0.1.7 across affected packages: pyspector.
What version fixes CVE-2026-33140?
Upgrading to 0.1.7 (or the latest patched release for your respective branch) resolves the vulnerability.
Is pyspector affected?
Yes, pyspector is affected in releases prior to 0.1.7. Upgrade your dependency to 0.1.7 or later.
What CWE is associated with CVE-2026-33140?
CVE-2026-33140 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check PyPI dependencies for CVE-2026-33140?
Run the dependency tree command: 'pip show pyspector'. 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-2gmv-2r3v-jxj2",
  "modified" : "2026-03-20T21:33:17Z",
  "published" : "2026-03-18T16:33:46Z",
  "aliases" : [ "CVE-2026-33140" ],
  "summary" : "Stored XSS in PySpector HTML Report Generation leads to Javascript Code Execution",
  "details" : "### Summary\nPySpector versions `<= 0.1.6` are affected by a stored Cross-Site Scripting (XSS) vulnerability in the HTML report generator. When PySpector scans a Python file containing JavaScript payloads (i.e. inside a string passed to `eval()` ), the flagged code snippet is interpolated into the HTML report without sanitization. Opening the generated report in a browser causes the embedded JavaScript to execute in the browser's local file context.\n\n### Impact\nAn attacker can craft a malicious Python file (for example, hosted in a public repository), designed to be scanned by PySpector. When a victim scans this file and opens the resulting HTML report, arbitrary JavaScript executes in their browser. While the `file://` context limits the attacker's ability to exfiltrate cookies or make credentialed requests, the following is still achievable:\n- Arbitrary DOM manipulation\n- Redirects to attacker-controlled pages\n- Theft of locally accessible data via `fetch()` or `XMLHttpRequest` to `file://` paths (browser-dependent)\n\nAny user of PySpector who scans untrusted code and generates HTML reports, is potentially affected.\n\n### PoC\n\nThe following steps reproduce the vulnerability on PySpector `<= 0.1.6`:\n1. Create a malicious Python file containing a JavaScript payload embedded in a string argument to `eval()`, and run PySpector against the file, generating an HTML report:\n<img width=\"871\" height=\"752\" alt=\"image\" src=\"https://github.com/user-attachments/assets/1b0a57f2-3632-4347-a9b7-6a94dc2e82b2\" />\n2. Open the generated HTML report in any browser:\n<img width=\"1920\" height=\"920\" alt=\"image\" src=\"https://github.com/user-attachments/assets/a4075c4a-6153-41b4-ad77-81d009d7a9f8\" />",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "pyspector"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.1.7"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.1.6"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/ParzivalHack/PySpector/security/advisories/GHSA-2gmv-2r3v-jxj2"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-33140"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ParzivalHack/PySpector"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-18T16:33:46Z",
    "nvd_published_at" : "2026-03-20T20:16:49Z"
  }
}