esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • AI papersPages
  • Interview KitPages
  • Book a callContact
  • Download ResumeContact
Let’s talk

I’ll build the agent for it.

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.

13 min readAdvancedCommon · estimateFacts checked 26 November 2026

Say it out loud

Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.

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.

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.

Key words

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.

How a planted page reaches the answer

Planted web page

written to sit near a target question

Turned into numbers

lands close to the question

Search picks it up

ranked near the top

Model

reads it as trusted context

Wrong answer

a wrong fee quoted to a customer

  1. 1Someone writes a page built to match a question customers ask.
  2. 2The embedding step turns it into numbers near that question.
  3. 3The search finds it and ranks it with the real documents.
  4. 4The model answers from it as if it were a company document.
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.

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.

Where the access check runs

Firm A asks a question

one question, one firm

Filter after search

Search all 40,000

scores every firm's files

Keep firm A's hits

done after the scores exist

Filter inside search

Search firm A's files

other firms' files never ranked

Other firms' traces leak

counts and scores give hints

Only A's files ranked

nothing of B's is touched

  1. 1The question is sent to a search over every firm's files.
  2. 2Only after the scores exist is the list cut down to firm A.
  3. 3Others' scores were already computed, so counts and timing can leak.
  4. 4The question is sent to firm A's files only.
  5. 5Nothing from the other firms is ranked, so this side channel is closed.
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.

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

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. 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. 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. 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. 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. 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. 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."

    BetterOWASP says stored embeddings can be inverted to recover source text. Treat them as sensitive.

  • Trap"We filter by tenant after the search."

    BetterBy then the search has already scored every firm's files. Put the filter inside the query.

  • Trap"A reranker fixes poisoning."

    BetterRe-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?

Quick check

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

Can you answer these from memory?

Flash cards · tap a card to flip it

1 / 6

What will they ask next?

  1. Q140How do you enforce access control in RAG?11 min
  2. Q147When must you re-embed everything?Coming soon
  3. Q149How do you clean and deduplicate documents first?11 min
  4. Q215What is data and model poisoning?13 min
  5. Q201What is prompt injection?12 min
  6. Q150How would you design RAG for 10 million documents?12 min

Learn it in depth

Last updated on 26 November 2026

Building search over private or shared files?

I design and build AI products and agents, including the system behind the search and the access rules around it. Book a short call and tell me what your index holds and who should see what.