CVE-2026-129303: Guard Core Whitespace-collapse Preprocessing Permanently Disables The Vulnerability

LOW
Advisory Identifier: GHSA-w7wg-6q7v-44f2
CVSS 3.7
CWE-693
Published
Advisory Summary

CVE-2026-129303 is a LOW (CVSS 3.7) whitespace-collapse preprocessing permanently disables the vulnerability (CWE-693: Protection Mechanism Failure) affecting Guard Core libraries in the PyPI ecosystem. The issue involves whitespace-collapse preprocessing permanently disables the crlf-anchored http-splitting and command-injection detectors in the default detection mode. Remediation is available by upgrading affected packages to version 3.13.0.

CVE-2026-129303 at a Glance

CVE Identifier CVE-2026-129303
GHSA Identifier GHSA-w7wg-6q7v-44f2
Severity LOW
CVSS v3.1 Base Score 3.7
CWE Classification CWE-693: Protection Mechanism Failure
Affected Product Guard Core
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 3.7

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:L/A:N).

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 Low (I:L)
Availability None (A:N)

How to Fix CVE-2026-129303

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

guard-core fixed: 3.13.0
pip install guard-core>=3.13.0
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 guard-core

How to Check if You Are Affected

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

pip show guard-core

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

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

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-693: Protection Mechanism Failure, where the product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product. In Guard Core, 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 In the default "enhanced" detection mode, `ContentPreprocessor.preprocess()` collapses all whitespace (`re.sub(r"\s+", " ", content)`, `guard_core/detection_engine/preprocessor.py:137` on master `08780f1`; `:384` in the 3.12.0 sdist) **before** pattern matching. This erases every `\r` and `\n` from the scanned value, rendering two built-in detectors structurally unmatchable regardless of input: - http_split — `guard_core/handlers/suspatterns_handler.py:540`: `r"[\r\n]\s*(?:HTTP\/[0-9.]+|Location:|Set-Cookie:)"` requires a literal `\r` or `\n`, which no longer exists after preprocessing; - cmd_injection — `r"\n\s*(?:bash|sh|...)\s+-c\b"` — same structural death. The downstream application receives the **raw** value with CRLF intact (Starlette percent-decodes `%0d%0a` in query parameters before the adapter passes `request.query_params.items()` to `guard_core/utils.py:843-865`), so a response-splitting-shaped payload passes detection unflagged. ### Details Verified end-to-end against a real uvicorn server running the fastapi-guard adapter over guard-core 3.12.0, default config: | request (`?q=`) | status | |---|---| | `value%0d%0aHTTP%2F1.1+200+OK%0d%0aSet-Cookie%3A+pwned%3D1` (decoded to literal CRLF by the framework) | **200 — missed** | | `' OR 1=1--` | 400 — blocked (detection otherwise working) | | `1 UNION SELECT password FROM users--` | 400 — blocked | | `; cat /etc/passwd` | 400 — blocked | The legacy mode (no `SecurityConfig` detection attributes) skips preprocessing and catches the same decoded CRLF payload — the gap is specific to the enhanced-mode preprocessing pipeline, which every stock `SecurityConfig` activates. Contrast: every other preprocessing step (URL/HTML/hex/base64 decode) transforms *toward* what the attacker means; whitespace collapse is the one step that removes signal the detectors were written to require. ### PoC ```python import asyncio import httpx import uvicorn from fastapi import FastAPI from guard.adapters import SecurityMiddleware # fastapi-guard adapter over guard-core from guard_core.models import SecurityConfig from starlette.middleware import Middleware app = FastAPI(middleware=[Middleware( SecurityMiddleware, config=SecurityConfig(enable_redis=False))]) @app.get("/search") async def search(q: str = "") -> dict: return {"len": len(q)} async def main() -> None: server = uvicorn.Server(uvicorn.Config(app, host="127.0.0.1", port=8995, log_level="error")) task = asyncio.create_task(server.serve()) for _ in range(50): if server.started: break await asyncio.sleep(0.1) async with httpx.AsyncClient() as client: r = await client.get("http://127.0.0.1:8995/search", params={"q": "value%0d%0aHTTP%2F1.1+200+OK%0d%0aSet-Cookie%3A+pwned%3D1"}) print("CRLF payload:", r.status_code, "(200 = missed)") r2 = await client.get("http://127.0.0.1:8995/search", params={"q": "' OR 1=1--"}) print("SQLi control:", r2.status_code, "(400 = detection works)") server.should_exit = True await task asyncio.run(main()) # Output: CRLF payload: 200 (missed) / SQLi control: 400 (blocked) ``` ### Impact A detection bypass in a WAF/defense-in-depth layer: payloads shaped like HTTP response splitting (or newline-anchored command injection) are not flagged in the default mode, while other attack classes are. Not directly exploitable against Starlette/uvicorn-backed apps (they reject CRLF in response headers); the residual risk is for apps behind other stacks or apps that persist and re-emit the value where a CRLF-tolerant parser exists. **Fix:** preserve `\r\n` during whitespace collapse (collapse only `[ \t]+`), or run the newline-anchored patterns against the pre-collapse content. ## Reporter validation request The fix ships in guard-core 3.13.0, now on PyPI. If you reported this issue, please install 3.13.0 and confirm it is resolved. You can reply in this advisory's discussion thread or open a new issue with the result.

CVE-2026-129303 Affected Guard Core Versions

1 component(s)
Fixed Versions:
3.13.0
Product / Package Ecosystem Affected Versions Fixed Version
guard-core
PyPI
≥ 1.0.0
< 3.13.0
3.13.0

References

Frequently Asked Questions

What is CVE-2026-129303?
CVE-2026-129303 is a security vulnerability in Guard Core involving Whitespace-collapse preprocessing permanently disables the CRLF-anchored http-splitting and command-injection detectors in the default detection mode under CWE-693: Protection Mechanism Failure.
Which Guard Core versions are affected?
Affected versions include releases prior to 3.13.0 across affected packages: guard-core.
What version fixes CVE-2026-129303?
Upgrading to 3.13.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is guard-core affected?
Yes, guard-core is affected in releases prior to 3.13.0. Upgrade your dependency to 3.13.0 or later.
What is the CVSS score of CVE-2026-129303?
CVE-2026-129303 has a CVSS v3.1 base score of 3.7 (LOW) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N.
What CWE is associated with CVE-2026-129303?
CVE-2026-129303 is classified under CWE-693: Protection Mechanism Failure (The product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product.).
How can I check PyPI dependencies for CVE-2026-129303?
Run the dependency tree command: 'pip show guard-core'. 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-w7wg-6q7v-44f2",
  "modified" : "2026-11-19T22:50:13Z",
  "published" : "2026-11-19T22:50:13Z",
  "aliases" : [ "CVE-2026-129303" ],
  "summary" : "Guard Core: Whitespace-collapse preprocessing permanently disables the CRLF-anchored http-splitting and command-injection detectors in the default detection mode",
  "details" : "### Summary\n\nIn the default \"enhanced\" detection mode, `ContentPreprocessor.preprocess()` collapses all whitespace (`re.sub(r\"\\s+\", \" \", content)`, `guard_core/detection_engine/preprocessor.py:137` on master `08780f1`; `:384` in the 3.12.0 sdist) **before** pattern matching. This erases every `\\r` and `\\n` from the scanned value, rendering two built-in detectors structurally unmatchable regardless of input:\n\n- http_split — `guard_core/handlers/suspatterns_handler.py:540`: `r\"[\\r\\n]\\s*(?:HTTP\\/[0-9.]+|Location:|Set-Cookie:)\"` requires a literal `\\r` or `\\n`, which no longer exists after preprocessing;\n- cmd_injection — `r\"\\n\\s*(?:bash|sh|...)\\s+-c\\b\"` — same structural death.\n\nThe downstream application receives the **raw** value with CRLF intact (Starlette percent-decodes `%0d%0a` in query parameters before the adapter passes `request.query_params.items()` to `guard_core/utils.py:843-865`), so a response-splitting-shaped payload passes detection unflagged.\n\n### Details\n\nVerified end-to-end against a real uvicorn server running the fastapi-guard adapter over guard-core 3.12.0, default config:\n\n| request (`?q=`) | status |\n|---|---|\n| `value%0d%0aHTTP%2F1.1+200+OK%0d%0aSet-Cookie%3A+pwned%3D1` (decoded to literal CRLF by the framework) | **200 — missed** |\n| `' OR 1=1--` | 400 — blocked (detection otherwise working) |\n| `1 UNION SELECT password FROM users--` | 400 — blocked |\n| `; cat /etc/passwd` | 400 — blocked |\n\nThe legacy mode (no `SecurityConfig` detection attributes) skips preprocessing and catches the same decoded CRLF payload — the gap is specific to the enhanced-mode preprocessing pipeline, which every stock `SecurityConfig` activates. Contrast: every other preprocessing step (URL/HTML/hex/base64 decode) transforms *toward* what the attacker means; whitespace collapse is the one step that removes signal the detectors were written to require.\n\n### PoC\n\n```python\nimport asyncio\nimport httpx\nimport uvicorn\nfrom fastapi import FastAPI\nfrom guard.adapters import SecurityMiddleware  # fastapi-guard adapter over guard-core\nfrom guard_core.models import SecurityConfig\nfrom starlette.middleware import Middleware\n\napp = FastAPI(middleware=[Middleware(\n    SecurityMiddleware, config=SecurityConfig(enable_redis=False))])\n\n@app.get(\"/search\")\nasync def search(q: str = \"\") -> dict:\n    return {\"len\": len(q)}\n\nasync def main() -> None:\n    server = uvicorn.Server(uvicorn.Config(app, host=\"127.0.0.1\", port=8995, log_level=\"error\"))\n    task = asyncio.create_task(server.serve())\n    for _ in range(50):\n        if server.started:\n            break\n        await asyncio.sleep(0.1)\n    async with httpx.AsyncClient() as client:\n        r = await client.get(\"http://127.0.0.1:8995/search\",\n            params={\"q\": \"value%0d%0aHTTP%2F1.1+200+OK%0d%0aSet-Cookie%3A+pwned%3D1\"})\n        print(\"CRLF payload:\", r.status_code, \"(200 = missed)\")\n        r2 = await client.get(\"http://127.0.0.1:8995/search\", params={\"q\": \"' OR 1=1--\"})\n        print(\"SQLi control:\", r2.status_code, \"(400 = detection works)\")\n    server.should_exit = True\n    await task\n\nasyncio.run(main())\n# Output: CRLF payload: 200 (missed) / SQLi control: 400 (blocked)\n```\n\n### Impact\n\nA detection bypass in a WAF/defense-in-depth layer: payloads shaped like HTTP response splitting (or newline-anchored command injection) are not flagged in the default mode, while other attack classes are. Not directly exploitable against Starlette/uvicorn-backed apps (they reject CRLF in response headers); the residual risk is for apps behind other stacks or apps that persist and re-emit the value where a CRLF-tolerant parser exists.\n\n**Fix:** preserve `\\r\\n` during whitespace collapse (collapse only `[ \\t]+`), or run the newline-anchored patterns against the pre-collapse content.\n\n\n\n## Reporter validation request\n\nThe fix ships in guard-core 3.13.0, now on PyPI. If you reported this issue, please install 3.13.0 and confirm it is resolved. You can reply in this advisory's discussion thread or open a new issue with the result.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "guard-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.0.0"
      }, {
        "fixed" : "3.13.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/Guard-Core/guard-core/security/advisories/GHSA-w7wg-6q7v-44f2"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-129303"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Guard-Core/guard-core/pull/68"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Guard-Core/guard-core/commit/c07239fa1c5aa93e3f179440e79dad652977d3e4"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Guard-Core/guard-core/releases/tag/3.13.0"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/rennf93/guard-core"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-693" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-11-19T22:50:13Z",
    "nvd_published_at" : "2026-11-16T20:19:01Z"
  }
}