← All briefings
MEDIUMJan 20267 min readModel TheftEmbeddings

Embedding Inversion Attacks on Production Vector DBs

LogicLeak Research · Published Jan 2026

Embedding vectors are widely treated as opaque numerical representations — a compact encoding that captures semantic meaning without preserving the original text. This assumption is incorrect. Under specific conditions, embedding vectors can be inverted to recover a close approximation of the original text, enabling adversaries to reconstruct proprietary documents, training data, or sensitive records from nothing more than API access to an embedding endpoint.

How Inversion Works

Embedding inversion is not a single technique — it is a family of attacks that exploit the information-preserving properties of high-dimensional vector spaces. The most practical variant for production systems is the nearest-neighbour inversion attack. An attacker who can query the embedding API submits a large corpus of candidate texts, collects their embeddings, and builds a lookup table. When they obtain a target embedding — either from a leaked vector store export or by querying the system with inputs designed to retrieve specific vectors — they search the lookup table for the nearest neighbour.

For general-domain text with short documents, this attack achieves high reconstruction accuracy. For proprietary domain text — specialised legal language, medical records, internal policy documents — the attack is limited by the attacker's ability to construct a relevant candidate corpus. However, an attacker with knowledge of the domain (a former employee, a competitor with industry familiarity) can dramatically reduce the search space.

# Conceptual reconstruction attack
# Attacker has obtained a batch of target embeddings from a leaked
# vector store snapshot

def reconstruct_document(target_embedding, embedding_api, candidate_corpus):
    # Step 1: Embed the candidate corpus
    candidate_embeddings = [
        (text, embedding_api.embed(text))
        for text in candidate_corpus
    ]

    # Step 2: Find nearest neighbour by cosine similarity
    best_match = max(
        candidate_embeddings,
        key=lambda x: cosine_similarity(target_embedding, x[1])
    )

    # Step 3: Use match as seed for iterative refinement
    # (mutate text, re-embed, select improvements)
    return iterative_refinement(best_match[0], target_embedding, embedding_api)

# With a well-constructed candidate corpus, similarity > 0.97
# is achievable for short documents in narrow domains

The Production Attack Surface

// WARNING

Most RAG systems expose an indirect embedding oracle: if the system returns retrieved document excerpts, an attacker can work backwards from excerpt content to infer what other documents are present in the same semantic neighbourhood. This is a lower-fidelity version of the inversion attack but requires no access to raw vectors.

The more acute risk is vector store export leakage. Many organisations routinely export vector databases for backup, migration, or analytics. These exports contain raw embedding vectors. If the export lands in an insufficiently secured S3 bucket — a common occurrence — an attacker with the export and access to the same embedding model can execute a full inversion attack offline.

Mitigations

Rate-limit and authenticate your embedding API. An unauthenticated, unlimited embedding endpoint allows adversaries to build arbitrarily large candidate corpora. Requiring authentication and enforcing per-key rate limits raises the cost of corpus construction significantly.

Treat vector store exports as sensitive data. Apply the same access controls and encryption requirements to vector store exports that you apply to the source documents. A vector export of your legal document corpus is as sensitive as the documents themselves.

// NOTE

If you use a third-party embedding provider, review their data retention and model training policies. Embeddings submitted to a third-party API may be used to improve the provider's model, creating an indirect channel through which your proprietary content influences a publicly available model.

For highly sensitive corpora, consider embedding-space perturbation: adding calibrated noise to embeddings before storage that preserves retrieval accuracy above a threshold but degrades inversion attack fidelity. This is an active research area and not yet a commercially available control, but implementations exist in academic literature.

// Related briefings