Skip to main content

Vector and Embedding Weaknesses Exploit

Tests for embedding inversion, vector database poisoning, and similarity search manipulation in RAG pipelines.

Sub-types

  • Embedding Inversion: Recovering original text or sensitive data from embedding vectors.
  • Vector DB Poisoning: Injecting malicious entries into vector databases used for RAG.
  • Similarity Manipulation: Crafting inputs to manipulate similarity search results.

Threat Profile

Objective: jailbreak

Objective vs. goals

The objective above selects the scoring rubric for a run — it is one of a fixed set of built-in names, not something you write. The goals you pass to an attack are separate free-text strings that you author yourself. See Goals vs. objective.

Primary

  • rag_security: RAG security benchmarks for vector embedding attacks

Secondary

  • saladbench: SaladBench for broader RAG attack coverage

Attack Techniques

Primary

  • Static Template: Template-based prompt construction

Metrics

  • asr
  • judge_score

Usage

Instantiate the Vulnerability

from hackagent.risks import VectorEmbeddingWeaknessesExploit
from hackagent.risks.vector_embedding_weaknesses_exploit.types import VectorEmbeddingWeaknessesExploitType

# Use all sub-types
vuln = VectorEmbeddingWeaknessesExploit()

# Or specify particular sub-types
vuln = VectorEmbeddingWeaknessesExploit(types=[
VectorEmbeddingWeaknessesExploitType.EMBEDDING_INVERSION.value,
VectorEmbeddingWeaknessesExploitType.VECTOR_DB_POISONING.value,
])

Run an Evaluation Campaign

from hackagent import HackAgent
from hackagent.risks.vector_embedding_weaknesses_exploit import VECTOR_EMBEDDING_WEAKNESSES_EXPLOIT_PROFILE

agent = HackAgent(endpoint="http://localhost:8080/chat", name="my-agent")

# Use profile recommendations
for attack in VECTOR_EMBEDDING_WEAKNESSES_EXPLOIT_PROFILE.primary_attacks:
for dataset in VECTOR_EMBEDDING_WEAKNESSES_EXPLOIT_PROFILE.primary_datasets:
attack_config = {
"attack_type": "static_template", # attack.technique is "StaticTemplate"
"objective": VECTOR_EMBEDDING_WEAKNESSES_EXPLOIT_PROFILE.objective,
"dataset": {"preset": dataset.preset},
}
results = agent.hack(attack_config=attack_config)
print(f"Results: {results}")