Vulnerabilities in pkg:pypi/granian

PACKAGE
Advisory Identifier: GHSA-f5p7-9fr5-8jmj
Advisory Summary

CVE-2026-42545 is a MODERATE (CVSS 5.9) denial of service vulnerability (CWE-755: Improper Handling of Exceptional Conditions) affecting Granian libraries in the PyPI ecosystem. The issue involves granian vulnerable to dos via wsgi response header panic. Remediation is available by upgrading affected packages to version 2.7.4.

2 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:pypi/granian

2 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:pypi/granian. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-f5p7-9fr5-8jmj CVE-2026-42545 MODERATE Granian vulnerable to DoS via WSGI response header panic
GHSA-vrg7-482j-p6f6 CVE-2026-42544 HIGH Granian vulnerable to unauthenticated DoS via WebSocket subprotocol header panic

CVE-2026-42545 at a Glance

CVE Identifier CVE-2026-42545
GHSA Identifier GHSA-f5p7-9fr5-8jmj
Severity MODERATE
CVSS v3.1 Base Score 5.9
CWE Classification CWE-755: Improper Handling of Exceptional Conditions
Affected Product Granian
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 5.9

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2026-42545

To remediate this vulnerability, upgrade all affected Granian dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

granian fixed: 2.7.4
pip install granian>=2.7.4
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show granian

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-42545, inspect your installed packages using pip:

pip show granian

Analyze the terminal output to locate any version of Granian in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.7.4), your application is affected.

Note: The pip show granian command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-755: Improper Handling of Exceptional Conditions, where the product does not handle or incorrectly handles an exceptional condition. In Granian, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary Granian aborts a worker process if a WSGI application returns an invalid HTTP response header name or value. The WSGI response conversion path uses `.unwrap()` on both the header name and header value constructors, so malformed output from the application becomes a process abort instead of a handled error. This issue requires a buggy or attacker-influenced WSGI application to emit invalid headers. It is not a parser bug in Granian's request path. The security impact is that application mistakes which should result in a `500` instead kill the worker process. ### Details https://github.com/emmett-framework/granian/blob/bdd5b0fbbb2aca6f2f4c0d2700c244d190958035/src/wsgi/io.rs#L39-L42 If either conversion fails, `.unwrap()` panics. In release builds Granian uses `panic = "abort"`, so the panic terminates the worker. #### Preconditions The attacker must be able to influence a header name or value produced by the WSGI application, or the application must otherwise generate invalid headers. Examples include: - a header name containing a space - a header value containing `\r\n` - a header value containing a null byte These are realistic failure modes for applications that reflect user-controlled data into headers such as `Location`, `Content Disposition`, or custom response headers. ### PoC #### Step 1 start Granian with the PoC WSGI app ```python # app.py def app(environ, start_response): path = environ.get("PATH_INFO", "/") if path == "/crash-name": headers = [("X Bad Name", "value")] elif path == "/crash-value": headers = [("Content-Type", "text/html\r\nX-Injected: evil")] elif path == "/crash-null": headers = [("X-Custom", "value\x00end")] else: start_response("200 OK", [("Content-Type", "text/plain")]) return [b"OK - server alive\n"] start_response("200 OK", headers) return [b"This response kills the worker\n"] ``` ```bash granian --interface wsgi app:app --host 127.0.0.1 --port 8000 ``` #### Step 2 trigger the crash (any one of these is sufficient) ```bash curl http://127.0.0.1:8000/crash-name curl http://127.0.0.1:8000/crash-value curl http://127.0.0.1:8000/crash-null ``` Expected result: - the worker aborts after any of the crash paths - subsequent requests fail until the worker is restarted ### Impact - Worker process denial of service - A single bad response kills one worker - Application bugs become process crashes instead of request-scoped failures

CVE-2026-42545 Affected Granian Versions

1 component(s)
Fixed Versions:
2.7.4
Product / Package Ecosystem Affected Versions Fixed Version
granian
PyPI
≥ 0.2.0
< 2.7.4
2.7.4

References

Frequently Asked Questions

What is CVE-2026-42545?
CVE-2026-42545 is a security vulnerability in Granian involving Granian vulnerable to DoS via WSGI response header panic under CWE-755: Improper Handling of Exceptional Conditions.
Which Granian versions are affected?
Affected versions include releases prior to 2.7.4 across affected packages: granian.
What version fixes CVE-2026-42545?
Upgrading to 2.7.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is granian affected?
Yes, granian is affected in releases prior to 2.7.4. Upgrade your dependency to 2.7.4 or later.
What is the CVSS score of CVE-2026-42545?
CVE-2026-42545 has a CVSS v3.1 base score of 5.9 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2026-42545?
CVE-2026-42545 is classified under CWE-755: Improper Handling of Exceptional Conditions (The product does not handle or incorrectly handles an exceptional condition.).
How can I check PyPI dependencies for CVE-2026-42545?
Run the dependency tree command: 'pip show granian'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-f5p7-9fr5-8jmj",
  "modified" : "2026-05-13T16:41:31Z",
  "published" : "2026-05-06T21:24:56Z",
  "aliases" : [ "CVE-2026-42545" ],
  "summary" : "Granian vulnerable to DoS via WSGI response header panic",
  "details" : "### Summary\n\nGranian aborts a worker process if a WSGI application returns an invalid HTTP response header name or value. The WSGI response conversion path uses `.unwrap()` on both the header name and header value constructors, so malformed output from the application becomes a process abort instead of a handled error.\n\nThis issue requires a buggy or attacker-influenced WSGI application to emit invalid headers. It is not a parser bug in Granian's request path. The security impact is that application mistakes which should result in a `500` instead kill the worker process.\n\n### Details\n\nhttps://github.com/emmett-framework/granian/blob/bdd5b0fbbb2aca6f2f4c0d2700c244d190958035/src/wsgi/io.rs#L39-L42\n\nIf either conversion fails, `.unwrap()` panics. In release builds Granian uses `panic = \"abort\"`, so the panic terminates the worker.\n\n\n#### Preconditions\n\nThe attacker must be able to influence a header name or value produced by the WSGI application, or the application must otherwise generate invalid headers.\n\nExamples include:\n\n- a header name containing a space\n- a header value containing `\\r\\n`\n- a header value containing a null byte\n\nThese are realistic failure modes for applications that reflect user-controlled data into headers such as `Location`, `Content Disposition`, or custom response headers.\n\n### PoC\n\n#### Step 1\n\nstart Granian with the PoC WSGI app\n\n```python\n# app.py\ndef app(environ, start_response):\n    path = environ.get(\"PATH_INFO\", \"/\")\n    if path == \"/crash-name\":\n        headers = [(\"X Bad Name\", \"value\")]\n    elif path == \"/crash-value\":\n        headers = [(\"Content-Type\", \"text/html\\r\\nX-Injected: evil\")]\n    elif path == \"/crash-null\":\n        headers = [(\"X-Custom\", \"value\\x00end\")]\n    else:\n        start_response(\"200 OK\", [(\"Content-Type\", \"text/plain\")])\n        return [b\"OK - server alive\\n\"]\n\n    start_response(\"200 OK\", headers)\n    return [b\"This response kills the worker\\n\"]\n\n```\n\n```bash\ngranian --interface wsgi app:app --host 127.0.0.1 --port 8000\n```\n\n#### Step 2\n\ntrigger the crash (any one of these is sufficient)\n\n```bash\ncurl http://127.0.0.1:8000/crash-name\ncurl http://127.0.0.1:8000/crash-value\ncurl http://127.0.0.1:8000/crash-null\n```\n\n\nExpected result:\n\n- the worker aborts after any of the crash paths\n- subsequent requests fail until the worker is restarted\n\n\n### Impact\n\n- Worker process denial of service\n- A single bad response kills one worker\n- Application bugs become process crashes instead of request-scoped failures",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "granian"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.2.0"
      }, {
        "fixed" : "2.7.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/emmett-framework/granian/security/advisories/GHSA-f5p7-9fr5-8jmj"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-42545"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/emmett-framework/granian"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-248", "CWE-755" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-06T21:24:56Z",
    "nvd_published_at" : "2026-05-12T22:16:34Z"
  }
}