CVE-2026-59415 — Spring AI (2.0.3) — CWE-74
TypesenseVectorStore is vulnerable to a document ID injection in its delete operation that can cause unintended documents to be deleted. TypesenseVectorStore.doDelete(List<String>) builds a Typesense filter_by expression by raw string concatenation of caller-supplied document IDs into the form id: [id1,id2,...] . The Typesense id field uses bare (unquoted) values in this list form with no escaping mechanism. An ID containing characters with syntactic meaning in the Typesense filter grammar — such as a comma ( , ), a closing bracket ( ] ), or operator tokens ( || , && ) — can break out of the list literal and alter the structure of the filter expression. An attacker who controls a document ID passed to the delete operation can use this to delete documents other than the intended ones (comma injection), or to construct a filter that matches every document in the collection (operator breakout), resulting in unintended bulk deletion. Applications that pass externally supplied or user-controlled document IDs to VectorStore.delete(List<String>) backed by TypesenseVectorStore are affected.
TypesenseVectorStore is vulnerable to a document ID injection in its delete operation that can cause unintended documents to be deleted. TypesenseVectorStore.doDelete(List<String>) builds a Typesense filter_by expression by raw string concatenation of caller-supplied document IDs into the form id: [id1,id2,...] . The Typesense id field uses bare (unquoted) values in this list form with no escaping mechanism. An ID containing characters with syntactic meaning in the Typesense filter grammar — such as a comma ( , ), a closing bracket ( ] ), or operator tokens ( || , && ) — can break out of the list literal and alter the structure of the filter expression. An attacker who controls a document ID passed to the delete operation can use this to delete documents other than the intended ones (comma injection), or to construct a filter that matches every document in the collection (operator breakout), resulting in unintended bulk deletion. Applications that pass externally supplied or user-controlled document IDs to VectorStore.delete(List<String>) backed by TypesenseVectorStore are affected.
🎯 What is this vulnerability?
Vulnerability name: Document‑ID injection in TypesenseVectorStore delete()
CVE‑ID: CVE‑2026‑59415
CVSS v3.1: 10.0 (AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H)
Technical flaw
TypesenseVectorStore.doDelete(List<String> ids) builds a Typesense filter_by expression by concatenating the caller‑supplied IDs directly into a string that is later sent to the Typesense HTTP API:
// Pseudo‑code extracted from the library
String filter = "id: [" + String.join(",", ids) + "]";
httpClient.post("/collections/" + collectionName + "/documents/delete",
Map.of("filter_by", filter)); The Typesense query language expects a list literal of bare* identifiers, e.g. id: [abc,def].
- The library does not escape or quote the individual IDs.
- Consequently, any ID that contains a character that has syntactic meaning in the filter grammar (
,,],||,&&,:…) can break out of the list literal and alter the overall filter expression. - CWE‑20 – Improper Input Validation – the library accepts raw IDs without validation.
- CWE‑74 – Injection (Improper Neutralization of Special Elements) – the unescaped IDs are interpreted as part of the query language.
Resulting effects:
| Input pattern | How it breaks the filter | ||
|---|---|---|---|
evil,foo | Turns the list into two separate entries → deletes evil and foo. | ||
x] | * | Closes the list early (]) and injects a logical OR that matches *all* documents (*). | |
id1&&id2 | Injects an AND operator that can be combined with other conditions supplied by the attacker. |
Because the delete endpoint is unauthenticated in the sense that the library does not enforce any additional authorisation checks beyond the caller’s own permissions, an attacker who can supply a document ID to VectorStore.delete() can cause arbitrary document deletions, including mass deletion of the entire collection.
Relevant CWE(s):
The CVSS vector reflects the fact that the vulnerability is network‑reachable, low‑complexity, requires no authentication, and impacts all three CIA triad components (confidentiality, integrity, availability) with a scope change (the deletion affects the whole collection, not just the supplied IDs).
⚡ Attack Chain
Below is a realistic, step‑by‑step exploitation scenario. All commands are illustrative; the exact HTTP path (/collections/<name>/documents/delete) and parameter name (filter_by) are taken from the public Typesense API documentation, which matches the behaviour described in the CVE. If a different route is used by a particular integration, the same principle applies.
1. Discovery & Reconnaissance
| Step | Activity | Tools / Evidence |
|---|---|---|
| 1.1 | Identify that the target application uses TypesenseVectorStore (e.g., by inspecting JavaScript bundles, package.json, or server‑side logs). | npm ls typesense / grep -R "TypesenseVectorStore" |
| 1.2 | Determine the collection name and whether the application exposes a *delete* API that forwards the supplied IDs to VectorStore.delete(). | Intercept traffic with Burp Suite or OWASP ZAP; look for POST requests containing a JSON body like { "ids": ["..."] }. |
| 1.3 | Verify that the delete endpoint does not require authentication (or that the attacker can obtain a valid API key). | Send a test request with an empty or dummy API key; observe HTTP 200/202 response. |
| 1.4 | Confirm that the backend uses the unescaped concatenation pattern (e.g., by sending a benign ID containing a comma and observing the generated filter in the server logs, or by reading the open‑source library source). | curl -X POST https://example.com/api/delete -H "Content-Type: application/json" -d '{"ids":["a,b"]}' and watch server logs for filter_by=id: [a,b]. |
2. Exploitation
Goal A – Delete a specific additional document (comma injection)
# Payload: inject a second ID after a comma
curl -s -X POST https://victim.example.com/api/delete \
-H "Content-Type: application/json" \
-d '{"ids":["target-id,steal-id"]}'Result: The library builds filter_by=id: [target-id,steal-id], causing both target-id and steal-id to be removed.
Goal B – Delete all documents (operator breakout)
# Payload: close the list and inject a logical OR that matches everything
curl -s -X POST https://victim.example.com/api/delete \
-H "Content-Type: application/json" \
-d '{"ids":["any-id]||*"]}'Explanation of the injected filter
id: [any-id]||* → list ends after "any-id", then "||*" is parsed as
(id = any-id) OR (match all documents)Because the Typesense API treats * as a wildcard that matches every document, the final filter evaluates to true for every record, resulting in a full collection wipe.
Goal C – Blind exploitation (no direct feedback)
If the API returns only a generic success code, the attacker can probe for success by checking the document count before and after the request (if an endpoint such as /collections/<name>/stats is exposed) or by observing side‑effects in the application UI.
3. Post‑exploitation
In a multi‑tenant SaaS deployment, an attacker controlling a single tenant’s ID list could wipe the entire shared collection, affecting all other tenants (hence the Scope: Changed in the CVSS vector).
🌍 Real‑World Impact
| CIA | CVSS Sub‑Score | Practical consequence |
|---|---|---|
| Confidentiality (C:H) | 10.0 | Deleting documents may expose the fact that certain data existed (e.g., by observing “no results” after deletion) and can be combined with other leaks to reconstruct data lineage. |
| Integrity (I:H) | 10.0 | The vector store’s index is corrupted; downstream ML pipelines produce wrong outputs, potentially leading to business‑logic errors (e.g., recommending inappropriate content). |
| Availability (A:H) | 10.0 | Complete loss of the collection renders the service unusable until a backup is restored. Recovery may require costly re‑indexing of the original source data. |
Business impact examples
🛡️ Remediation & Mitigation
1. Patch / Upgrade
| Action | Details |
|---|---|
| Upgrade | Apply the vendor‑released fix that sanitises each ID (e.g., quoting or escaping special characters) before constructing the filter_by string. The exact version number is not disclosed in the public CVE; monitor the official TypesenseVectorStore repository or vendor advisory for a version marked *≥ X.Y.Z* that includes the fix. |
| Back‑port | If you cannot upgrade immediately, patch the library locally: replace the concatenation with a safe builder that validates each ID against a whitelist (e.g., ^[A-Za-z0-9_-]+$). |
2. Immediate Workarounds
| Technique | Implementation | |||||
|---|---|---|---|---|---|---|
| Input validation | Reject any ID that contains characters , ] | && : * or any whitespace. Example (Java):<br><br>if (!id.matches("^[A-Za-z0-9_-]+$")) throw new IllegalArgumentException("Invalid ID"); | ||||
| Escaping / quoting | Encode each ID as a quoted string before joining: filter = "id: [" + ids.stream().map(i -> "\\""+i+"\\"").collect(Collectors.joining(",")) + "]"; (Typesense accepts quoted literals). | |||||
| Least‑privilege API keys | Generate a Typesense API key that only has delete permission on a *single* collection and rotate it frequently. | |||||
| WAF rule (ModSecurity example) | Detect a filter_by parameter that contains a closing bracket ] followed by logical operators ( | or &&).<br><br>``SecRule ARGS:filter_by "@rx \] *(\ | \ | &&)" "id:100001,phase:2,deny,log,msg:'Potential Typesense filter injection'"` | ||
| Rate‑limit delete calls | Limit the number of delete requests per minute per API key to mitigate bulk‑wipe attempts. | |||||
| Audit logging | Log every call to the delete endpoint with the raw filter_by` value and the authenticated user/API key. |
3. Detection – Indicators of Compromise
| Log source | Typical pattern | ||||
|---|---|---|---|---|---|
| Web server access log | POST /api/delete 200 with a JSON body containing "] | *" or a comma‑separated list longer than expected. | |||
| Typesense server log | filter_by=id: [.*\] | .*] – a filter that contains a closing bracket followed by | or &&. | ||
| Application audit log | “Deleted N documents from collection <name>” where *N* is unusually high (e.g., > 1000) or equals the total document count. | ||||
| Metrics / monitoring | Sudden drop in document_count metric for a collection (e.g., Grafana alert on > 90 % decrease within 5 minutes). |
Set up SIEM correlation rules that trigger on the combination of a delete API call and a rapid decrease in document count.
⚠️ Urgency
If the vulnerable component is exposed to the internet (e.g., a public API), treat it as an emergency and temporarily block the delete endpoint until a proper fix is in place.
Bottom line: The flaw is a classic injection caused by raw string concatenation of user‑controlled identifiers into a Typesense filter expression. Because the delete operation is highly privileged and the injection can turn a targeted delete into a full‑collection wipe, the vulnerability warrants immediate remediation, strict input validation, and robust monitoring.
[🤖 CVE Professor AI Security Engine]
FOFA Query