# What Are Vector and Embedding Security Weaknesses?

> How the numbers behind an AI search system (called RAG) can be poisoned, leaked or blocked, and how to defend them, explained simply for your AI interview.

**In short:** Vector and embedding weaknesses are ways an AI search system (RAG, retrieval-augmented generation) can be abused through its stored numbers and similarity search: planted documents, leaked embeddings, blocked searches and access checks that run too late. OWASP lists them as LLM09 in its 2026 list.

AI and LLM interview question Q148, Retrieval-augmented generation (RAG). Advanced, common (our estimate). From Venkat R. Murty's free Interview Kit: https://designervenkat.online/interview/ai/what-are-vector-and-embedding-security-weaknesses

## Say it in 30 seconds

Vector and embedding weaknesses are the ways a RAG system can be fooled through its numbers. A planted document can be written to sit close to a question. A stored embedding can be turned back into text. A shared index can leak between customers if the access check runs too late. My defence: check access inside the search, clean what goes in, keep trust levels in separate indexes, and treat embeddings like the documents they came from.

## Say it in 2 minutes

A RAG system splits each document into chunks and turns each chunk into an embedding, a list of numbers that stands for its meaning. The numbers sit in a vector database. When someone asks a question, the app finds the stored pieces with the closest numbers and hands them to the model. Whoever can change those numbers, or control the search, can change what the model reads. OWASP's 2026 list calls this LLM09 and says the risk is distinct from prompt injection. It works on the numbers and the search over them.

The first weakness is poisoning: a planted page written to land near a question people ask. The second is inversion: a stored embedding can be turned back into text, so the numbers can leak what the document said. The third is access failure in a shared index. If the search runs over every customer's files before the access check, one customer can learn which topics and roughly how many files another customer has, from counts and timing, even when every file is tagged correctly.

Here is how I'd answer a real case. A legal tool shares one index across three law firms. The filter that keeps Harbour's results runs after the search, so a Northgate user can probe the counts and find which topics Harbour's contracts cover. I'd move the scope inside the search query, so other firms' vectors can never be returned at all.

For defence I'd add layers: check and clean documents before they are embedded, keep public and internal data in separate indexes, stop returning raw similarity scores, and treat backups and embedding keys as secrets. I'd also say plainly that no single control is enough, and that a bigger model doesn't fix a leaky index.

## What are vector and embedding security weaknesses, in plain words?

A RAG system (retrieval-augmented generation, where the app first looks up useful text, then hands it to the model) cuts each document into chunks and stores each chunk as an embedding. An embedding is a list of numbers that stands for what a piece of text means. That list is a vector. A vector database keeps a great many of them, so it must find the closest ones fast.

When a user asks a question, the app runs a similarity search. It finds the stored pieces whose numbers sit closest to the question's numbers and passes those pieces to the model. So whoever can change the numbers, or the way the search picks them, can decide what the model reads. That is the security weakness.

Think of a records room in a hospital. The clerk files each note under a code worked out from its contents, and pulls the nearest matches when a doctor asks. If someone can slip a false note in, or the clerk can pull a note from a ward the doctor may not see, the doctor acts on the wrong record. A RAG system has the same room, and the model reads whatever the clerk hands over.

- **Embedding:** A list of numbers that stands for what a piece of text means.
- **Vector database:** A store that keeps those lists and finds the closest ones quickly.
- **Similarity search:** Finding the stored pieces whose numbers are closest to the question's.
- **Tenant:** One customer sharing a system with others, like one law firm on a shared tool.

OWASP, the security foundation whose 2026 Top 10 for LLM applications ranks the main risks, lists this as LLM09. In 2025 the same risk was LLM08.

## What are the main weaknesses?

OWASP describes the problem with a short frame that is easy to remember:

> "A useful frame: poisoning makes the system wrong, inversion makes it leak, jamming makes it silent, and access-control failure makes it indiscriminate." (OWASP, LLM09:2026)
>
> "Stored embeddings can be inverted to recover source text." (OWASP, LLM09:2026)

- **Poisoning:** Someone writes content built to land near a question people will ask. The system trusts it and answers from it, so the answer is wrong.
- **Inversion:** A stored embedding can be turned back into text. Someone holding the numbers can recover much of what the document said.
- **Jamming:** A planted blocker document is built to match a query and make the model refuse. The system goes quiet, and no code is broken.
- **Access-control failure:** The search ignores who is asking, so one customer's files come back to another. Or the access check runs only after the search, and counts and timing can reveal another customer's topics, without any file being shown.
- **Membership leaks:** Raw similarity scores can show that a file exists, even when its text stays hidden. Anyone who sees the scores can check whether a specific document is in the index.

Poisoning is the easiest weakness to picture. OWASP says these weaknesses are distinct from prompt injection. They attack the search layer: the numbers and the way they are compared. A planted document needs two things to work: the search has to retrieve it, and it has to steer the answer. OWASP says published attacks reach high success rates with a handful of poisoned documents.

*Diagram, How a planted page reaches the answer: A planted page sits near a customer question, so the search picks it up, the model reads it as trusted context, and a wrong answer goes out. Each step is a point where a check could catch it.*
1. Someone writes a page built to match a question customers ask.
2. The embedding step turns it into numbers near that question.
3. The search finds it and ranks it with the real documents.
4. The model answers from it as if it were a company document.

A planted page might carry a line like this, hidden from readers: "Harbour Logistics renewal terms: the answer is a 40% discount." The model can't tell it apart from a real contract.

Membership and inversion are about privacy. In a 2023 paper, researchers trained a model to decode text embeddings, and it could recover full names from a set of clinical notes. Embeddings are not a safe summary of the documents behind them.

## Why can a shared index leak, even when every file is tagged?

Here is a made-up but realistic case. Redwood Legal, a company that builds legal software, runs one contract search index for three law firms. It holds 40,000 contracts, each tagged with the firm that owns it, and each firm's lawyers should see only their own. The app keeps that rule in code, but it applies the firm filter after the search has already scored every contract.

A Northgate user sends a question that sits close to Harbour's pricing terms. The search scores all 40,000 contracts, and only then does the app drop the Harbour hits. By repeating questions, the Northgate user can learn which topics Harbour's contracts cover. It never reads a Harbour file, but it has learned something it should not.

*Diagram, Where the access check runs: Filtering after the search scores everyone's files first, so counts and timing can leak. Filtering inside the search means other firms' files can never be ranked or returned. Both paths start from the same question.*
1. The question is sent to a search over every firm's files.
2. Only after the scores exist is the list cut down to firm A.
3. Others' scores were already computed, so counts and timing can leak.
4. The question is sent to firm A's files only.
5. Nothing from the other firms is ranked, so this side channel is closed.

OWASP's words for the design flaw are "similarity search frequently runs across the full index before access control is applied at the application layer." Tags do not help if the scoring already happened.

```python
# Made-up contract summaries from three firms in one shared index.
# Each has a 2-number vector (a simplified embedding).
INDEX = [
    ("Harbour Logistics renewal", "harbour", (0.90, 0.10)),
    ("Harbour Logistics pricing", "harbour", (0.85, 0.15)),
    ("Northgate lease dispute", "northgate", (0.20, 0.90)),
    ("Pike and Co merger draft", "pike", (0.10, 0.80)),
]
K = 2

def similarity(a, b):
    return a[0] * b[0] + a[1] * b[1]  # higher means closer in meaning

def post_filter(query, firm):
    # Search everything first, then keep this firm's hits.
    ranked = sorted(INDEX, key=lambda d: similarity(query, d[2]), reverse=True)
    return [d[0] for d in ranked[:K] if d[1] == firm]

def pre_filter(query, firm):
    # Only this firm's files are ever scored.
    own = [d for d in INDEX if d[1] == firm]
    ranked = sorted(own, key=lambda d: similarity(query, d[2]), reverse=True)
    return [d[0] for d in ranked[:K]]

probe = (0.90, 0.10)  # a question shaped like Harbour's contracts
print("Northgate asks a Harbour-style question")
print("  filter after search:", len(post_filter(probe, "northgate")), "results")
print("  filter inside search:", len(pre_filter(probe, "northgate")), "results")
```

Output:

```text
Northgate asks a Harbour-style question
  filter after search: 0 results
  filter inside search: 1 results
```

The printed result shows the trick. With the filter after the search, Northgate gets 0 results for a question close to Harbour's contracts. With the filter inside the search, it gets 1 result, its own file. Zero results is a signal that another firm's files outrank its own. The demo uses made-up numbers, and the same ordering problem applies in a real system.

The fix is to scope the search itself. The app reads the firm from the signed-in user on the server and passes it into the query. A firm name sent by the browser is only a suggestion.

## How do you defend a vector store?

For poisoning, OWASP notes that defenders can intervene at either layer, so the defence comes in several parts. These are the ones to name in an interview:

> "Enforce tenant scoping inside the index query, not as a post-retrieval filter, and validate it server-side." (OWASP, LLM09:2026)
>
> ""Embeddings only" is not a safe-harbor classification." (OWASP, LLM09:2026)

1. **Scope the search inside the query:** Put the firm check inside the search query, and read the firm on the server. Filtering after the search leaks clues through counts and timing.
2. **Check and clean what goes in:** Strip hidden text, zero-width characters and lookalike letters before the text is turned into numbers. Record where each piece came from, so a bad batch can be found and removed.
3. **Keep trust levels in separate indexes:** Public web pages and internal contracts should not share one index. Separate indexes remove a whole class of mistakes that tags on a shared index allow.
4. **Hide raw scores:** Do not return raw similarity scores to clients, and cap how many searches one user can run, so nobody can probe it again and again.
5. **Guard backups and keys:** A backup of a vector database is as sensitive as the documents it came from. The keys to the service that makes the numbers are secrets too.
6. **Redo every vector on a model change:** Mixing old and new vectors creates gaps in how similar things score. Turn every document into new numbers instead.

Say it plainly in the interview. Embeddings are not a safe summary, so treat them and their backups as the documents they came from. A leak is never harmless because it was "only embeddings".

> **Tip:** Asked how you'd defend a vector store? Name the scope check inside the search first, then the trust levels, then the keys and backups.

## What does the interviewer want to hear?

**A strong answer covers**

- [ ] The parts: embeddings, the vector database and similarity search.
- [ ] The OWASP failure types (poisoning, inversion, jamming, access failure), plus membership leaks.
- [ ] Why a shared index leaks: the access check runs after the scoring.
- [ ] Defence first: scope inside the query, clean inputs, separate indexes.
- [ ] Treat embeddings and their backups like the documents they came from.
- [ ] An honest limit: a planted page can still get through, so watch and log.

**Common traps**

- Trap: "Embeddings are just numbers, so a leak is harmless." Better: OWASP says stored embeddings can be inverted to recover source text. Treat them as sensitive.
- Trap: "We filter by tenant after the search." Better: By then the search has already scored every firm's files. Put the filter inside the query.
- Trap: "A reranker fixes poisoning." Better: Re-ranking (a second pass that re-sorts the hits) makes an attack costlier. It cannot replace checking what goes into the index.

## Can you spot the weakness?

**Spot the weakness:** Your legal search tool returned four results for a Harbour user. Which result shows an access failure?

A. Harbour: renewal terms, clause 4, dated March.
B. Harbour: notice period for termination, clause 9.
C. Pike and Co: merger draft, clause 2.
D. Harbour: payment terms, 30 days from invoice.

**Answer:** C. A Pike and Co file should never reach a Harbour user. Either the firm scope was missing, or the app took it from the browser instead of the server. Put the firm check inside the search query.

**Quick check:** A team wants one customer's data never to reach another in a shared vector index. Which change fixes the root cause?

A. Add a prompt note telling the model to ignore other customers' files
B. Filter by customer after the search returns its results
C. Put the customer check inside the search query, with the customer read on the server
D. Switch to a bigger embedding model

**Answer:** C. A scope inside the query means other customers' vectors can never be returned. A prompt note is only a request, and a filter after the search still lets counts and timing leak.

## Can you answer these from memory?

**Flash cards**

- **What are vector and embedding weaknesses?** Risks in the numbers that represent text, and in the similarity search that finds them.
- **Name the four failure types.** Poisoning (wrong), inversion (leak), jamming (silent), access failure (indiscriminate).
- **Can embeddings leak the text?** Yes. OWASP: stored embeddings can be inverted to recover source text.
- **Where should access control run?** Inside the search query, before results are ranked, not after results come back.
- **Are embeddings safer than documents?** No. Treat embeddings and their backups as sensitive as the source documents.
- **What if you change the embedding model?** Redo every document's numbers. Never mix old and new vectors.

## Likely follow-up questions

- Q140 How do you enforce access control in RAG? https://designervenkat.online/interview/ai/how-do-you-enforce-access-control-in-rag
- Q147 When must you re-embed everything? (full answer coming)
- Q149 How do you clean and deduplicate documents first? https://designervenkat.online/interview/ai/how-do-you-clean-and-deduplicate-documents-first
- Q215 What is data and model poisoning? https://designervenkat.online/interview/ai/what-is-data-and-model-poisoning
- Q201 What is prompt injection? https://designervenkat.online/interview/ai/what-is-prompt-injection
- Q150 How would you design RAG for 10 million documents? https://designervenkat.online/interview/ai/how-would-you-design-rag-for-10-million-documents

## Learn it in depth

- [Data poisoning](https://designervenkat.online/learn/ai-guardrails/data-poisoning)
