Stored XSS in Memray-generated HTML reports via unescaped command-line metadata
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.1and 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.
Software afectado
Haz clic en una tecnología para ver todas sus vulnerabilidades.
| Plataforma | Paquete | Versiones vulnerables | Corregida en |
|---|---|---|---|
| Python (PyPI) | memray | < 1.19.2 | 1.19.2 |
Referencias
- https://github.com/bloomberg/memray/releases/tag/v1.19.2
- https://github.com/bloomberg/memray/commit/ba6e4e2e9930f9641bed7adfdf43c8e2545ce249
- https://github.com/bloomberg/memray/security/advisories/GHSA-r5pr-887v-m2w9
- https://nvd.nist.gov/vuln/detail/CVE-2026-32722
- https://github.com/bloomberg/memray
- Vector CVSS
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:C/C:L/I:N/A:N- Debilidad (CWE)
CWE-79- Plataforma
- Python (PyPI)
- Paquete
memray- Publicada
- 16.03.2026
- Actualizado
- 11.10.2026 13:19
Fuentes y licencias
OSV / GitHub Advisory Database - PYSEC-2026-2203 - PyPA Advisory Database; CC BY 4.0
OSV / GitHub Advisory Database - GHSA-r5pr-887v-m2w9 - CC BY 4.0
Historial de vulnerabilidades: memray
Todas las vulnerabilidades publicadas de este paquete (Python (PyPI)), de la más reciente a la más antigua. Muestra si es un fallo aislado o un paquete que hay que vigilar.
Esta es la única vulnerabilidad conocida de este paquete.
Identifica las vulnerabilidades de tu aplicación
Con la integración de DockRay y el inventario de software activado, DockRay compara las versiones notificadas de los componentes con las vulnerabilidades conocidas y avisa de las coincidencias confirmadas. La cobertura depende de la tecnología compatible y de los avisos disponibles.