Cognitive

Part 6 · LLM Application Security

LLM09: Vector and Embedding Weaknesses

Similarity search becomes part of the trust boundary whenever it decides what a model gets to read.

3 min readBuilds on Embeddings, Retrieval-Augmented Generation

OWASP LLM09. This material is for defense. Only test systems you own or are authorized to test.

Tenant isolation must be enforced inside the vector search itself.

What it is

Vector and embedding weaknesses affect any system that converts content into embeddings and uses similarity search to choose what the model sees. That includes RAG, vector-backed agent memory, semantic caches, and deduplication pipelines.

These weaknesses exploit the embedding layer itself: how content is stored, separated, ranked, and retrieved.

How the attack unfolds

A filter applied after retrieval is too late. Tenant scope must be part of the index query.

Figure 38.1. A filter applied after retrieval is too late. Tenant scope must be part of the index query.

Main weaknesses

WeaknessWhat happens
Cross-tenant leakageOne customer's content is retrieved for another
Retrieval manipulationCrafted content ranks highly for chosen queries
Embedding inversionOriginal text is partly reconstructed from vectors
Semantic cache poisoningA bad answer is reused for similar questions
Hidden document contentInvisible text is indexed but unseen by reviewers

Defenses

Controls protect what enters the index and what it returns.
  1. Scope inside the query. Enforce tenancy and permissions in the index itself.
  2. Control access per chunk. One document can contain a confidential paragraph.
  3. Normalize before embedding. Remove zero-width characters and hidden text.
  4. Track provenance. Record each embedding's source so bad batches can be removed.
  5. Separate trust tiers. Keep untrusted and verified sources apart.
  6. Protect embeddings. Treat vectors as sensitive derived data.

Common misconception

Common belief

"Embeddings are just numbers, so they are not sensitive."

In practice

Research has shown that much of the original text can sometimes be recovered from embeddings.

Key takeaways

  • Similarity search can cross tenant or permission boundaries.
  • Enforce access control inside the query.
  • Treat embeddings as sensitive derived data.