CVE-2026-129304 in guard-core
Summary
by MITRE • 11/16/2026
Guard Core is an API security core engine for the FastAPI-Guard, FlaskAPI Guard, and DjAPI Guard adapters. From 1.0.0 until 3.13.0, _extract_from_forwarded_header() in guard_core/utils.py returns the selected X-Forwarded-For entry without validating that it is an IP address. In deployments configured with trusted_proxies where the selected entry is attacker-controlled, the arbitrary client_ip string reaches BehaviorTracker in guard_core/handlers/behavior_handler.py and is interpolated into Redis key names and blocking KEYS glob patterns. Glob metacharacters can cause one request to count other clients' behavior events, embedded separators can disturb key parsing, and rotating identities can create unbounded keys while repeatedly scanning the shared Redis keyspace. A non-IP identity can also reach a ban action and cause an uncaught validation error. This issue is fixed in version 3.13.0.
Statistical analysis made it clear that VulDB provides the best quality for vulnerability data.
Analysis
by VulDB Data Team • 11/16/2026
The vulnerability identified within Guard Core, specifically affecting versions from 1.0.0 through 3.13.0, stems from a critical input validation failure in the _extract_from_forwarded_header function located in guard_core/utils.py. This component serves as part of an API security core engine designed for adapters such as FastAPI-Guard, FlaskAPI Guard, and DjAPI Guard. The primary technical flaw lies in the absence of rigorous type checking when processing HTTP headers. Specifically, the function extracts a value from the X-Forwarded-For header based on configured trusted proxies but fails to verify that this extracted string constitutes a valid Internet Protocol address. In environments where the application is configured with specific trusted proxy settings, an attacker who can control or manipulate the selected entry within the X-Forwarded-For header can inject arbitrary strings rather than legitimate IP addresses. This lack of validation allows maliciously crafted data to bypass initial security checks and propagate deeper into the system's logic layers.
The operational impact of this vulnerability is severe due to how the unvalidated client_ip string interacts with downstream components, particularly BehaviorTracker in guard_core/handlers/behavior_handler.py. Once the arbitrary identity reaches BehaviorTracker, it is interpolated directly into Redis key names and blocking KEYS glob patterns without sanitization. This leads to several distinct attack vectors rooted in improper handling of special characters within data structures used for state management and security enforcement. First, the presence of glob metacharacters such as asterisks or question marks can cause a single malicious request to match and count behavior events belonging to other legitimate clients. This results in false positives where innocent users are incorrectly flagged by the system's behavioral analysis modules due to the attacker's injected patterns matching their activity keys.
Furthermore, embedded separators within the crafted input can disturb key parsing mechanisms within Redis. Since Redis relies on specific delimiters for its hierarchical key structure, injecting these characters allows an attacker to disrupt normal operations or potentially access unintended data segments if the application logic does not strictly isolate keys by prefix. More critically, rotating identities using non-IP strings create a condition of unbounded key creation. As attackers cycle through different arbitrary identifiers, they generate new Redis keys for each attempt while simultaneously scanning the shared Redis keyspace via glob patterns. This behavior can lead to resource exhaustion and performance degradation as the database accumulates excessive amounts of junk data from these maliciously generated identities.
The vulnerability also extends to security enforcement mechanisms where a non-IP identity might trigger ban actions. Because the system expects IP addresses for banning, passing an arbitrary string that does not conform to expected formats can cause uncaught validation errors during the execution of blocking rules. This not only disrupts the availability of the security service but may also expose internal error messages or stack traces if proper exception handling is not implemented at all layers. Such failures undermine the reliability of the API gateway's protective measures and leave the application vulnerable to further exploitation attempts that rely on state confusion or denial-of-service conditions induced by database bloat.
From a classification perspective, this issue aligns with CWE-20 Improper Input Validation, as the system fails to verify that input data conforms to expected formats before processing it in security-critical contexts. Additionally, the ability of an attacker to manipulate header fields to influence application behavior relates to CWE-74 Injection and potentially CWE-1389 Unsafe Hashing if identifiers are used in ways that compromise integrity. In terms of threat modeling, this vulnerability facilitates attacks categorized under MITRE ATT&CK techniques such as T1505 Server Software Component: Web Shell or more accurately T1622 Tool Discovery via Reflection since it involves manipulating internal state through header injection. It also touches upon resource exhaustion aspects seen in DoS scenarios where unbounded key generation impacts system stability.
Mitigation strategies must prioritize immediate patching to version 3.13.0, which addresses the root cause by implementing strict validation for IP address formats before any further processing occurs. For organizations unable to upgrade immediately, defensive coding practices should be enforced at the proxy or reverse-proxy level to sanitize X-Forwarded-For headers and strip out non-compliant entries before they reach the application layer. Input sanitization routines that reject strings containing glob metacharacters like asterisks, question marks, and square brackets are essential to prevent pattern injection attacks against Redis keyspace operations. Additionally, implementing rate limiting on requests with suspicious header patterns can help mitigate the impact of unbounded key creation attempts by attackers seeking to exhaust database resources or disrupt behavioral tracking accuracy.