Inferensys

Prompt

Attack Surface Enumeration Prompt Template

A practical prompt playbook for using the Attack Surface Enumeration Prompt Template to systematically map injection entry points, trust boundaries, and data flow paths in production AI systems.
Data scientist building training data pipeline on laptop, data preprocessing visible, technical workspace.
PROMPT PLAYBOOK

When to Use This Prompt

A guide for AI security architects to systematically map every prompt injection entry point before adversarial testing begins.

This prompt is designed for AI security architects and red-team engineers who need to produce a structured, exhaustive map of an AI system's attack surface before launching any adversarial testing campaign. The primary job-to-be-done is to move from a vague understanding of 'the system has prompts' to a concrete, auditable inventory of every trust boundary, data flow, and injection surface. This includes direct user inputs, system prompts, retrieved documents, tool outputs, multi-turn conversation state, and any other data that influences model behavior. The ideal user is someone who can read an architecture diagram or system design document and translate it into the structured fields this prompt requires, such as [SYSTEM_ARCHITECTURE_DESCRIPTION] and [DATA_FLOW_DIAGRAM_NOTES].

You should use this prompt at the very start of a red-team engagement, during the design phase of a new AI feature, or as part of a periodic security audit of an existing production system. The output is not a list of attack payloads; it is a pre-attack reconnaissance map. It forces you to identify where instructions originate, which components trust which data sources, and where an attacker could inject malicious content. For example, a RAG system's attack surface isn't just the user prompt; it includes the vector database, the web scraper that populates it, and the summarization tool that processes retrieved chunks. This prompt ensures none of those are overlooked. Do not use this prompt to generate actual injection strings or to evaluate the severity of a specific vulnerability; pair it with the sibling fuzzer and evaluation prompts in this content group for those downstream tasks.

The required context is a detailed technical understanding of the target system. You cannot use this prompt effectively with only a product marketing description. You need to provide concrete details about prompt assembly order, tool definitions, retrieval pipelines, and multi-turn state management. If you lack this information, the first step is to gather it from the engineering team. The output will be a structured enumeration that serves as the index for your entire red-team campaign. After generating this map, your next action should be to use it to prioritize attack vectors and select the appropriate fuzzing harnesses, such as the 'Indirect Injection Test Case Generator' for retrieved content or the 'Tool Misuse Scenario Generator' for agent tool calls. A common failure mode is treating this as a one-time artifact; the attack surface changes with every prompt update, model upgrade, or new tool integration, so this enumeration must be versioned and reviewed alongside the system it describes.

PRACTICAL GUARDRAILS

Use Case Fit

Where this prompt works and where it does not. Attack surface enumeration requires deep system access and architectural context; it is not a black-box test.

01

Good Fit: Internal Architecture Review

Use when: your team owns the full AI stack and can provide detailed system architecture diagrams, prompt flow definitions, tool contracts, and trust boundary documentation. The prompt excels at systematically mapping injection surfaces across complex multi-agent or RAG pipelines.

02

Bad Fit: External Black-Box Probing

Avoid when: you lack internal documentation or are testing a third-party API with no visibility into its prompt architecture. The prompt requires explicit trust boundary and data flow inputs; without them, it will hallucinate plausible but unvalidated attack surfaces.

03

Required Inputs: Architecture Artifacts

Risk: garbage-in, garbage-out enumeration. Guardrail: provide concrete inputs including a system prompt, tool definitions, data flow diagrams, and trust boundary descriptions. The prompt uses these to produce a grounded enumeration rather than generic vulnerability lists.

04

Operational Risk: Over-Confidence in Completeness

Risk: teams treat the enumerated list as exhaustive and stop looking. Guardrail: always pair automated enumeration with manual review by a security architect. The prompt identifies known patterns but can miss novel injection surfaces or business-logic-specific trust violations.

05

Operational Risk: Sensitive Architecture Exposure

Risk: the prompt output itself becomes a sensitive document mapping all injection points. Guardrail: treat the enumeration output as confidential security documentation. Store it in access-controlled repositories and never pass it to untrusted models or third-party services.

06

Integration: Feeds Red-Team Harness Design

Use when: you are building an automated red-team harness and need a structured attack surface map to guide fuzzer configuration. The enumeration output can be parsed to generate targeted injection payloads for each identified surface, improving coverage over random fuzzing.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A copy-ready prompt for systematically enumerating all prompt injection surfaces, trust boundaries, and data flow paths in an AI system.

This template is the core of your attack surface review. It instructs the model to act as a security architect and produce a structured enumeration of every point where untrusted data enters the prompt assembly process. The output is designed to be machine-readable so you can feed it directly into downstream risk scoring, fuzzing harness configuration, or a defense coverage matrix. Before using this prompt, you should have a clear architectural diagram or description of your AI system's data flows, including retrieval sources, tool outputs, user input channels, and any multi-agent handoff points.

code
You are an AI security architect conducting a systematic attack surface review. Your task is to enumerate every point where untrusted data can enter the prompt assembly process for the system described below.

## SYSTEM DESCRIPTION
[SYSTEM_DESCRIPTION]

## INSTRUCTIONS
1. Identify every injection surface where external data enters the prompt, including:
   - Direct user messages
   - Retrieved documents or chunks from [RETRIEVAL_SOURCES]
   - Tool outputs from [TOOL_LIST]
   - Agent-to-agent handoff messages
   - System prompt variables populated from external sources
   - Few-shot examples loaded from [EXAMPLE_SOURCES]
   - Memory or conversation history from [MEMORY_SOURCES]
   - Metadata, headers, or configuration injected at runtime
2. For each surface, describe:
   - The data source and its trust level (untrusted, semi-trusted, internal)
   - The injection vector type (direct, indirect, stored, reflected)
   - The prompt component it flows into (system, developer, user, tool, assistant)
   - Whether the data passes through any sanitization or validation before prompt assembly
3. Identify trust boundaries where data crosses from one trust zone to another.
4. Flag any blind spots where injection could occur but is not currently monitored.

## OUTPUT FORMAT
Return a JSON object with the following structure:
{
  "system_summary": "Brief description of the analyzed system",
  "injection_surfaces": [
    {
      "surface_id": "unique identifier",
      "data_source": "source description",
      "trust_level": "untrusted | semi-trusted | internal",
      "injection_vector": "direct | indirect | stored | reflected",
      "target_prompt_component": "system | developer | user | tool | assistant",
      "sanitization_applied": true or false,
      "sanitization_detail": "description of any sanitization",
      "risk_notes": "any additional risk context"
    }
  ],
  "trust_boundaries": [
    {
      "boundary_id": "unique identifier",
      "from_zone": "source trust zone",
      "to_zone": "destination trust zone",
      "crossing_surfaces": ["surface_id references"],
      "controls_in_place": ["list of controls"]
    }
  ],
  "blind_spots": [
    {
      "description": "unmonitored injection path",
      "severity": "high | medium | low",
      "recommendation": "suggested remediation"
    }
  ],
  "coverage_assessment": {
    "total_surfaces": number,
    "surfaces_with_sanitization": number,
    "high_risk_unprotected": number,
    "completeness_confidence": "high | medium | low"
  }
}

## CONSTRAINTS
- Do not speculate about system components not described in the system description.
- If the system description is incomplete for a full analysis, note this in blind_spots rather than guessing.
- Prioritize completeness over brevity. Missing a surface is worse than flagging a low-risk one.
- For each surface, assume an attacker with full knowledge of the system architecture.

To adapt this template, replace the square-bracket placeholders with your actual system details. The [SYSTEM_DESCRIPTION] should be a thorough architectural summary covering all data flows, not a one-line product description. For [RETRIEVAL_SOURCES], list every knowledge base, vector store, or document source that feeds into RAG pipelines. For [TOOL_LIST], enumerate every API, function, MCP server, or external service the agent can call. For [EXAMPLE_SOURCES] and [MEMORY_SOURCES], identify where few-shot demonstrations and conversation history are stored and loaded from. If any of these are empty, explicitly state that to avoid the model hallucinating surfaces. After running this prompt, validate the output by checking that every surface you know about appears in the list, and that the coverage_assessment.completeness_confidence matches your own assessment. For high-risk systems, have a second reviewer compare the output against your architecture diagram before feeding results into a fuzzing harness or risk register.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Attack Surface Enumeration Prompt Template. Each placeholder must be populated before execution to ensure the model produces a structured, complete enumeration of injection surfaces, trust boundaries, and data flow paths.

PlaceholderPurposeExampleValidation Notes

[SYSTEM_ARCHITECTURE_DESCRIPTION]

Describes the AI system's components, data flows, and integration points to be analyzed

A customer support copilot with a system prompt, RAG pipeline over 3 knowledge bases, a ticket creation tool, and a sentiment classifier

Must be non-empty and contain at least 3 distinct components. Parse check: reject if input is under 50 characters or lacks component names

[TRUST_BOUNDARY_DEFINITIONS]

Defines which components, data sources, and user roles are trusted, untrusted, or semi-trusted

User input: untrusted. Knowledge base articles: semi-trusted. System prompt: trusted. Tool outputs: untrusted

Must classify at least 5 surfaces. Schema check: each entry requires a name and trust level from the set {trusted, untrusted, semi-trusted}

[INJECTION_SURFACE_CATEGORIES]

Specifies the categories of injection surfaces to enumerate

Direct user input, retrieved documents, tool outputs, multi-turn conversation state, few-shot examples, system prompt metadata

Must contain at least 4 categories. Schema check: each category must be a non-empty string. Null allowed if using default categories

[OUTPUT_SCHEMA]

Defines the required structure for each enumerated surface entry

{"surface_name": string, "category": string, "trust_level": string, "data_flow_path": string, "attack_vector_examples": [string], "current_defenses": [string], "risk_severity": string}

Must be valid JSON schema. Parse check: JSON.parse must succeed. Schema check: required fields must include surface_name, category, trust_level, and risk_severity

[DATA_FLOW_DIAGRAM_TEXT]

Textual description of how data moves between components, including transformations and trust changes

User input -> input sanitizer -> classifier -> system prompt assembly -> LLM -> output filter -> user. Retrieved docs -> RAG context assembler -> system prompt assembly

Must describe at least 3 sequential steps. Parse check: reject if no arrow indicators or sequential language detected

[KNOWN_DEFENSIVE_CONTROLS]

Lists existing security controls, sanitizers, output filters, and monitoring systems already in place

Input sanitizer: regex-based injection pattern detection. Output filter: canary token check. Monitoring: response similarity to system prompt

Must list at least 2 controls. Schema check: each control requires a name and mechanism description. Null allowed if no controls exist

[BLIND_SPOT_HINTS]

Optional hints about areas the security team suspects are under-analyzed or where previous incidents occurred

We had an incident where base64-encoded instructions in user uploads bypassed the sanitizer. Multi-turn attacks are untested

Null allowed. If provided, must be a non-empty string. Validation: log presence of hints for coverage gap analysis in eval stage

[SEVERITY_RUBRIC]

Defines how risk severity should be assigned to each enumerated surface

Critical: no defenses, direct path to system prompt. High: partial defenses, known bypass techniques exist. Medium: defenses present but untested. Low: multiple defensive layers, actively monitored

Must define at least 3 severity levels with concrete criteria. Schema check: each level requires a name and distinguishing condition

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Attack Surface Enumeration prompt into an automated security review pipeline or manual architecture workflow.

This prompt is designed to be used as a structured analysis step within a broader AI security review process, not as a one-off chat interaction. The output is a machine-readable enumeration of injection surfaces, trust boundaries, and data flows that should feed into downstream risk scoring, fuzzing campaign configuration, and defense evaluation rubrics. In an automated harness, you would invoke this prompt programmatically with a system architecture description, model configuration, and tool definitions as input, then validate the structured output before passing it to subsequent analysis stages.

To integrate this into an application, wrap the prompt in a function that accepts a [SYSTEM_DESCRIPTION] object containing the model's role, instruction hierarchy, available tools, data sources, and trust boundaries. The function should call the LLM with response_format set to the defined JSON schema and a low temperature (0.0–0.2) for deterministic enumeration. After receiving the response, run a validation layer that checks: (1) the JSON parses correctly against the expected schema, (2) every enumerated surface includes a trust_boundary and data_flow_direction field, (3) no surface is listed without an associated injection_vector example, and (4) the coverage_gaps array is non-empty, indicating the model recognized its own blind spots. If validation fails, retry once with an error message injected into the prompt context explaining which field was missing or malformed. Log every enumeration result with a unique review_id for audit trails and regression comparison when the system architecture changes.

For high-risk production systems, do not treat this prompt's output as the final authority. Route the validated enumeration to a human review queue where a security architect can confirm, reject, or augment each surface. Store the reviewed enumeration as the canonical attack surface baseline. When the system prompt, tool set, or data pipeline changes, re-run this prompt and diff the output against the baseline to detect new injection surfaces or trust boundary shifts. Wire the diff into your CI/CD pipeline as a pre-release gate: if new, unreviewed surfaces appear, block the deployment until a human signs off. Avoid using this prompt on systems where the architecture is not fully documented—garbage-in, garbage-out applies, and missing context will produce a false sense of coverage.

IMPLEMENTATION TABLE

Expected Output Contract

Fields, types, and validation rules for the structured attack surface enumeration response. Use this contract to parse, validate, and store the model output before downstream analysis.

Field or ElementType or FormatRequiredValidation Rule

attack_surface_id

string (UUID v4)

Must match UUID v4 regex. Generate if missing.

entry_point_name

string

Non-empty string, max 255 characters. Must be unique within the response array.

entry_point_type

enum: direct_input | retrieved_document | tool_output | system_prompt_override | conversation_history | few_shot_example | schema_definition | external_api_response | file_upload | metadata_field

Must be one of the enumerated values. Reject unknown types.

trust_boundary

enum: untrusted | low_trust | medium_trust | high_trust | fully_trusted

Must be one of the enumerated values. Flag 'fully_trusted' for human review.

injection_risk

enum: critical | high | medium | low | none

Must be one of the enumerated values. 'critical' entries must include a non-empty risk_rationale.

risk_rationale

string

Required if injection_risk is 'critical' or 'high'. Max 500 characters.

data_flow_path

string

Non-empty string describing the path from entry to model processing. Max 1000 characters.

existing_controls

array of strings

Array must contain at least one item. Each item max 200 characters. Empty array triggers a retry.

blind_spot_identified

boolean

Must be true or false. If true, blind_spot_description is required.

blind_spot_description

string

Required if blind_spot_identified is true. Max 500 characters.

remediation_priority

integer (1-5)

Must be an integer between 1 and 5 inclusive. 1 is highest priority.

confidence_score

number (0.0-1.0)

Must be a float between 0.0 and 1.0 inclusive. Scores below 0.7 trigger a human review flag.

PRACTICAL GUARDRAILS

Common Failure Modes

When enumerating attack surfaces, these failures undermine coverage and create blind spots. Each card pairs a common failure with a concrete guardrail.

01

Trust Boundary Blindness

What to watch: The prompt treats all input channels as equally trusted, missing injection surfaces where data crosses trust boundaries (user input vs. retrieved documents vs. tool outputs vs. system state). Guardrail: Explicitly enumerate every data source and label its trust level before mapping attack paths. Require the output to group surfaces by trust zone.

02

Coverage Completeness Drift

What to watch: The enumeration misses entire categories (indirect injection via tools, multi-turn state manipulation, encoding obfuscation) because the prompt lacks explicit category scaffolding. Guardrail: Provide a mandatory taxonomy of injection categories in the prompt and require the model to address each category or explicitly mark it as not applicable with reasoning.

03

Over-Confidence in Absence

What to watch: The model confidently declares no attack surface exists for a category without adequate reasoning, creating false negatives that skip testing. Guardrail: Require evidence or architectural justification for any surface marked as absent. Add an eval check that flags empty categories with insufficient rationale.

04

Data Flow Path Truncation

What to watch: The enumeration stops at direct input-to-model paths and misses multi-hop flows where data passes through retrieval, tools, memory, or agent loops before reaching the model. Guardrail: Require the prompt to trace data lineage end-to-end, including intermediate processing steps, storage, and retrieval points. Validate with a completeness check against known system architecture.

05

Output Format Inconsistency

What to watch: The model produces unstructured or inconsistently structured output that can't be parsed by downstream automation, breaking the fuzzing harness integration. Guardrail: Enforce a strict output schema with required fields for surface name, trust level, injection category, data source, and risk rating. Validate parseability before accepting results.

06

Static Snapshot Staleness

What to watch: The enumeration reflects the system as described at one point in time and misses surfaces introduced by feature flags, new tool integrations, model updates, or prompt changes. Guardrail: Version-lock the enumeration to a specific system architecture revision. Schedule re-enumeration triggers on architecture changes, new tool additions, or prompt template updates.

IMPLEMENTATION TABLE

Evaluation Rubric

Criteria for evaluating the quality and completeness of the attack surface enumeration output before it is used to configure a red-team pipeline. Each row defines a pass standard, a failure signal, and a concrete test method.

CriterionPass StandardFailure SignalTest Method

Trust Boundary Completeness

All system, user, tool, and data boundaries are explicitly listed with their direction and privilege level.

Missing a known boundary such as the tool-output-to-prompt path or the retrieval-pipeline-to-LLM path.

Compare the output list against a manually maintained architecture diagram. Flag any boundary in the diagram absent from the output.

Entry Point Granularity

Each injection surface is described as a specific interface (e.g., 'user chat input', 'PDF text layer', 'MCP tool argument') rather than a vague category.

Entry points are described generically, such as 'user input' or 'documents', without specifying the exact data flow.

Parse the output for generic surface names. Fail if more than one entry point lacks a specific interface or protocol description.

Data Flow Path Traceability

For each entry point, the output traces the full path to the model's context, including any pre-processing, retrieval, or augmentation steps.

A data flow path is truncated or ends at a component like 'vector database' without showing how the data reaches the prompt.

Select a random sample of 3 entry points and verify that the path ends at the model's context window. Fail if any path is incomplete.

Privilege and Trust Context

Each surface is annotated with the trust level of the data source (e.g., 'untrusted external user', 'trusted internal tool', 'semi-trusted partner API').

A surface from an untrusted source, such as a user-uploaded file, is incorrectly labeled as trusted or has no trust label.

Check that every entry point has a non-null trust label. Fail if any label is missing or if an external user source is labeled 'trusted' without justification.

Blind-Spot Identification

The output includes a dedicated section listing potential blind spots, such as indirect injection via logs or multi-turn state manipulation.

The blind-spot section is empty, contains only generic statements, or misses a known vector like tool output poisoning.

Verify that the blind-spot section contains at least one specific, non-obvious vector. Fail if the section is empty or contains only well-known direct injection vectors.

Output Schema Validity

The output is valid JSON conforming to the expected [OUTPUT_SCHEMA] with all required fields present and correctly typed.

The output is missing required fields like 'entry_points' or 'trust_boundaries', or contains malformed JSON.

Validate the raw output against the [OUTPUT_SCHEMA] using a JSON schema validator. Fail on any schema violation.

Actionable Severity Ranking

Each surface is ranked with a clear severity level (e.g., Critical, High, Medium, Low) based on exploitability and impact.

All surfaces are ranked 'Medium' or the ranking is inconsistent, such as a direct system prompt injection surface ranked 'Low'.

Check for variance in severity rankings. Fail if all rankings are identical or if a direct instruction boundary is not ranked Critical or High.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with the base enumeration prompt and a single target system description. Remove strict output schema requirements and use free-text analysis. Focus on breadth of surfaces found rather than structured completeness.

code
Analyze the following system for prompt injection surfaces:
[SYSTEM_DESCRIPTION]

List every entry point where untrusted data could reach the model prompt.

Watch for

  • Missing trust boundary classification
  • Overly broad or vague surface descriptions
  • No severity ranking to prioritize findings
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.