Vector Database Poisoning and Embedding Inversion Attacks

Two attacks on RAG retrieval, one corrupts answers, the other leaks text.

· 8 min read
Cover illustration for “Vector Database Poisoning and Embedding Inversion Attacks”
Emerging Vulnerabilities · November 8, 2026 · 8 min read · 1,855 words

Vector database poisoning and embedding inversion attack the same part of a RAG pipeline for different ends. Poisoning corrupts what the system retrieves and says. Inversion exposes the private text its vectors encode. Defending against either requires treating retrieval as a security boundary and matching each control to the access or trust assumption the attack exploits.

Why the retrieval layer of a RAG pipeline is a distinct and underdefended attack surface

Xu et al.'s RAG security survey frames the central problem as securing access to external knowledge. Retrieval-augmented generation improves an LLM by fetching evidence from an outside corpus when it answers a request. That means the model's output depends on more than its parameters and the user's prompt. The knowledge base, retrieval mechanism, and access path now influence the answer. Each adds a place where trust can fail.

Most RAG implementations treat the vector database as trustworthy. That assumption is architectural. It gives external content influence over generation without requiring any change to the model or the user-visible prompt. Prompt-only security thinking does not cover this added boundary. OWASP's Top 10 for LLM Applications recognized that gap by adding Vector and Embedding Weaknesses, absent from its 2023 edition, as LLM08:2025, renumbered LLM09:2026, alongside prompt injection and sensitive information disclosure.

How the two attack classes divide the threat — integrity versus confidentiality

Vector database poisoning attacks integrity by changing the content or vectors in the store so that retrieval and generation do what an attacker wants. Embedding inversion attacks confidentiality by reconstructing source content from its vector representation. The survey maps poisoning to S1, knowledge poisoning, and inversion to S4, knowledge extraction, within four attack surfaces and four corresponding defense layers. Filtering suspicious documents may help with the first but does nothing to stop reconstruction from stolen embeddings, so the mechanics need separate treatment, beginning with poisoning.

Diagram: Two Attacks, Two Threats: Poisoning vs. Inversion. Visualizes: Show two parallel attack paths targeting the RAG retrieval layer, contrasting their goals and what they compromise.

How vector database poisoning works and why query-agnostic variants are especially dangerous

An attacker can write to it directly or supply a pre-poisoned dataset, without touching the model, user prompt, or application layer. The malicious documents serve two purposes. They appear relevant enough to be retrieved, then induce an attacker-chosen response once the model receives them. Zou et al.'s PoisonedRAG, presented at USENIX Security 2025, demonstrated that a small number of malicious texts can be enough to steer outputs.

Li et al.'s Black-Hole Attack removes the need to anticipate specific queries. It places a small number of malicious vectors near the geometric center of the stored vectors. The paper calls the underlying property centrality-driven hubness, where vectors near that center become nearest neighbors of a disproportionately large number of other vectors. That region is nearly empty in practice. Injected vectors therefore attract retrieval across most queries, appearing among the top-ranked results without query-specific tailoring. The attack can severely impair RAG performance without changing the downstream LLM, while existing hubness mitigations offer limited protection or significantly reduce retrieval accuracy.

Confundo (2026) takes the next step by learning to survive the pipeline itself. It fine-tunes a poison generator to produce texts that withstand preprocessing, reranking, and paraphrasing, with configurable goals including factual manipulation, opinion manipulation, and induced hallucinations. Those transformations are no longer dependable obstacles. InceptionRAG (2026) goes further by placing the poison in interactions between documents. Its attacks still succeed at a high rate when benign passages outnumber adversarial content by a factor of four, even with the isolation-based defense AVFilter in place.

The PIDP-Attack paper (2026) combines database poisoning with prompt injection. Poisoned documents steer retrieval, while a separately appended query-path suffix injects instructions into the LLM's reasoning process. The two entry points reinforce one exploit chain. A defense focused only on stored documents can therefore miss a second influence arriving through the query path.

How embedding inversion works and what it costs a system in confidentiality terms

A leaked vector backup is not merely a leak of unreadable numbers. OWASP LLM09:2026 says it should be treated as a breach of the underlying documents. That puts it into breach assessment and notification decisions, rather than allowing teams to dismiss it as anonymized data. The guidance cites research that found inversion can recover 50–70% of the original input words when vectors are compromised. Compression does not make text safely anonymous.

Vec2Text treats reconstruction as a controlled generation problem. It proposes text, embeds that proposal, measures its distance from the stolen target vector, and repeats the process toward convergence. The attacker does not need the embedding model's weights. Training needs text-embedding pairs, which someone who can query a public embedding API can get.

An unknown embedding model adds a hurdle, but not necessarily a barrier. An Embedding Inference Attack can identify it when the attacker has the document collection and a set of candidate models. Systems that use public documents and open-source models or public APIs can meet those conditions. Singh et al. describe another way data can leak: someone who eavesdrops on vector search queries can rebuild sensitive personal data from the embeddings they intercept. For multi-tenant SaaS, weak store-level access controls make this risk worse because one confidentiality failure can leak data across customer boundaries.

How infrastructure defaults and supply-chain vulnerabilities give attackers the access both attacks require

These attacks depend on access, whether to write poison or read embeddings. Production infrastructure can make that prerequisite surprisingly easy to meet. Chroma, Qdrant, Milvus, and Weaviate ship with authentication disabled by default. UpGuard's 2025 survey found over a thousand Chroma databases that could be reached over the internet, with roughly one-third letting people read live data without logging in. Those exposures required no exploit at all.

Wang et al.'s LLM supply chain study also shows how attackers can get in through vulnerable components. CVE-2025-64513 in Milvus, rated CVSS 9.3, allowed unauthenticated full administrative access through a single HTTP header. CVE-2025-68664 in LangChain Serialization, also rated CVSS 9.3, provided an indirect route. The chain started with an lc-keyed structure injected into LLM output, then used downstream deserialization to extract secrets and expose vector database credentials.

Spring AI's April 2026 vulnerabilities add filter-expression and document-ID injection against vector stores through CVE-2026-40967 and CVE-2026-40978, plus cross-tenant memory leakage through conversation IDs in CVE-2026-40966. The access path need not start at the database. The study found vulnerabilities concentrated in application and model integration layers, with a large fraction of exposed LLM services affected by at least one remotely exploitable vulnerability. Most of those vulnerabilities were critical or high severity. Attackers still have a way in if teams protect the store but ignore the framework that holds its credentials.

Why the dominant defense strategy — detect and filter poisoned content — is fragile against adaptive attackers

Detection and filtering assume that poison can be recognized before it influences generation. Adaptive attackers work directly against that assumption. Confundo trains its payloads to survive the transformations meant to make retrieved content safer. InceptionRAG instead makes the harmful effect depend on documents appearing together. A document-by-document filter is looking at the wrong unit of behavior for that attack.

The survey describes this gap as three mismatches. The signal mismatch means fluent, relevant, corpus-fitting poison can evade defenses that look for anomalies. The stage mismatch means knowledge-base attacks outnumber defenses at that same entry layer. The target mismatch means attacks in the survey's T2 category outpace corresponding defenses and evaluation frameworks.

There is a limit to the pessimistic case. An attack optimized for one corpus may fail against another, so research results do not establish universal success. But an attacker who knows the target can tailor poison to it, so corpus composition affects security. Filters can still contribute evidence. The architectural task is to limit what hostile content can control even when a detector fails to recognize it.

What defenses actually address the structural threat at each layer of the pipeline

To address that trust problem, a pipeline must separate external data from instructions with authority. StruQ puts privileged user instructions and external data in separate logical channels, which blocks indirect poisoning-based injection at that boundary. CaMeL proposes a dual-model architecture in which a protected model plans control flow and a restricted model extracts data. Retrieved content loses the right to direct execution.

Moradi et al.'s CEG-RAG framework (2026) uses internal activations from a cross-encoder reranker to identify high-risk chunks, then filters and replaces them before generation. In tests across MS MARCO, NQ, and HotpotQA, it cut attack success by an average of 88.74%. Hybrid BM25 and vector retrieval adds another obstacle by requiring gradient-guided attackers to optimize for both sparse and dense retrieval signals, though attackers who do so can partially circumvent it.

Geometric attacks also call for a geometric signal. Semantic drift monitoring maintains a baseline of cosine-similarity distributions and alerts when KL divergence exceeds a threshold, indicating a statistical shift in the embedding space. This can detect query-agnostic poisoning such as the Black-Hole Attack, which distorts the geometric center. Recovery needs a clean state as well. Embedding versioning provides the basis for rolling back after poisoning, rather than leaving the team without an untainted version to restore.

Confidentiality requires controls on who can obtain embeddings. Rate limiting embedding retrieval constrains mass extraction, with bulk reads serving as a signal against normal low-volume application queries. Embedding stores also need the same access controls, encryption at rest, and data classification policies as their source documents. Tenant isolation must exist inside the store. Hard per-tenant separation, including row-level separation where applicable, addresses cross-customer exposure that application-layer filtering alone cannot contain.

Turning on authentication for default-open stores blocks anonymous access that could let attackers write poison or extract vectors. Store-level access restrictions likewise protect both integrity and confidentiality, while control-data separation and drift monitoring focus on poisoning.

What the retrieval layer threat means for how a RAG system should be tested and audited

A standard application penetration test does not cover this boundary by default. Fuzzing API endpoints and checking for SQL injection will not establish whether a knowledge base can be poisoned, embeddings can be inverted, or tenants are separated inside the store. Retrieval needs an explicit testing scope. That scope requires whitebox access to the corpus composition, embedding pipeline, and retrieval configuration. Blackbox testing alone cannot establish whether the centroid region is exploitable, model inference is feasible under the relevant assumptions, or tenant namespace separation is enforced.

Testing must also follow how documents enter the system. Poisoning arrives through ingestion, so third-party datasets and the ingest pipeline belong in scope. Multi-tenant isolation needs to be tested directly inside the vector store because flaws in the framework can expose conversation memory even when the application logic looks correct. The audit has to examine the boundary that actually separates customer data.

Finally, the corpus does not stand still. Documents are added, updated, and removed, so a point-in-time assessment can become stale within days. Continuous scanning of ingestion is the logical extension of that audit, much as pull-request scanning extends a code security review. The security program then tests both whether outside content can gain authority and whether private content encoded in vectors can leak out. Neither question is answered by showing that the model handles a suspicious prompt well.

Sources

  1. Securing Retrieval-Augmented Generation: A Taxonomy of Attacks, Defenses, and Future Directions
  2. Can You Trust the Vectors in Your Vector Database? Black-Hole Attack from Embedding Space Defects
  3. Demystifying LLM Supply Chain Vulnerabilities in the Wild: Distribution, Root Cause, and Real-World Impact
  4. Shifting from Injection to Interaction: Rethinking Web Security in the Age of LLMs and Beyond

More in Emerging Vulnerabilities