GHSA-r5pr-887v-m2w9

Suggest an improvement
Source
https://github.com/advisories/GHSA-r5pr-887v-m2w9
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/03/GHSA-r5pr-887v-m2w9/GHSA-r5pr-887v-m2w9.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-r5pr-887v-m2w9
Aliases
Published
2026-03-16T16:41:58Z
Modified
2026-03-19T21:16:30.284922Z
Severity
  • 3.6 (Low) CVSS_V3 - CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:L/I:N/A:N CVSS Calculator
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.

Database specific
{
    "github_reviewed": true,
    "nvd_published_at": "2026-03-18T22:16:24Z",
    "cwe_ids": [
        "CWE-79"
    ],
    "github_reviewed_at": "2026-03-16T16:41:58Z",
    "severity": "LOW"
}
References

Affected packages

PyPI / memray

Package

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
1.19.2

Affected versions

1.*
1.0.0
1.0.2
1.0.3
1.1.0
1.2.0
1.3.0
1.3.1
1.4.0
1.4.1
1.5.0
1.6.0
1.7.0
1.8.0
1.8.1
1.9.0
1.9.1
1.10.0
1.11.0
1.12.0
1.13.0
1.13.1
1.13.2
1.13.3
1.13.4
1.14.0
1.15.0
1.16.0
1.17.0
1.17.1
1.17.2
1.18.0
1.19.0
1.19.1

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/03/GHSA-r5pr-887v-m2w9/GHSA-r5pr-887v-m2w9.json"