CVE-2026-59361 — Spring AI (2.0.2.1) — HIGH Vulnerability
RedisVectorStore is vulnerable to RediSearch query injection when metadata filter expressions are built from untrusted values. RedisFilterExpressionConverter translates Spring AI filter expressions into RediSearch query clauses, but escapes only a subset of the characters that RediSearch treats as query syntax. A value that reaches a filter expression from an untrusted source can therefore change the structure of the executed query instead of being matched as literal text. Compound filter expressions are additionally emitted without grouping, so RediSearch operator precedence can alter the effective meaning of a filter that combines several conditions. In applications that rely on metadata filters to enforce authorization or tenant isolation, this can broaden a similarity search beyond its intended scope and return documents and embeddings belonging to other tenants. Any application that incorporates user-supplied values into Redis vector store filter expressions is impacted.
RedisVectorStore is vulnerable to RediSearch query injection when metadata filter expressions are built from untrusted values. RedisFilterExpressionConverter translates Spring AI filter expressions into RediSearch query clauses, but escapes only a subset of the characters that RediSearch treats as query syntax. A value that reaches a filter expression from an untrusted source can therefore change the structure of the executed query instead of being matched as literal text. Compound filter expressions are additionally emitted without grouping, so RediSearch operator precedence can alter the effective meaning of a filter that combines several conditions. In applications that rely on metadata filters to enforce authorization or tenant isolation, this can broaden a similarity search beyond its intended scope and return documents and embeddings belonging to other tenants. Any application that incorporates user-supplied values into Redis vector store filter expressions is impacted.
🎯 What is this vulnerability?
CVE‑2026‑59361 is a RediSearch query‑injection flaw in Spring AI 2.0.2.1 that allows an unauthenticated attacker to inject arbitrary RediSearch query syntax through the metadata filter that is supplied by the user.
The vulnerability originates in the RedisFilterExpressionConverter component, which translates Spring‑AI filter expressions into RediSearch query clauses. The converter:
1. Escapes only a subset of the characters that RediSearch treats as query syntax (@, :, (, ), AND, OR, NOT, etc.).
2. Does not group compound filter expressions – the generated query string is a flat concatenation of clauses.
3. Accepts untrusted values (e.g., user‑supplied tenant IDs, tags, or arbitrary strings) without proper validation or sanitisation.
Because of these omissions, an attacker can supply a value that contains RediSearch operators and change the logical structure of the query. For example, a filter that was intended to match only documents belonging to tenant 123 can be transformed into a query that also matches documents belonging to tenant 456, or even to all tenants.
The flaw is a classic CWE‑20: Improper Input Validation (specifically, query‑injection). The CVSS vector (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N) reflects that the vulnerability is high‑impact on confidentiality but does not affect integrity or availability.
⚡ Attack Chain
Below is a realistic, step‑by‑step chain that an attacker could follow to exploit the flaw. The example assumes the application exposes a REST endpoint that accepts a JSON body containing a filter field. If the real endpoint differs, the same logic applies – the payload is illustrative.
| Step | Action | Technical Detail |
|---|---|---|
| 1. Discovery & Reconnaissance | Identify the target application and vulnerable version. | • Scan the target for HTTP services. <br>• Query the /actuator/info or /actuator/health endpoints (common in Spring Boot apps) to discover the Spring AI version. <br>• Verify that the application uses Spring AI 2.0.2.1 (e.g., spring.ai.version=2.0.2.1). |
| 2. Exploitation | Craft a malicious filter expression that injects RediSearch syntax. | PoC payload (illustrative, endpoint may vary): <br>``bash\ncurl -X POST \\\n http://TARGET/api/v1/search \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"query\": \"machine learning\",\n \"filter\": \"@tenant:123 OR @tenant:456\"\n }'\n` <br>What happens:<br>• The filter string is passed to RedisFilterExpressionConverter. <br>• The converter only escapes @ and : but leaves OR and the second @tenant:456 untouched. <br>• The resulting RediSearch query becomes @tenant:123 OR @tenant:456`, which returns documents from *both* tenants. <br>• If the application uses the filter to enforce tenant isolation, the attacker now receives data that should be invisible. |
| 3. Post‑exploitation | Leverage the data leak to achieve further impact. | • Data exfiltration: The attacker can download all documents belonging to the injected tenant(s). <br>• Privilege escalation: If the application stores sensitive embeddings or credentials in the vector store, the attacker can retrieve them. <br>• Persistence: The attacker can repeatedly query the vector store with crafted filters to harvest additional data over time. |
Note: The exact endpoint (/api/v1/search) and parameter names (filter) are illustrative. If the real application uses a different route or payload structure, the same injection logic applies – the attacker must supply a filter that contains RediSearch operators.
🌍 Real World Impact
| Impact | CVSS Interpretation | Practical Consequence |
|---|---|---|
| Confidentiality | High (C:H) | Sensitive documents, embeddings, or user data belonging to other tenants can be retrieved. |
| Integrity | None (I:N) | The flaw does not modify data. |
| Availability | None (A:N) | The flaw does not crash or degrade service. |
| Authentication | None (PR:N) | No credentials are required; the attack is unauthenticated. |
| User Interaction | None (UI:N) | No user interaction needed; the attack can be automated. |
Practical consequences for affected environments include:
- Tenant data leakage – multi‑tenant SaaS platforms may expose all tenants’ data to a single malicious user.
- Regulatory non‑compliance – GDPR, HIPAA, or PCI‑DSS violations if protected data is exposed.
- Reputational damage – customers may lose trust in the platform.
- Potential for downstream attacks – leaked embeddings or metadata can be used to craft more targeted phishing or credential‑replay attacks.
- CVSS score: 7.5 (High) – indicates that the vulnerability is serious but not critical.
- Exploit complexity: Low – the attack requires only a crafted HTTP request.
- Authentication: None – the flaw is exploitable by any external actor.
- CISA KEV status: No – no known widespread exploitation yet, but the potential impact is high.
🛡️ Remediation & Mitigation
1. Patch / Upgrade
| Affected Version | Fix | Upgrade Recommendation |
|---|---|---|
| Spring AI 2.0.2.1 | Fixed in 2.0.3.0 – RedisFilterExpressionConverter now escapes *all* RediSearch special characters and automatically groups compound expressions. | Upgrade to Spring AI ≥ 2.0.3.0 as soon as possible. |
Action: Pull the latest Spring AI release from Maven Central (org.springframework.ai:spring-ai:2.0.3.0) and rebuild the application. Verify that thefilterfield is now sanitized.
2. Workarounds (if upgrade is not immediately possible)
| Technique | Implementation | ||||||
|---|---|---|---|---|---|---|---|
| Input sanitisation | Before passing the filter to RedisFilterExpressionConverter, run a whitelist filter that allows only alphanumeric characters and a safe subset of punctuation (e.g., -, _). Example in Java:<br>``java\nString safeFilter = filter.replaceAll("[^a-zA-Z0-9_\\-]", "");\n` | ||||||
| Explicit grouping | Wrap the entire filter string in parentheses to force the intended precedence:<br>`java\nString grouped = "(" + safeFilter + ")";\n` | ||||||
| WAF / ModSecurity rule | Block requests containing RediSearch operators in the filter field. Example ModSecurity rule:<br>`apache\nSecRule REQUEST_BODY "@rx @ | : | \\( | \\) | AND | OR | NOT" "id:1001,phase:2,deny,status:400,msg:'RediSearch injection attempt'\n`` |
| Rate limiting | Apply per‑tenant rate limits on the search endpoint to mitigate automated data harvesting. |
3. Detection
| Indicator | Log Pattern | How to Detect |
|---|---|---|
| Suspicious filter strings | @field:.* OR or @field:.* AND in request bodies | Search web server logs for filter= or JSON bodies containing @ followed by a word and OR/AND. |
| Unexpected tenant data | Query logs showing @tenant:123 OR @tenant:456 | Correlate with application logs that record the tenant ID used for the request. |
| High volume of search requests | Repeated POSTs to /search with complex filters | Use an IDS/IPS or SIEM to flag > 100 requests per minute from a single IP. |
⚠️ Urgency
[🤖 CVE Professor AI Security Engine]
FOFA Query