CVE-2026-93421
ANSI escape injection in CSP report logs allows terminal display manipulation.
- CVSS 5.3
- CWE-117
- Information Leakage
- Remote
Mesop is a Python-based UI framework that allows users to build web applications. Prior to 1.3.4, the unauthenticated /__csp__ endpoint passes attacker-controlled document-uri, blocked-uri, and violated-directive values to the csp_report handler in mesop/server/static_file_serving.py, which prints them to standard output without neutralizing terminal control sequences. When an operator views the resulting logs in an ANSI-capable terminal, injected ANSI or VT100 sequences can clear or reposition the display, hide text, or present forged messages, reducing the integrity of monitoring and incident-response output. This issue is fixed in version 1.3.4.
- CWE
- CWE-117
- CVSS base score
- 5.3
- Published
- 2026-09-23
- OWASP
- A09 Security Logging and Monitoring Failures
- Orthogonal defect classification
- Interface
- Code defect classification
- Missing Check
- Category
- Information Leakage
- Subcategory
- Information Disclosure
- Accessibility scope
- Remote
- Impact
- Denial of Service (DoS)
- Affected component
- Mesop
- Fixed by upgrading
- Yes
Solution
Upgrade Mesop to version 1.3.4 or later.
Vulnerable code sample
import json
from typing import Dict, Any
def csp_report(request_body: bytes) -> None:
"""
Handles CSP violation reports sent to the /__csp__ endpoint.
Logs the report contents to standard output.
"""
# VULNERABLE: directly prints attacker-controlled values, allowing terminal escape injection
report: Dict[str, Any] = json.loads(request_body)
document_uri = report.get("csp-report", {}).get("document-uri", "")
blocked_uri = report.get("csp-report", {}).get("blocked-uri", "")
violated_directive = report.get("csp-report", {}).get("violated-directive", "")
print(f"CSP violation – Document: {document_uri}, Blocked: {blocked_uri}, Directive: {violated_directive}")Patched code sample
import json
import re
from typing import Dict, Any
_ESCAPE_RE = re.compile(r'\x1b\[[0-9;]*[A-Za-z]')
def _sanitize(text: str) -> str:
"""Remove ANSI/VT100 escape sequences from log output."""
return _ESCAPE_RE.sub('', text)
def csp_report(request_body: bytes) -> None:
"""
Handles CSP violation reports sent to the /__csp__ endpoint.
Logs the report contents to standard output after sanitizing.
"""
# FIX: strip terminal control sequences before printing
report: Dict[str, Any] = json.loads(request_body)
document_uri = _sanitize(report.get("csp-report", {}).get("document-uri", ""))
blocked_uri = _sanitize(report.get("csp-report", {}).get("blocked-uri", ""))
violated_directive = _sanitize(report.get("csp-report", {}).get("violated-directive", ""))
print(f"CSP violation – Document: {document_uri}, Blocked: {blocked_uri}, Directive: {violated_directive}")Published fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- Sanitize ANSI escape sequences in CSP report logging (#1397) (mesop-dev/mesop)
mesop/server/static_file_serving.py,mesop/server/static_file_serving.py · configure_static_file_serving
Cite this entry
@misc{vaitp:cve202693421,
title = {{ANSI escape injection in CSP report logs allows terminal display manipulation.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-93421},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-93421/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
