CVE-2026-32722: Memray Cross-Site Scripting Vulnerability

LOW
Advisory Identifier: GHSA-r5pr-887v-m2w9
CVSS 3.6
CWE-79
Published
Advisory Summary

CVE-2026-32722 is a LOW (CVSS 3.6) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Memray libraries in the PyPI ecosystem. The issue involves stored xss in memray-generated html reports via unescaped command-line metadata. Remediation is available by upgrading affected packages to version 1.19.2.

CVE-2026-32722 at a Glance

CVE Identifier CVE-2026-32722
GHSA Identifier GHSA-r5pr-887v-m2w9
Severity LOW
CVSS v3.1 Base Score 3.6
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Memray
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 3.6

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:L/I:N/A:N).

Attack Vector Local (AV:L)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2026-32722

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

memray fixed: 1.19.2
pip install memray>=1.19.2
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 memray

How to Check if You Are Affected

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

pip show memray

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

Note: The pip show memray 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 Memray, 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 Prior to Memray 1.19.2, Memray rendered the command line of the tracked process directly into generated HTML reports without escaping. Because there was no escaping, attacker-controlled command line arguments were inserted as raw HTML into the generated report. This allowed JavaScript execution when a victim opened the generated report in a browser. ## Affected Version - Memray version: `1.19.1` and earlier ## Remediation Upgrade to Memray 1.19.2, and avoid attaching Memray to untrusted processes until you have upgraded. ## Root Cause Jinja is used to embed the process's command line arguments into the generated flame graph or table report. Memray has not been telling Jinja to HTML escape the command line arguments when writing them into the HTML, leading to a stored XSS vulnerability. ## Impact An attacker who can influence the script name or command-line arguments of a profiled program can inject HTML/JavaScript into Memray-generated HTML reports (both `memray flamegraph` and `memray table` reports, both with and without `--no-web`). When a victim opens the generated report in a browser, the injected JavaScript executes in the context of the report. Note that in the case of `memray attach`, the user attaching Memray and generating the report may be a different user than the one who ran the command and set up the command line arguments. ## Proof of Concept Run Memray on a script with an attacker-controlled filename: ```bash touch '<img src=x onerror=alert(1)>' python -m memray run -o poc.bin '<img src=x onerror=alert(1)>' ``` Generate a report: ```bash python -m memray flamegraph -o poc.html poc.bin ``` ## Observed Result The generated HTML contains raw unescaped attacker-controlled HTML. Opening or reloading the generated report in a browser triggers JavaScript execution.

CVE-2026-32722 Affected Memray Versions

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

References

Frequently Asked Questions

What is CVE-2026-32722?
CVE-2026-32722 is a security vulnerability in Memray involving Stored XSS in Memray-generated HTML reports via unescaped command-line metadata under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Memray versions are affected?
Affected versions include releases prior to 1.19.2 across affected packages: memray.
What version fixes CVE-2026-32722?
Upgrading to 1.19.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is memray affected?
Yes, memray is affected in releases prior to 1.19.2. Upgrade your dependency to 1.19.2 or later.
What is the CVSS score of CVE-2026-32722?
CVE-2026-32722 has a CVSS v3.1 base score of 3.6 (LOW) with vector string CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:L/I:N/A:N.
What CWE is associated with CVE-2026-32722?
CVE-2026-32722 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-32722?
Run the dependency tree command: 'pip show memray'. 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-r5pr-887v-m2w9",
  "modified" : "2026-03-19T21:11:02Z",
  "published" : "2026-03-16T16:41:58Z",
  "aliases" : [ "CVE-2026-32722" ],
  "summary" : "Stored XSS in Memray-generated HTML reports via unescaped command-line metadata",
  "details" : "## Summary\n\nPrior to Memray 1.19.2, Memray rendered the command line of the tracked process directly into generated HTML reports without escaping. Because there was no escaping, attacker-controlled command line arguments were inserted as raw HTML into the generated report.\n\nThis allowed JavaScript execution when a victim opened the generated report in a browser.\n\n## Affected Version\n\n- Memray version: `1.19.1` and earlier\n\n## Remediation\n\nUpgrade to Memray 1.19.2, and avoid attaching Memray to untrusted processes until you have upgraded.\n\n## Root Cause\n\nJinja is used to embed the process's command line arguments into the generated flame graph or table report. Memray has not been telling Jinja to HTML escape the command line arguments when writing them into the HTML, leading to a stored XSS vulnerability.\n\n## Impact\n\nAn attacker who can influence the script name or command-line arguments of a profiled program can inject HTML/JavaScript into Memray-generated HTML reports (both `memray flamegraph` and `memray table` reports, both with and without `--no-web`). When a victim opens the generated report in a browser, the injected JavaScript executes in the context of the report.\n\nNote that in the case of `memray attach`, the user attaching Memray and generating the report may be a different user than the one who ran the command and set up the command line arguments.\n\n## Proof of Concept\n\nRun Memray on a script with an attacker-controlled filename:\n\n```bash\ntouch '<img src=x onerror=alert(1)>'\npython -m memray run -o poc.bin '<img src=x onerror=alert(1)>'\n```\n\nGenerate a report:\n\n```bash\npython -m memray flamegraph -o poc.html poc.bin\n```\n\n## Observed Result\n\nThe generated HTML contains raw unescaped attacker-controlled HTML.\n\nOpening or reloading the generated report in a browser triggers JavaScript execution.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:L/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "memray"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.19.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/bloomberg/memray/security/advisories/GHSA-r5pr-887v-m2w9"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-32722"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/bloomberg/memray/commit/ba6e4e2e9930f9641bed7adfdf43c8e2545ce249"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/bloomberg/memray"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/bloomberg/memray/releases/tag/v1.19.2"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-16T16:41:58Z",
    "nvd_published_at" : "2026-03-18T22:16:24Z"
  }
}