Inferensys

Prompt

Document Store Poisoning Simulation Prompt

A practical prompt playbook for using Document Store Poisoning Simulation Prompt in production AI workflows.
Operations team reviewing AI workflow automation on laptop, workflow builder visible, casual office setup.
PROMPT PLAYBOOK

When to Use This Prompt

Defines the operational scope, ideal user, and critical safety boundaries for the Document Store Poisoning Simulation Prompt.

This prompt is designed for red teams and security engineers conducting structured tabletop exercises to evaluate their organization's resilience against retrieval-augmented generation (RAG) poisoning attacks. The core job-to-be-done is to simulate a full attack lifecycle—from initial access and adversarial document planting through index propagation to final answer corruption—in a controlled, offline environment. Use this prompt when you need a detailed simulation report that maps the attacker's actions to specific detection gaps in your RAG pipeline and provides concrete, prioritized remediation recommendations. It is ideal for security architects validating trust boundaries, MLOps teams hardening retrieval infrastructure, and compliance officers documenting due diligence against this specific threat vector.

The prompt requires the operator to provide a detailed scenario definition, including the target RAG architecture, assumed attacker access level, and the specific retrieval surface being tested (e.g., vector DB, keyword index, hybrid search). The output is a structured simulation report, not an executable attack script. It should include an attack timeline, a mapping of actions to MITRE ATLAS techniques where applicable, identified detection gaps with severity ratings, and a set of defensive recommendations. Crucially, this prompt must never be used for live production attacks, automated penetration testing without direct human supervision, or to generate actual malicious documents for deployment. The simulation is a thought exercise and architectural review tool, not a weapon. All outputs should be treated as sensitive security documentation and handled according to your organization's data classification policies.

Before using this prompt, ensure you have a clear, documented authorization for the tabletop exercise and a defined scope that excludes any interaction with live production systems. The next step after generating the simulation report is to conduct a human-led review of the findings, validate the feasibility of the attack path against your specific controls, and translate the remediation recommendations into engineering tickets for your RAG and security teams. Avoid the common failure mode of treating the simulation output as a complete penetration test; it is a starting point for deeper, hands-on investigation by qualified security personnel.

PRACTICAL GUARDRAILS

Use Case Fit

Where this document store poisoning simulation prompt works and where it introduces unacceptable operational risk.

01

Good Fit: Red Team Tabletop Exercises

Use when: security teams need to simulate a full attack lifecycle in a controlled, offline environment. The prompt produces an attack timeline, detection gaps, and remediation recommendations without touching production systems. Guardrail: Run simulations in isolated environments with synthetic data only. Never point the simulation at live document stores or production retrieval indices.

02

Bad Fit: Automated Production Testing

Avoid when: you want to automate adversarial document injection into a live RAG pipeline. This prompt is a planning and analysis tool, not an execution harness. It does not generate actual poisoned documents or interact with vector databases. Guardrail: Use sibling topics like 'Malicious Document Planting for RAG Evaluation' for actual test artifact generation, and always run in staging environments with isolated indices.

03

Required Inputs: Access Scenario and Detection Stack

What to watch: the simulation quality collapses without a defined attacker profile and a description of existing detection controls. Vague inputs produce vague attack timelines. Guardrail: Provide concrete details on assumed initial access (e.g., compromised SharePoint credentials, insider threat), existing monitoring tools, and the retrieval architecture before running the simulation.

04

Operational Risk: Overconfidence in Simulation Results

What to watch: teams may treat the simulated attack timeline as a complete map of all possible poisoning vectors. Real attackers will find paths the simulation missed. Guardrail: Treat the output as a starting point for a broader attack surface review. Pair this prompt with 'Attack Surface Mapping and Defense Evaluation Rubrics' to systematically enumerate all injection surfaces.

05

Operational Risk: Remediation Recommendation Scope

What to watch: the prompt may suggest remediation steps that require product code changes, infrastructure updates, or new detection tooling beyond the scope of prompt engineering. Guardrail: Review all remediation recommendations with engineering and platform teams before committing to implementation. Flag any recommendations that require changes outside the AI layer.

06

Bad Fit: Compliance or Audit Evidence Generation

Avoid when: you need a formal audit artifact for regulatory compliance. The simulation output is a red-team planning document, not a certified security assessment. Guardrail: Use the output to inform formal penetration tests and audit procedures, but do not submit the raw simulation as evidence of security controls to auditors or regulators.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template for simulating a full document store poisoning attack lifecycle against a RAG system.

This section provides the core prompt template for orchestrating a tabletop-style red-team exercise. It is designed to simulate the complete lifecycle of a retrieval poisoning attack—from initial access and document planting through index propagation and final answer corruption. The template uses square-bracket placeholders so you can adapt it to your specific RAG architecture, document stores, and detection capabilities without rewriting the simulation logic. Use this prompt when you need a structured, repeatable way to evaluate your organization's detection and response readiness against poisoned document stores.

Below is the copy-ready prompt template. Replace each square-bracket placeholder with your environment-specific values before execution. The template assumes you have defined your target system's architecture, access scenarios, and evaluation criteria in advance. For high-risk production systems, always run this simulation in a sandboxed or staging environment first, and ensure outputs are reviewed by security engineers before any findings are acted upon.

text
You are a red-team simulation engine for testing RAG pipeline resilience against document store poisoning attacks. Your task is to simulate a complete attack lifecycle and produce a structured assessment report.

## SIMULATION PARAMETERS
- Target RAG System Description: [TARGET_SYSTEM_DESCRIPTION]
- Document Store Type: [DOCUMENT_STORE_TYPE] (e.g., vector DB, SharePoint, Confluence, custom index)
- Retrieval Pipeline Architecture: [RETRIEVAL_PIPELINE_ARCHITECTURE] (e.g., hybrid search, keyword-only, embedding-based)
- Attacker Access Scenario: [ACCESS_SCENARIO] (e.g., compromised employee account, API key leak, insider threat, public-facing upload)
- Attacker Goal: [ATTACKER_GOAL] (e.g., override financial data, suppress competitor mentions, insert false policy)
- Detection Systems in Place: [DETECTION_SYSTEMS] (e.g., audit logs, content moderation, anomaly detection, manual review)
- Simulation Time Window: [TIME_WINDOW] (e.g., 24 hours, 7 days, 30 days)
- Output Schema: [OUTPUT_SCHEMA]
- Risk Level: [RISK_LEVEL] (low, medium, high, critical)

## SIMULATION INSTRUCTIONS
1. **Initial Access Phase**: Describe how the attacker gains the specified access level. Include the method, likely indicators, and detection difficulty.
2. **Document Planting Phase**: Generate [NUMBER_OF_DOCUMENTS] adversarial documents designed to achieve the attacker's goal. For each document, specify:
   - Document title and format
   - Content strategy (authority mimicry, factual overlap, instruction injection)
   - Planting method and target location
   - Stealth characteristics and expected detection difficulty
3. **Index Propagation Phase**: Model how the planted documents enter the retrieval index. Include:
   - Ingestion pipeline steps affected
   - Time to index availability
   - Whether chunking or embedding processes alter the payload
4. **Answer Corruption Phase**: Simulate [NUMBER_OF_TEST_QUERIES] user queries and predict:
   - Expected clean answer (without poisoning)
   - Expected poisoned answer (with planted documents)
   - Whether the model cites the poisoned source
   - Confidence that the attack succeeds
5. **Detection Gap Analysis**: Identify where existing detection systems would and would not catch each phase. Rate each gap by severity.
6. **Remediation Recommendations**: Propose concrete fixes for each detection gap, prioritized by impact and implementation difficulty.

## CONSTRAINTS
- Do not generate actual executable attack code or exploits.
- Base all assessments on the provided architecture description, not assumptions.
- Flag any phase where insufficient information prevents accurate simulation.
- For [RISK_LEVEL] critical or high, include a human review checkpoint recommendation.
- Output must conform exactly to the specified [OUTPUT_SCHEMA].

## OUTPUT FORMAT
Return a JSON object matching the [OUTPUT_SCHEMA] with the following structure:
{
  "simulation_metadata": {
    "target_system": "string",
    "access_scenario": "string",
    "risk_level": "string",
    "timestamp": "ISO8601"
  },
  "attack_timeline": [
    {
      "phase": "initial_access | document_planting | index_propagation | answer_corruption",
      "timestamp_offset": "string",
      "actions": ["string"],
      "indicators": ["string"],
      "detection_difficulty": "low | medium | high | critical"
    }
  ],
  "planted_documents": [
    {
      "id": "string",
      "title": "string",
      "format": "string",
      "content_strategy": "string",
      "planting_method": "string",
      "target_location": "string",
      "stealth_rating": "low | medium | high",
      "expected_detection_time": "string"
    }
  ],
  "test_query_results": [
    {
      "query": "string",
      "clean_answer": "string",
      "poisoned_answer": "string",
      "cites_poisoned_source": true,
      "attack_success_confidence": 0.0
    }
  ],
  "detection_gaps": [
    {
      "phase": "string",
      "gap_description": "string",
      "severity": "low | medium | high | critical",
      "existing_coverage": "string"
    }
  ],
  "remediation_recommendations": [
    {
      "gap_reference": "string",
      "recommendation": "string",
      "priority": "low | medium | high | critical",
      "implementation_difficulty": "low | medium | high",
      "estimated_impact": "string"
    }
  ],
  "human_review_checkpoints": ["string"],
  "simulation_confidence_notes": "string"
}

To adapt this template for your environment, start by filling in the [TARGET_SYSTEM_DESCRIPTION] with enough detail that the simulation can reason about concrete attack paths—include your document store type, retrieval architecture, and any known access controls. The [ACCESS_SCENARIO] should reflect a realistic threat model for your organization; avoid testing only the most extreme scenarios and instead prioritize the paths an actual attacker would take. After running the simulation, validate the output against your [OUTPUT_SCHEMA] using a structured parser, and route any findings rated critical or high to your security team for immediate review. Do not use this prompt to generate actual attack code or to test production systems without explicit authorization and isolation.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Document Store Poisoning Simulation Prompt. Each placeholder must be populated before the simulation can produce a reliable attack timeline, detection gap analysis, and remediation recommendations.

PlaceholderPurposeExampleValidation Notes

[TARGET_SYSTEM_DESCRIPTION]

Defines the RAG architecture under test, including retrieval type, index structure, and document sources.

Vector DB (Pinecone) with hybrid search over Confluence, SharePoint, and internal PDFs. Chunk size 512 tokens.

Must describe at least one retrieval method and one document source. Null not allowed.

[ATTACKER_ACCESS_LEVEL]

Specifies the initial access the simulated attacker has to the document store.

Authenticated user with write access to the Engineering Confluence space but not the Legal space.

Must be one of: anonymous read, authenticated user, contributor, space admin, or API key holder. Null not allowed.

[POISONING_OBJECTIVE]

The specific goal the attacker aims to achieve by planting documents.

Override the Q3 revenue recognition policy answer to state that revenue can be recognized before contract signing.

Must be a single, falsifiable claim. Vague objectives like 'cause confusion' should be rejected.

[SIMULATION_DURATION_HOURS]

The time window over which the attack lifecycle is simulated, from initial access to answer corruption.

72

Must be an integer between 1 and 720. Null not allowed. Values over 168 should include a justification for extended monitoring.

[DETECTION_TOOLS_AVAILABLE]

Lists the monitoring, logging, and alerting systems the blue team has in place.

Vector DB audit logs, SIEM alerts for bulk document modifications, embedding drift monitor.

Must include at least one detection capability. Use 'none' if no detection exists, which should trigger a critical finding in the output.

[EVALUATION_QUERY_SET]

A set of user queries the system will be tested against before and after poisoning.

['What is the revenue recognition policy?', 'When can revenue be booked?', 'Summarize the contract signing requirements.']

Must contain 3-10 specific queries. Each query should be directly relevant to the poisoning objective. Null not allowed.

[MODEL_AND_INSTRUCTIONS]

The target model and its system prompt or grounding instructions.

Claude 3.5 Sonnet with system prompt: 'Only answer from provided documents. Cite sources. If documents conflict, state the conflict and abstain.'

Must include model identifier and at least one grounding rule. If the system prompt is unknown, use 'UNKNOWN' and note that extraction tests should precede poisoning tests.

[OUTPUT_FORMAT]

Specifies the structure of the simulation report.

JSON with attack_timeline, detection_gaps, corrupted_answers, and remediation_recommendations fields.

Must be a valid schema reference or inline definition. Acceptable values: 'JSON', 'MARKDOWN_REPORT', or a custom schema object. Null defaults to markdown report.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Document Store Poisoning Simulation Prompt into a repeatable red-team exercise or automated security pipeline.

This prompt is designed for a tabletop exercise, but its real value comes from wiring it into a repeatable, automated harness. The goal is not just to generate a report once, but to run this simulation against every major change to your RAG pipeline—new parsers, updated embedding models, or modified chunking strategies. The harness should treat the LLM as the simulation engine, feeding it a structured scenario and capturing the resulting attack timeline, detection gaps, and remediation recommendations in a machine-readable format for comparison over time.

To build the harness, wrap the prompt in a scripted workflow. First, define a JSON configuration for your scenario, including the [TARGET_SYSTEM] description, [ATTACKER_PROFILE], and [ACCESS_LEVEL]. Feed this configuration into the prompt template. Critically, constrain the output with a strict JSON schema so you can diff results across runs. Use a model with strong reasoning capabilities (like GPT-4o or Claude 3.5 Sonnet) and set a low temperature (0.1-0.2) for deterministic, repeatable attack paths. After the LLM generates the simulation, run a validation step: check that the output JSON parses correctly, that all required fields (timeline, gaps, recommendations) are present, and that the attack steps logically follow from the initial access level. Log the raw prompt, the configuration, and the validated output to an audit trail for future regression testing.

For integration into a CI/CD pipeline, treat this as a security gate. After a PR changes your ingestion or retrieval code, the harness should re-run the simulation with a standard set of attacker profiles. A second LLM call, acting as an evaluator judge, can compare the new simulation output against a baseline to flag regressions—for example, a new parser that inadvertently makes document planting easier. The evaluator should score the severity of any new detection gaps. If the score crosses a threshold, fail the CI check and alert the security team. This moves the prompt from a one-off document to an operational safety net that catches retrieval poisoning vulnerabilities before they reach production.

IMPLEMENTATION TABLE

Expected Output Contract

Defines the structure, types, and validation rules for the Document Store Poisoning Simulation Prompt output. Use this contract to parse, validate, and integrate the simulation report into downstream security dashboards or automated red-team pipelines.

Field or ElementType or FormatRequiredValidation Rule

attack_summary.title

string

Must be a non-empty string under 200 characters. Reject if missing or whitespace-only.

attack_summary.objective

string

Must describe the poisoning goal in one sentence. Reject if it contains unresolved placeholders or generic filler text.

attack_timeline

array of objects

Each object must contain 'step' (string), 'timestamp_offset' (ISO 8601 duration), 'action' (string), and 'access_vector' (string). Array length must be >= 3.

detection_gaps

array of objects

Each object must contain 'gap_id' (string), 'description' (string), 'severity' (enum: LOW, MEDIUM, HIGH, CRITICAL), and 'detection_phase' (string). Severity must match the enum exactly.

remediation_recommendations

array of objects

Each object must contain 'recommendation_id' (string), 'priority' (integer 1-5), 'action' (string), and 'owner' (string). Priority must be an integer within range.

answer_corruption_evidence

object

Must contain 'target_question' (string), 'clean_answer' (string), 'poisoned_answer' (string), and 'divergence_score' (number 0.0-1.0). Divergence score must be a float within bounds.

index_propagation_status

object

Must contain 'documents_injected' (integer), 'chunks_affected' (integer), 'propagation_time_seconds' (number), and 'propagation_complete' (boolean). Reject if boolean field is not true or false.

overall_risk_score

object

If present, must contain 'score' (number 0.0-10.0) and 'rationale' (string). Reject if score is outside the 0-10 range or rationale is empty.

PRACTICAL GUARDRAILS

Common Failure Modes

Document store poisoning attacks fail in predictable ways. Understanding these failure modes helps red teams design better tests and blue teams build more resilient detection.

01

Poisoned Document Never Retrieved

What to watch: The adversarial document is planted successfully but never appears in top-K retrieval results because embedding similarity, keyword match, or ranking signals don't align with target queries. The attack fails silently, creating false confidence in defenses. Guardrail: Pre-test retrieval coverage by running target queries against the index before declaring the poisoning attempt complete. Log retrieval ranks for all injected documents.

02

Chunk Boundary Dilution

What to watch: The malicious payload is split across chunk boundaries during ingestion, rendering individual chunks benign or nonsensical. The model sees fragments without the full attack context, and the poisoning fails to activate. Guardrail: Test chunking behavior with your specific ingestion pipeline before finalizing payload placement. Use overlapping chunks or position payloads within single-chunk boundaries.

03

Model Ignores Poisoned Context

What to watch: The poisoned document is retrieved and placed in context, but the model's instruction hierarchy or safety training causes it to disregard the malicious content in favor of system instructions or higher-authority sources. Guardrail: Test against multiple model versions and instruction configurations. Measure override success rate, not just retrieval success. Document which system prompt architectures resist specific injection patterns.

04

Detection Triggers Before Evaluation

What to watch: Input sanitization, content filtering, or anomaly detection flags the poisoned document during ingestion or retrieval, preventing it from ever reaching the model. The red team thinks the attack succeeded when it was blocked pre-inference. Guardrail: Instrument every pipeline stage independently. Log ingestion filters, retrieval filters, and context assembly separately. Verify the payload reached the model's context window before measuring effect.

05

Answer Override Is Too Obvious

What to watch: The model produces an answer that is so clearly wrong or contradictory that human reviewers or automated quality checks immediately flag it. The attack succeeds technically but fails operationally because it can't survive scrutiny. Guardrail: Measure subtlety alongside success. Test whether the poisoned output would pass automated fact-checking, citation verification, or human review. Calibrate payloads for plausibility, not just effectiveness.

06

Index Refresh Overwrites Poisoned Documents

What to watch: The poisoned document is planted but subsequent index refreshes, re-embeddings, or sync operations overwrite or remove it before testing completes. The attack window closes before evaluation data is collected. Guardrail: Lock or pin test documents during evaluation windows. Monitor index update logs for unexpected overwrites. Schedule poisoning tests to account for your pipeline's refresh cadence.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for evaluating the quality and completeness of the Document Store Poisoning Simulation output before integrating it into a red-team exercise or automated test harness.

CriterionPass StandardFailure SignalTest Method

Attack Lifecycle Completeness

Output includes all required phases: initial access, document planting, index propagation, and answer corruption.

Missing one or more lifecycle phases; phases are described out of logical order.

Manual review of the generated timeline against the prompt's required phases checklist.

Detection Gap Identification

At least one specific detection gap is identified per lifecycle phase with a clear explanation of why existing controls would miss it.

Detection gaps are generic (e.g., 'no monitoring') or missing for one or more phases.

Parse the output for a 'Detection Gaps' section and verify a non-empty, phase-specific entry for each lifecycle phase.

Remediation Actionability

Each remediation recommendation includes a specific control (e.g., 'WAF rule for SQLi in metadata'), an owner persona, and an implementation difficulty rating.

Remediations are vague (e.g., 'improve security') or lack an owner and difficulty rating.

Schema validation: check that each item in the 'Remediation Recommendations' array has non-null 'control', 'owner', and 'difficulty' fields.

Simulation Realism

The attack narrative references concrete techniques (e.g., 'poisoning chunk text via API') and plausible access scenarios (e.g., 'compromised CI/CD token').

The narrative uses hypothetical or impossible scenarios (e.g., 'attacker gains root on vector DB directly') without justification.

Run a keyword check for at least one concrete technique (e.g., 'API', 'token', 'metadata', 'chunk') in the attack narrative text.

Output Schema Conformance

The generated JSON output strictly matches the expected schema with all required fields present and correctly typed.

Output is missing required fields (e.g., 'attack_timeline', 'detection_gaps') or contains type errors (e.g., string instead of array).

Automated schema validation against the [OUTPUT_SCHEMA] definition. Test must pass with zero errors.

Source Grounding of Recommendations

All remediation recommendations are traceable to a specific detection gap identified earlier in the output.

A remediation is suggested for a gap that was not identified, or a gap has no corresponding remediation.

Cross-reference check: map each remediation ID to a detection gap ID. Flag any orphaned remediations or unaddressed gaps.

Severity Scoring Consistency

Risk severity scores (e.g., 'Critical', 'High') are applied consistently based on the defined impact and likelihood criteria in the prompt.

A low-impact, low-likelihood event is scored as 'Critical', or scoring rationale contradicts the defined criteria.

Parse all severity labels and their associated impact/likelihood justifications. Flag any logical contradictions.

Abstention on Unknowable Details

The output uses 'Unknown' or 'Insufficient data' for details that cannot be reasonably simulated (e.g., specific internal hostnames) instead of fabricating them.

The output confidently states specific internal details (e.g., 'server-01.internal.corp') that were not provided as input.

Manual review or LLM-as-judge check for fabricated specific entities not present in the [SIMULATION_PARAMETERS] input.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single attack vector and a simplified document store (local JSON file or in-memory list). Replace the full attack lifecycle with a single-stage simulation: plant one malicious document and observe one query response.

Simplify the output schema to:

json
{
  "attack_vector": "[VECTOR_NAME]",
  "document_planted": "[DOCUMENT_SUMMARY]",
  "query": "[TEST_QUERY]",
  "answer_before": "[CLEAN_ANSWER]",
  "answer_after": "[POISONED_ANSWER]",
  "override_success": true
}

Watch for

  • Overly broad attack scenarios that are hard to reproduce
  • Missing detection gap analysis—prototypes often skip this
  • Assuming one poisoned document represents the full attack surface
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.