NIST deprecates RSA-2048 from 2030. Find every one of them before attackers do.
🐍
🐍 PyPI
Not in CISA KEV
MEDIUM severity

CVE-2026-129304 — guard-core

MEDIUMFix: Guard-Core/guard-core@c07239f

CVE-2026-129304 is a medium-severity (CVSS 5.4) Improper Input Validation vulnerability in guard-core. A fix is available for guard-core — see the affected versions and patch details below.

Guard Core: Unvalidated X-Forwarded-For-derived string used as a Redis key component and interpolated into a KEYS glob pattern

Also known asGHSA-gm9r-hvc9-96gv
Published
Updated
Affected
1 pkg
Patched
1 / 1
Exploits
None indexed
Exploitation data as of Nov 19, 2026 · OSV.dev, NVD, FIRST.org (EPSS)

Exploitation Status

Proof-of-concept exploit code exists

  • CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.

Exploitation and automatability from CISA’s SSVC triage for CVE-2026-129304.

EPSS Exploitation Probability

via FIRST.org ↗
0.2%probability of exploitation in next 30 days
Lower Risk0.00%
Lower risk than most CVEs16th percentile — riskier than 16% of all scored CVEsHighest risk

Probability of exploitation in the next 30 days, from FIRST.org EPSS.

How urgent is this, really

Where this sits among everything scored

Real-World Exposure

1 pkg affected
🐍guard-core

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.

Description

Summary

_extract_from_forwarded_header() (guard_core/utils.py:172-181 in 3.12.0; :179 on master 08780f1) returns the selected X-Forwarded-For entry without any ipaddress validation. When that entry is attacker-controlled, an arbitrary string becomes client_ip and flows into BehaviorTracker (guard_core/handlers/behavior_handler.py:83-102), which interpolates it verbatim into both a Redis key name and a KEYS glob pattern:

key = f"behavior:usage:{endpoint_id}:{client_ip}"
await self.redis_handler.set_key("behavior_usage", f"{key}:{current_time}", "1", ttl=rule.window)
pattern = f"behavior_usage:{key}:*"
keys = await self.redis_handler.keys(pattern)      # blocking KEYS, O(N) over keyspace

Same shape in track_return_pattern() (behavior_handler.py:135-142). redis_handler.keys() maps to the blocking Redis KEYS command (guard_core/handlers/redis_handler.py:265-275).

Details

Three consequences, in increasing severity:

  1. Cross-client counter contamination. X-Forwarded-For: * makes the glob match every client's behavior-usage keys for the endpoint. Verified with a fake-Redis harness: a client 9.9.9.9 hit an endpoint 3 times (threshold=3 rule), then a single attacker request carrying XFF: * issued the pattern behavior_usage:behavior:usage:app.login:*:*, counted the victim's events, and tripped the rule on its first request. An embedded : also shifts which key segment is parsed as the timestamp (behavior_handler.py:94-100).
  2. Unbounded key-space growth + blocking scans. Each request creates a new unique key (f"{key}:{current_time}") and then issues a blocking KEYS scan whose cost grows with total keys — on the shared Redis instance, degrading every guard-core instance using it. Rotating arbitrary XFF strings multiplies distinct keys without bound.
  3. Error path. A tripped ban action passes the non-IP string to ip_ban_manager.ban_ip(), whose ipaddress validation raises ValueError uncaught in the behavioral processor — the request 500s.

PoC

import asyncio
from types import SimpleNamespace
from guard_core.models import SecurityConfig
from guard_core.utils import extract_client_ip

class CIHeaders(dict):
    def get(self, key, default=None):
        for k, v in self.items():
            if k.lower() == key.lower():
                return v
        return default

class FakeRequest:
    def __init__(self, xff):
        self.state = SimpleNamespace()
        self.client_host = "10.0.0.1"          # the TRUSTED proxy
        self.headers = CIHeaders({"X-Forwarded-For": xff})

async def main():
    config = SecurityConfig(trusted_proxies=("10.0.0.1",), enable_redis=False)
    ip = await extract_client_ip(FakeRequest("*"), config)
    print(repr(ip))        # -> '*'  (arbitrary string, no validation)

asyncio.run(main())

Then BehaviorTracker.track_endpoint_usage("app.login", "*", rule) issues KEYS behavior_usage:behavior:usage:app.login:*:* — matching other clients' keys (full fake-Redis script: poc_xff_redis.py, available on request).

Impact

Integrity and availability of the behavioral-analytics subsystem and the shared Redis instance, in deployments where the extracted XFF position is attacker-controllable. No data exposure; not reachable with default settings (trusted_proxies defaults empty).

Fix: validate the extracted XFF entry with ipaddress.ip_address() before returning it from extract_client_ip() (fall back to the connecting IP on failure); escape glob metacharacters (*?[]) in anything interpolated into a KEYS pattern — or replace the KEYS+per-request-key design with an atomic counter / Lua sliding window (the rate-limit Lua script already shows the right shape).

Affected Packages

1 total 1 fixed
EcosystemPackageVulnerable rangeFix
🐍PyPIguard-core≥ 1.0.0&&< 3.13.03.13.0pip install --upgrade 'guard-core==3.13.0'

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for guard-core, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update guard-core to 3.13.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2026-129304 is resolved across your whole dependency graph.

  3. Workarounds

    If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.

Frequently Asked Questions

### Summary `_extract_from_forwarded_header()` (`guard_core/utils.py:172-181` in 3.12.0; `:179` on master `08780f1`) returns the selected `X-Forwarded-For` entry **without any `ipaddress` validation**. When that entry is attacker-controlled, an arbitrary string becomes `client_ip` and flows into `BehaviorTracker` (`guard_core/handlers/behavior_handler.py:83-102`), which interpolates it verbatim into both a Redis key name and a `KEYS` glob pattern: ```python key = f"behavior:usage:{endpoint_id}:{client_ip}" await self.redis_handler.set_key("behavior_usage", f"{key}:{current_time}", "1", ttl=r
O3 Security · Impact-Aware SCA

Is CVE-2026-129304 in your dependencies?

Find it across PyPI, including transitive dependencies.

CVE-2026-129304: guard-core — Fixed in 3.13.0