GHSA-R5PR-887V-M2W9

Vulnerability from github – Published: 2026-03-16 16:41 – Updated: 2026-03-19 21:11
VLAI?
Summary
Stored XSS in Memray-generated HTML reports via unescaped command-line metadata
Details

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:

touch '<img src=x onerror=alert(1)>'
python -m memray run -o poc.bin '<img src=x onerror=alert(1)>'

Generate a report:

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.

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "PyPI",
        "name": "memray"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "1.19.2"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-32722"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-79"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-03-16T16:41:58Z",
    "nvd_published_at": "2026-03-18T22:16:24Z",
    "severity": "LOW"
  },
  "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\u0027s 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 \u0027\u003cimg src=x onerror=alert(1)\u003e\u0027\npython -m memray run -o poc.bin \u0027\u003cimg src=x onerror=alert(1)\u003e\u0027\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.",
  "id": "GHSA-r5pr-887v-m2w9",
  "modified": "2026-03-19T21:11:02Z",
  "published": "2026-03-16T16:41:58Z",
  "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"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:L/I:N/A:N",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Stored XSS in Memray-generated HTML reports via unescaped command-line metadata"
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.


Loading…

Detection rules are retrieved from Rulezet.

Loading…

Loading…