CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-129304

CVE-2026-129304: Improper Input Validation and Redis Glob Injection in Guard Core

Amit Schendel
Amit Schendel
Senior Security Researcher

Nov 19, 2026·10 min read·2 visits

Executive Summary (TL;DR)

Guard Core versions prior to 3.13.0 fail to validate IP addresses extracted from X-Forwarded-For headers before interpolating them into Redis KEYS glob queries. Attackers behind configured trusted proxies can inject glob metacharacters to corrupt cross-client behavioral tracking, starve Redis event loops, or crash request handlers.

CVE-2026-129304 is an improper input validation and Redis glob pattern injection vulnerability in Guard Core versions 1.0.0 through 3.12.0. The header parsing routine _extract_from_forwarded_header() extracts values from the X-Forwarded-For HTTP header without verifying that the extracted substring is a valid IPv4 or IPv6 address. In deployments configured with trusted_proxies where the target header index is client-controllable, arbitrary strings containing Redis glob metacharacters reach BehaviorTracker and are interpolated directly into Redis key names and blocking KEYS queries. This allows unauthenticated attackers to aggregate cross-client behavioral metrics, trigger false-positive rate limits, cause denial of service via O(N) Redis keyspace scans, or raise unhandled ValueError exceptions during automated IP ban operations.

Vulnerability Overview

Guard Core (guard-core) serves as the central API security engine powering multiple Python web framework adapters, including FastAPI-Guard, FlaskAPI Guard, and DjAPI Guard. The library provides middleware-level security mechanisms such as IP filtering, rate limiting, automated IP banning, and behavioral tracking across HTTP endpoints. To maintain distributed state across multiple application workers, Guard Core integrates with Redis to store and evaluate request telemetry.

In versions 1.0.0 up to 3.13.0, Guard Core contains an improper input validation flaw (CWE-20) coupled with improper neutralization of special elements in data query logic (CWE-943). When evaluating requests passing through reverse proxies, the IP extraction helper _extract_from_forwarded_header() parses the X-Forwarded-For HTTP header based on a configured proxy depth. The function extracts the substring at the specified index and returns it as the canonical client_ip without validating that the string conforms to valid IPv4 or IPv6 syntax.

When behavioral tracking rules (usage or return_pattern) are active on an endpoint, the unvalidated client_ip string is passed directly to BehaviorTracker in guard_core/handlers/behavior_handler.py. The tracker concatenates this string into Redis key names and interpolates it into a blocking Redis KEYS search command (behavior_usage:{key}:*).

Because the input is neither validated as an IP address nor escaped for glob syntax, an unauthenticated remote attacker who controls the selected X-Forwarded-For entry can inject Redis glob metacharacters (*, ?, [, ], \) or delimiter characters (:). This allows the attacker to manipulate behavioral tracking counts across unrelated clients, degrade Redis availability via expensive keyspace traversals, and trigger unhandled exceptions in downstream IP ban logic.

Root Cause Analysis

The root cause of CVE-2026-129304 stems from two distinct architectural flaws: the absence of syntactic validation at the HTTP trust boundary and the reliance on string-interpolated KEYS pattern matching for time-series aggregation in Redis.

At the ingress boundary, _extract_from_forwarded_header() in guard_core/utils.py (later moved to guard_core/_utils/ip_extraction.py and mirrored in guard_core/sync/_utils/ip_extraction.py) splits the X-Forwarded-For header string on commas and strips surrounding whitespace. It then checks if the number of comma-separated elements is at least equal to proxy_depth, returning ips[-proxy_depth]. The function performs no parsing via Python's standard ipaddress.ip_address() module, allowing arbitrary textual tokens to propagate through the application as trusted client IP identities.

In the persistence layer, BehaviorTracker.track_endpoint_usage() and BehaviorTracker.track_return_pattern() implement sliding-window event counting by creating a discrete Redis key for every individual request hit, formatted as behavior:usage:{endpoint_id}:{client_ip}:{current_time}. To count how many hits occurred within the active window, the handler constructs a search string (f"behavior_usage:{key}:*") and executes the Redis KEYS command.

Redis evaluates the pattern argument of the KEYS command using stringmatchlen, a glob-style pattern matcher where * matches any sequence of characters (including the : delimiter), ? matches any single character, and [...] defines character classes. When client_ip contains *, the resulting pattern behavior_usage:behavior:usage:{endpoint_id}:*:* expands across the key namespace of all clients accessing {endpoint_id}.

Furthermore, two secondary parser synchronization failures occur when arbitrary strings are accepted as client_ip. First, BehaviorTracker recovers the timestamp of each matched key by splitting on the colon separator (float(key_name.split(":")[-1])), which can be disrupted by injected delimiters. Second, if a behavioral threshold violation triggers an automated ban (action="ban"), the raw client_ip string is passed to ip_ban_manager.ban_ip(), which calls ipaddress.ip_address(ip). Passing a non-IP payload such as * raises an uncaught ValueError, terminating request processing with a 500 Internal Server Error.

Code Analysis

Examining the vulnerable implementation alongside patch commit c07239fa1c5aa93e3f179440e79dad652977d3e4 illustrates how the unvalidated input flowed from header extraction to Redis execution, and how the maintainers remediated both layers.

Prior to version 3.13.0, _extract_from_forwarded_header() and BehaviorTracker.track_endpoint_usage() were implemented as follows:

# Vulnerable implementation in guard_core/utils.py (< 3.13.0)
def _extract_from_forwarded_header(forwarded_for: str, proxy_depth: int) -> str | None:
    if not forwarded_for:
        return None
    ips = [ip.strip() for ip in forwarded_for.split(",")]
    if len(ips) < proxy_depth:
        return None
    # BUG: Returns arbitrary string without IP syntax validation
    return ips[-proxy_depth]
 
# Vulnerable implementation in guard_core/handlers/behavior_handler.py (< 3.13.0)
async def track_endpoint_usage(self, endpoint_id: str, client_ip: str, rule: BehaviorRule) -> bool:
    current_time = time.time()
    window_start = current_time - rule.window
 
    if self.redis_handler:
        # BUG: Unvalidated client_ip concatenated directly into key namespace
        key = f"behavior:usage:{endpoint_id}:{client_ip}"
 
        await self.redis_handler.set_key(
            "behavior_usage", f"{key}:{current_time}", "1", ttl=rule.window
        )
 
        # BUG: Unescaped glob pattern evaluated via blocking KEYS command
        pattern = f"behavior_usage:{key}:*"
        keys = await self.redis_handler.keys(pattern)
 
        valid_count = 0
        for key_name in keys:
            try:
                timestamp = float(key_name.split(":")[-1])
                if timestamp >= window_start:
                    valid_count += 1
            except (ValueError, IndexError):
                continue
 
        return valid_count > rule.threshold

In version 3.13.0 (Pull Request #68), the maintainers refactored guard_core/_utils/ip_extraction.py (and its synchronous twin) to strictly validate extracted candidates using ipaddress.ip_address(), reject any string containing glob metacharacters, and normalize the address into canonical text representation:

# Patched implementation in guard_core/_utils/ip_extraction.py (>= 3.13.0)
def _forwarded_header_candidate_has_metachar(candidate: str) -> bool:
    # Explicit defense-in-depth rejection of glob characters
    return any(metachar in candidate for metachar in ("*", "?", "[", "]", "\\"))
 
def _forwarded_header_candidate(forwarded_for: str, proxy_depth: int) -> str | None:
    ips = [ip.strip() for ip in forwarded_for.split(",")]
    if len(ips) < proxy_depth:
        return None
    return _strip_ip_brackets(ips[-proxy_depth])
 
def _forwarded_header_candidate_addr(
    candidate: str,
) -> IPv4Address | IPv6Address | None:
    try:
        # Strict syntactic validation for IPv4 or IPv6
        return ip_address(candidate)
    except ValueError:
        return None
 
def _extract_from_forwarded_header(forwarded_for: str, proxy_depth: int) -> str | None:
    if not forwarded_for:
        return None
 
    candidate = _forwarded_header_candidate(forwarded_for, proxy_depth)
    if candidate is None:
        return None
 
    addr = _forwarded_header_candidate_addr(candidate)
    if addr is None:
        return None
 
    if _forwarded_header_candidate_has_metachar(candidate):
        return None
 
    return _canonical_ip_text(addr)

In addition to input validation, the patch completely eliminated the use of KEYS and raw identity concatenation in BehaviorTracker. Dynamic identity segments (endpoint_id, client_ip, and rule.pattern) are now hashed using SHA-256 (_hash_identity_segment), and sliding-window counts are tracked atomically using Redis Sorted Sets (ZSET) via record_sliding_window_hit():

# Patched implementation in guard_core/handlers/behavior_handler.py (>= 3.13.0)
def _hash_identity_segment(value: str) -> str:
    # Maps arbitrary strings to fixed 64-character hexadecimal digests
    return hashlib.sha256(value.encode()).hexdigest()
 
async def track_endpoint_usage(self, endpoint_id: str, client_ip: str, rule: BehaviorRule) -> bool:
    current_time = time.time()
    window_start = current_time - rule.window
 
    if self.redis_handler:
        key = (
            f"behavior:usage:{_hash_identity_segment(endpoint_id)}:"
            f"{_hash_identity_segment(client_ip)}"
        )
        # Uses atomic ZADD / ZREMRANGEBYSCORE / ZCARD pipeline instead of KEYS
        valid_count: int = await self.redis_handler.record_sliding_window_hit(
            "behavior_usage", key, current_time, window_start, rule.window
        )
        return valid_count > rule.threshold

> [!NOTE] > The remediation is complete and provides strong defense-in-depth. Even if an attacker bypassed HTTP header extraction or invoked BehaviorTracker directly with malicious strings, SHA-256 hashing restricts all dynamic Redis key components to alphanumeric hex characters ([0-9a-f]), and the removal of KEYS eliminates glob pattern evaluation entirely.

Exploitation

Exploiting CVE-2026-129304 requires specific deployment preconditions. First, the target application must run guard-core version 1.0.0 through 3.12.0 with enable_redis=True and behavioral tracking rules attached to at least one accessible route. Second, the application configuration must specify trusted_proxies such that the connecting socket IP matches a trusted proxy, and trusted_proxy_depth must resolve to an index within X-Forwarded-For that remains under client control (for example, when an upstream proxy appends the client connection IP to an existing client-supplied X-Forwarded-For header and trusted_proxy_depth is set to 2 or higher, or when a misconfigured proxy forwards the header verbatim).

Under these conditions, an attacker can execute two primary attack methodologies: cross-client metric aggregation and application exception triggering.

In a cross-client metric aggregation attack, the adversary sends an HTTP request containing a wildcard payload at the target proxy depth:

GET /api/v1/resource HTTP/1.1
Host: api.example.com
X-Forwarded-For: *, 203.0.113.50

When Guard Core processes this request with trusted_proxy_depth=2, _extract_from_forwarded_header() extracts * as client_ip. BehaviorTracker records a key behavior_usage:behavior:usage:/api/v1/resource:*:{timestamp} and then executes KEYS behavior_usage:behavior:usage:/api/v1/resource:*:*. This query matches every active hit recorded for /api/v1/resource across all legitimate client IPs within the time window. If legitimate traffic has already generated hits exceeding rule.threshold, the threshold trips on the attacker's first request.

Conversely, once the attacker injects wildcard keys or floods the endpoint with rotating synthetic identities (e.g., X-Forwarded-For: id_1, id_2, ..., id_10000), every subsequent request by any client forces the single-threaded Redis server to execute an $O(N)$ KEYS scan across the inflated keyspace. Furthermore, if the behavioral rule is configured with action="ban", crossing the threshold invokes ip_ban_manager.ban_ip("*"), where ipaddress.ip_address("*") raises an uncaught ValueError and returns an HTTP 500 error.

The official test suite in tests/test_decorators/test_behavior_handler.py demonstrates the core injection mechanics:

@pytest.mark.asyncio
async def test_track_endpoint_usage_redis_glob_client_ip_does_not_leak_other_clients(
    security_config_redis: SecurityConfig,
) -> None:
    tracker = BehaviorTracker(security_config_redis)
    redis_mgr = redis_handler(security_config_redis)
    await redis_mgr.initialize()
    await tracker.initialize_redis(redis_mgr)
 
    rule = BehaviorRule(rule_type="usage", threshold=3, window=60)
    endpoint_id = "/api/injection-client-ip"
    victim_ip = "10.9.9.9"
 
    # Victim IP generates 5 legitimate hits (exceeding threshold of 3)
    for _ in range(5):
        await tracker.track_endpoint_usage(endpoint_id, victim_ip, rule)
 
    # Attacker supplies '*' as client_ip via X-Forwarded-For
    # In vulnerable versions (< 3.13.0), tripped evaluates to True on the first request
    tripped = await tracker.track_endpoint_usage(endpoint_id, "*", rule)
    assert not tripped
 
    await redis_mgr.close()

Impact Assessment

CVE-2026-129304 carries a CVSS v3.1 base score of 5.4 (Medium) with the vector CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:L/A:L. The Attack Complexity is rated High (AC:H) because successful exploitation depends on a specific deployment architecture combining trusted_proxies, a reachable client-controlled X-Forwarded-For index, and Redis-backed behavioral rules. The Scope is Changed (S:C) because the vulnerability resides in the Python web middleware layer while its impacts manifest directly within the backend Redis data store.

Confidentiality is not impacted (C:N). Although the attacker's request forces Redis to match keys belonging to other clients, the matched key names and contents are only used internally by BehaviorTracker to calculate valid_count and are never returned in the HTTP response body or headers.

Integrity is impacted (I:L) through telemetry contamination and state desynchronization. An attacker can falsify behavioral usage and return-pattern metrics, triggering false-positive security alerts, anomalous log entries, or premature behavioral enforcement actions.

Availability is impacted (A:L) through two distinct vectors. First, injecting non-IP strings into endpoints configured with automated banning causes uncaught ValueError exceptions during ban execution. Second, rotating arbitrary identities via X-Forwarded-For creates unbounded keys in Redis while triggering repeated blocking KEYS scans on every request, degrading Redis throughput and increasing latency for all dependent services. According to FIRST EPSS metrics, the vulnerability has an EPSS score of 0.00244 (15.81st percentile) and is not listed in the CISA KEV catalog.

Remediation

To remediate CVE-2026-129304, upgrade guard-core to version 3.13.0 or later. Applications utilizing downstream framework adapters (fastapi-guard, flaskapi-guard, or djapi-guard) should ensure their dependency lockfiles resolve guard-core >= 3.13.0.

pip install --upgrade "guard-core>=3.13.0"
# Or using uv:
uv add "guard-core>=3.13.0"

Version 3.13.0 enforces syntactic IP validation via ipaddress.ip_address(), explicitly rejects glob metacharacters during header extraction, hashes dynamic identity components with SHA-256 before constructing Redis keys, and replaces blocking KEYS queries with atomic pipelined Redis Sorted Set (ZSET) operations (ZADD, ZREMRANGEBYSCORE, ZCARD, and EXPIRE).

For environments where an immediate library upgrade is not feasible, operators should implement compensating controls at the reverse proxy and WAF layers:

  1. Sanitize X-Forwarded-For at the Ingress Proxy: Configure edge load balancers or reverse proxies (such as NGINX, Envoy, or HAProxy) to strip client-supplied X-Forwarded-For headers at the network perimeter, or strictly validate that trusted_proxy_depth matches the exact number of controlled proxy hops so client-controlled entries are never selected.
  2. Filter Glob Metacharacters via WAF/Proxy Rules: Reject incoming HTTP requests containing Redis glob metacharacters (*, ?, [, ], \) within the X-Forwarded-For header. For example, in NGINX:
if ($http_x_forwarded_for ~* "[\*\?\[\]\\]") {
    return 400 "Bad Request: Invalid X-Forwarded-For Header";
}

> [!WARNING] > Disabling the KEYS command in redis.conf (rename-command KEYS "") protects the Redis instance from blocking $O(N)$ scans, but doing so on Guard Core versions prior to 3.13.0 will cause BehaviorTracker queries to fail until the package is upgraded to 3.13.0.

Official Patches

Guard-CoreOfficial GitHub Security Advisory GHSA-gm9r-hvc9-96gv
Guard-CorePull Request #68 implementing IP validation and Redis ZSET sliding window tracking
Guard-CoreGuard Core 3.13.0 Release Notes

Fix Analysis (2)

Technical Appendix

CVSS Score
5.4/ 10
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:L/A:L
EPSS Probability
0.24%
Top 84% most exploited

Affected Systems

guard-coreFastAPI-GuardFlaskAPI GuardDjAPI Guard

Affected Versions Detail

Product
Affected Versions
Fixed Version
guard-core
rennf93 (Guard-Core Project)
>= 1.0.0, < 3.13.03.13.0
AttributeDetail
CVE IDCVE-2026-129304 (GHSA-gm9r-hvc9-96gv)
Weakness ClassCWE-20 (Improper Input Validation) / CWE-943 (Redis Glob Injection)
CVSS v3.1 Score5.4 Medium (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:L/A:L)
EPSS Score0.244% (15.81st Percentile)
Attack VectorNetwork (Unauthenticated HTTP X-Forwarded-For Header Manipulation)
Affected Versionsguard-core >= 1.0.0, < 3.13.0
Patched Versionguard-core 3.13.0
CISA KEV StatusNot Listed

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
CWE-20
Improper Input Validation

The product receives input or data, but does not validate or incorrectly validates that the input possesses the properties, syntax, or constraints required to process the data safely and correctly.

Vulnerability Timeline

Guard Core 3.13.0 release prepared with detection engine hardening and Redis sliding-window refactoring
2026-08-22
Fix commit c07239fa1c5aa93e3f179440e79dad652977d3e4 merged via Pull Request #68
2026-08-24
Guard Core 3.13.0 officially released on GitHub and PyPI
2026-08-25
GitHub Security Advisory GHSA-gm9r-hvc9-96gv and CVE-2026-129304 published
2026-11-16
NVD and CVE.org records updated with CVSS v3.1 vector and CWE-20 classification
2026-11-18

References & Sources

  • [1]GitHub Security Advisory GHSA-gm9r-hvc9-96gv
  • [2]NVD - CVE-2026-129304 Detail
  • [3]CVE.org Record - CVE-2026-129304
  • [4]Guard Core Pull Request #68
  • [5]Fix Commit c07239fa1c5aa93e3f179440e79dad652977d3e4
  • [6]Guard Core Commit 5031079fda93206de0c8f1b45082722c05feb042
  • [7]Guard Core Release 3.13.0
  • [8]CVE List V5 Record - CVE-2026-129304
  • [9]Shodan CVEDB - CVE-2026-129304

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•5 minutes ago•CVE-2026-128135
7.1

CVE-2026-128135: Sandbox Escape and Arbitrary File Overwrite via Hardlink Following in NLTK ZIP Extraction

A local sandbox escape vulnerability exists in the Natural Language Toolkit (NLTK) versions 3.9.4 through 3.10.3 within its ZIP archive extraction implementation. Due to a type mismatch in member resolution and a failure to inspect filesystem link counts (st_nlink > 1), the extraction routine follows pre-planted hardlinks inside the extraction root, allowing a local attacker to truncate and overwrite arbitrary out-of-root files writable by the executing process.

Alon Barad
Alon Barad
0 views•10 min read
•about 2 hours ago•CVE-2026-77597
3.5

CVE-2026-77597: Blind Server-Side Request Forgery in iSponsorBlockTV DIAL Discovery

iSponsorBlockTV prior to version 2.11.0 contains a blind Server-Side Request Forgery (SSRF) vulnerability in its Simple Service Discovery Protocol (SSDP) and Discovery and Launch (DIAL) client implementation. During local device discovery, the application processes SSDP responses without validating that the URL specified in the LOCATION header or the subsequent application-url response header matches the IP address of the responding UDP host. An adjacent network attacker can spoof SSDP responses to induce the iSponsorBlockTV host to send arbitrary HTTP GET requests and constrained HTTP POST requests to internal network endpoints or loopback services.

Alon Barad
Alon Barad
3 views•12 min read
•about 3 hours ago•CVE-2026-121707
8.7

CVE-2026-121707: Regular Expression Denial of Service (ReDoS) in Effect Schema.TemplateLiteral

CVE-2026-121707 is a high-severity Regular Expression Denial of Service (ReDoS) vulnerability in the Effect TypeScript library prior to version 3.22.1. When evaluating untrusted input against Schema.TemplateLiteral definitions containing multiple string spans, the dynamically compiled regular expression exhibits polynomial backtracking complexity. Because JavaScript runtimes execute on a single-threaded event loop, processing specially crafted non-matching strings causes synchronous CPU starvation and complete application unresponsiveness.

Amit Schendel
Amit Schendel
3 views•10 min read
•about 4 hours ago•CVE-2026-75518
4.8

CVE-2026-75518: Read-Tier Authorization Bypass in DOMShell MCP Server

CVE-2026-75518 is an incorrect authorization and privilege assignment vulnerability in the DOMShell Model Context Protocol (MCP) server (@apireno/domshell) prior to version 2.0.8. The server classified the domshell_eval tool and the eval command as read-tier operations, permitting their execution without the --allow-write flag. Because the eval command dispatches through the same Chrome DevTools Protocol (CDP) Runtime.evaluate pipeline as the write-tier js command without enabling the throwOnSideEffect constraint, callers restricted to read-only sessions can execute state-mutating JavaScript in the browser context while host user interfaces and audit logs record the activity as read-only.

Amit Schendel
Amit Schendel
4 views•4 min read
•about 5 hours ago•CVE-2026-63411
9.3

CVE-2026-63411: Remote Code Execution via PHPDoc Comment Breakout in Jane PHP OpenAPI Generator

CVE-2026-63411 (GHSA-xwcw-j52r-34x4) is a remote code execution vulnerability in the Jane PHP code generation framework (janephp/janephp), specifically affecting the jane-php/open-api-3 component prior to version 7.12.0. The generator constructs PHP docblocks using unsanitized parameter names and descriptions extracted directly from OpenAPI specifications. By embedding the comment closing sequence (*/) followed by valid PHP syntax inside an OpenAPI description or parameter name, an attacker can break out of the PHPDoc context and inject executable code directly into the generated class body. When the consuming application instantiates the generated client or endpoint class, an injected __construct() method executes arbitrary PHP code under the privileges of the host runtime.

Amit Schendel
Amit Schendel
2 views•9 min read
•about 6 hours ago•CVE-2026-63413
9.3

CVE-2026-63413: Remote Code Execution via PHPDoc Comment Breakout in Jane PHP OpenAPI 3 Generator

CVE-2026-63413 is a code injection vulnerability in the Jane PHP OpenAPI 3 SDK generator (jane-php/open-api-3) prior to version 7.12.0. The vulnerability occurs because the generator interpolates OpenAPI header and query parameter names directly into generated PHPDoc comment blocks without sanitizing comment closing delimiters (*/). An attacker who supplies or modifies an OpenAPI specification can break out of the docblock context and inject arbitrary PHP methods, such as a class constructor, into the generated Client or Endpoint class body. When the consuming application instantiates the generated SDK, the injected code executes with the privileges of the host PHP process.

Alon Barad
Alon Barad
3 views•9 min read