GHSA-g7f6-rxc4-qhph

Suggest an improvement
Source
https://github.com/advisories/GHSA-g7f6-rxc4-qhph
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/09/GHSA-g7f6-rxc4-qhph/GHSA-g7f6-rxc4-qhph.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-g7f6-rxc4-qhph
Aliases
Published
2026-09-23T19:01:05Z
Modified
2026-09-23T19:15:06Z
Severity
  • 5.3 (Medium) CVSS_V4 - CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:N/SI:L/SA:N CVSS Calculator
Summary
Mesop: Unauthenticated ANSI Escape Sequence Injection in CSP Reporting Endpoint
Details

Summary

The /__csp__ endpoint accepts unauthenticated JSON reports and logs user-controlled values directly to stdout using print() without escaping control characters.

A remote attacker can include ANSI/VT100 escape sequences in fields such as blocked-uri or document-uri. When the logs are viewed in an ANSI-capable terminal, these sequences can manipulate the displayed output (e.g., clear the screen, hide text, or inject misleading messages), affecting the integrity of operator-facing logs.

Details

The CSP reporting endpoint accepts arbitrary JSON and prints several request fields directly:

mesop/server/static_file_serving.py

@app.route(prefix_base_url("/__csp__"), methods=["POST"])
def csp_report():
    report = request.get_json(force=True)

    document_uri = report["csp-report"]["document-uri"]
    blocked_uri = report["csp-report"]["blocked-uri"]
    violated_directive = report["csp-report"]["violated-directive"]

    print(f"... Blocked URL: {blocked_uri} ...")

Since these values are written to stdout without sanitization, ANSI escape sequences supplied by a remote client are preserved and interpreted by ANSI-compatible terminals.

PoC

Send the following request:

POST /__csp__
Content-Type: application/json

{
  "csp-report": {
    "document-uri": "https://victim.example",
    "blocked-uri": "\u001b[2J\u001b[H\u001b[32m*** SECURITY OK - No CSP violations found ***\u001b[0m\n\u001b[8mhttps://evil.example",
    "violated-directive": "script-src-elem"
  }
}

The request is accepted (HTTP 204), and the injected escape sequences are written to stdout unchanged.

When the captured output is rendered in a VT100-compatible terminal (verified using pyte), the original CSP warning is visually replaced with attacker-controlled content.

Expected output

    Content Security Policy Error

Directive: script-src-elem
Blocked URL: ...
App path: /app

Rendered output

*** SECURITY OK - No CSP violations found ***
https://evil.example
App path: /app

Impact

An unauthenticated remote attacker can submit a crafted request to the /csp endpoint containing ANSI/VT100 escape sequences. Because these values are written directly to stdout without sanitization, an attacker can:

  1. Inject forged log messages that appear to originate from the application.
  2. Manipulate the terminal display by clearing the screen, moving the cursor, or overwriting previously displayed log output.
  3. Hide or disguise security-relevant log entries using terminal formatting sequences such as colors, hidden text, or cursor positioning.
  4. Mislead administrators during monitoring or incident response by displaying attacker-controlled messages (e.g., fake "SECURITY OK" notifications).
  5. Reduce the integrity and trustworthiness of operator-facing logs, making troubleshooting and security investigations less reliable.
Database specific
{
    "cwe_ids":  [
        "CWE-117",
        "CWE-150"
    ],
    "github_reviewed":  true,
    "github_reviewed_at":  "2026-09-23T19:01:05Z",
    "nvd_published_at":  null,
    "severity":  "MODERATE"
}
References

Affected packages

PyPI / mesop

Package

Affected ranges

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

Affected versions

0.*
0.0.1
0.3.1
0.3.2
0.3.3
0.3.4
0.4.0
0.4.1
0.4.2
0.5.0
0.5.1
0.5.2
0.5.3
0.5.4
0.5.5
0.5.6
0.6.0
0.7.0
0.7.1
0.7.2
0.8.0rc0
0.8.0
0.9.0rc1
0.9.0
0.9.1rc1
0.9.1
0.9.2rc1
0.9.2
0.9.3rc0
0.9.3
0.9.4rc0
0.9.4
0.9.5rc0
0.9.5
0.10.0rc0
0.10.0rc1
0.10.0rc2
0.10.0
0.11.0rc0
0.11.0
0.11.1
0.12.0rc0
0.12.0
0.12.1rc0
0.12.1
0.12.2
0.12.3rc0
0.12.3
0.12.4rc0
0.12.4
0.12.5b1
0.12.5rc1
0.12.5
0.12.6rc1
0.12.6
0.12.7b1
0.12.7rc1
0.12.7
0.12.8b1
0.12.8rc1
0.12.8
0.12.9rc1
0.12.9
0.12.10b1
0.12.10b2
0.12.10b3
0.12.10rc1
0.13.0rc1
0.13.0
0.14rc1
0.14.0
0.14.1rc1
0.14.1
0.14.2b1
0.14.2b2
0.14.2rc1
1.*
1.0.0rc1
1.0.0rc2
1.0.0
1.0.1rc1
1.0.1
1.1.0rc1
1.1.0
1.1.1rc1
1.1.1rc2
1.1.1rc3
1.1.1
1.2.0rc1
1.2.0
1.2.1rc1
1.2.1
1.2.2rc1
1.2.2
1.2.3
1.2.4rc1
1.2.5rc1
1.2.5
1.2.6rc2
1.2.7rc1
1.2.7
1.3.0rc1
1.3.0rc2
1.3.0
1.3.2
1.3.3

Database specific

last_known_affected_version_range
"<= 1.3.3"
source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/09/GHSA-g7f6-rxc4-qhph/GHSA-g7f6-rxc4-qhph.json"