Inferensys

Prompt

Attack Surface Mapping for Router Bypass Prompt

A practical prompt playbook for AI security architects to systematically enumerate routing surfaces, rank bypass risk severity, and score defensive coverage in production AI workflows.
Developer building agentic RAG system, retrieval pipeline diagram on laptop, technical workspace with notes.
PROMPT PLAYBOOK

When to Use This Prompt

Defines the ideal user, required context, and operational boundaries for the Attack Surface Mapping prompt.

This prompt is built for AI security architects and red-team engineers who need to produce a structured, defensible attack-surface map of an AI system's routing logic. The job-to-be-done is documentation and analysis, not live exploitation. Use it when you have a known or suspected multi-router architecture—intent classifiers, risk routers, model selectors, tool-access gates, escalation paths—and you need to inventory every point where an adversarial input could influence a routing decision. The output is a formal inventory of routing surfaces, vulnerability mappings, risk severity rankings, and defense-gap analysis that guides subsequent red-team testing and defensive engineering.

Do not use this prompt for single-model, single-handler systems with no routing logic; it assumes a multi-component routing topology. The operator must supply accurate system architecture details, including router types, handler mappings, trust boundaries, and existing defenses. The prompt does not execute attacks or generate adversarial payloads—it produces the map that tells you where to aim those payloads. For teams building automated red-teaming harnesses, this prompt is the prerequisite scoping phase that prevents blind spots in test coverage.

Before running this prompt, gather your architecture diagrams, router configurations, handler inventories, and any existing threat models. The quality of the output depends entirely on the accuracy and completeness of the input context. After generating the attack-surface map, use it to prioritize which routers to test first, which bypass techniques to attempt, and where to add defensive instrumentation. Pair this prompt with the sibling playbooks in the Routing Misdirection and Classification Evasion group—each targets a specific router type with concrete test payloads and evaluation criteria.

PRACTICAL GUARDRAILS

Use Case Fit

Where this prompt works and where it does not. Use these cards to decide if attack surface mapping is the right tool for your current security review.

01

Good Fit: Pre-Deployment Architecture Review

Use when: you are designing a new multi-model or multi-handler system and need to enumerate every routing decision point before an attacker probes it. Guardrail: run this prompt against architecture diagrams and router configs, not live production traffic, to avoid disrupting active classifiers.

02

Bad Fit: Real-Time Intrusion Detection

Avoid when: you need to block an active injection attack in production. This prompt produces static documentation and risk scores, not runtime detections. Guardrail: pair the output with a runtime canary-token or input-sanitization prompt for live defense.

03

Required Inputs

Risk: incomplete router inventory leads to blind spots in the attack surface map. Guardrail: provide the prompt with a full list of routing components, their decision criteria, and downstream handler privileges. If any router is undocumented, flag it as an explicit gap in the output.

04

Operational Risk: Over-Confidence in Scores

Risk: teams treat the LLM-generated severity scores as ground truth and skip manual verification of critical paths. Guardrail: require a human security architect to review and sign off on all high-severity findings before they enter a remediation backlog.

05

Operational Risk: Stale Documentation

Risk: the attack surface map becomes outdated after a router config change, creating a false sense of security. Guardrail: version the output alongside your router configuration code and re-run the prompt as part of your CI/CD pipeline on every routing change.

06

Boundary: Not a Penetration Test

Risk: stakeholders interpret the map as proof that bypasses are impossible. Guardrail: explicitly label the output as a theoretical attack surface analysis. Follow it with active red-team prompts from the sibling topics to validate whether mapped vulnerabilities are actually exploitable.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A copy-ready prompt template for systematically mapping the attack surface of an AI routing system to identify bypass risks and defensive gaps.

This prompt template is designed to be pasted directly into your AI system for a structured security review. It instructs the model to act as an AI security architect and systematically enumerate every routing surface, rank bypass risk severity, and score defensive coverage. The output is a structured attack-surface document, not a conversational summary. Before using this prompt, you must gather details about your system's architecture: the list of routers, their decision logic, the downstream handlers they protect, and any existing input sanitization or guard models. The more precise your input, the more actionable the output.

code
You are an AI security architect specializing in adversarial robustness for compound AI systems. Your task is to produce a structured attack-surface mapping for a multi-router AI system based on the provided architecture details.

## SYSTEM ARCHITECTURE
[SYSTEM_ARCHITECTURE_DESCRIPTION]

## ROUTER INVENTORY
[ROUTER_INVENTORY]

## DOWNSTREAM HANDLER MAP
[DOWNSTREAM_HANDLER_MAP]

## EXISTING DEFENSES
[EXISTING_DEFENSES]

## RISK TOLERANCE
[RISK_TOLERANCE]

## INSTRUCTIONS
1.  **Router Inventory Analysis:** For each router in the inventory, identify its decision type (e.g., intent classification, content moderation, tool access, model selection).
2.  **Vulnerability Mapping:** For each router, map potential bypass techniques from the following categories, specifying concrete attack vectors based on the router's logic:
    - **Obfuscation:** Encoding tricks, Unicode homoglyphs, delimiter smuggling.
    - **Context Manipulation:** Attention flooding, multi-turn state poisoning, role-play injection.
    - **Logic Exploitation:** Confidence score manipulation, few-shot contamination, tool output poisoning.
    - **Direct Injection:** Prompt extraction, instruction override, jailbreak attempts.
3.  **Risk Severity Ranking:** Rank each identified vulnerability as `CRITICAL`, `HIGH`, `MEDIUM`, or `LOW` based on the potential impact of a successful bypass. A `CRITICAL` risk allows an attacker to reach a handler that executes high-risk actions (e.g., code execution, financial transactions, PII access) without human approval.
4.  **Defense Gap Analysis:** For each vulnerability, evaluate the effectiveness of the existing defenses. Score the coverage as `STRONG`, `PARTIAL`, or `WEAK`. Identify specific gaps where a determined attacker could succeed.
5.  **Output Schema:** Produce the final output as a single JSON object conforming to the following schema:
    ```json
    {
      "attack_surface_summary": {
        "total_routers_analyzed": "<integer>",
        "critical_risk_count": "<integer>",
        "high_risk_count": "<integer>",
        "overall_defensive_posture": "<STRONG | MODERATE | WEAK>"
      },
      "router_vulnerabilities": [
        {
          "router_id": "<string>",
          "router_type": "<string>",
          "vulnerabilities": [
            {
              "vulnerability_id": "<string>",
              "bypass_category": "<string>",
              "attack_vector_description": "<string>",
              "risk_severity": "<CRITICAL | HIGH | MEDIUM | LOW>",
              "defensive_coverage": "<STRONG | PARTIAL | WEAK>",
              "defense_gap_explanation": "<string>"
            }
          ]
        }
      ],
      "prioritized_remediation_list": [
        {
          "priority": "<integer>",
          "vulnerability_id": "<string>",
          "recommended_action": "<string>"
        }
      ]
    }
    ```
6.  **Constraints:**
    - Do not simulate attacks or generate malicious payloads. Describe the attack vector conceptually.
    - Base all analysis strictly on the provided system architecture. Do not invent components.
    - If a router's logic is not fully specified, note the ambiguity and state your assumptions.
    - The output must be valid JSON. Do not include any text outside the JSON object.

To adapt this template, replace the square-bracket placeholders with your specific details. [SYSTEM_ARCHITECTURE_DESCRIPTION] should be a narrative of how user input flows through the system. [ROUTER_INVENTORY] is a list of every classifier, guard, or routing function, including its purpose and decision logic. [DOWNSTREAM_HANDLER_MAP] must detail what each router protects—such as specific tools, data stores, or model endpoints—and the privilege level of each. [EXISTING_DEFENSES] should list all pre-processing sanitizers, guard models, and output filters. Finally, [RISK_TOLERANCE] calibrates the analysis (e.g., 'A critical risk is any path to an unapproved code execution tool'). After running the prompt, validate the JSON output against the schema. A failed validation should trigger a retry with the error message included in the new prompt. For high-stakes systems, a human security architect must review the generated attack-surface map before it is used to prioritize engineering work.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Attack Surface Mapping prompt. Each placeholder must be populated before execution to produce a reliable router bypass risk assessment.

PlaceholderPurposeExampleValidation Notes

[ROUTER_INVENTORY]

List of all routing components, classifiers, and gate models in the target system

["IntentClassifier-v2", "RiskRouter-prod", "ToolAccessGate-main"]

Must be a JSON array of strings. Validate each entry against a known system component registry. Reject if empty or contains only generic labels like 'router1'.

[ROUTING_TOPOLOGY]

Description of how requests flow through routers, including branching logic and fallback paths

"User input -> IntentClassifier -> (high_risk: RiskRouter -> GuardModel) | (low_risk: TaskRouter)"

Must be a non-empty string describing sequential or conditional routing. Validate for logical completeness: every branch must terminate at a handler or escalation point.

[HANDLER_CAPABILITIES]

Mapping of each downstream handler to its allowed actions, data access, and privilege level

{"TaskRouter": {"tools": ["search", "summarize"], "data_stores": ["public_kb"]}, "AdminHandler": {"tools": ["delete_user"], "data_stores": ["user_db"]}}

Must be a valid JSON object. Each handler must declare tools and data_stores arrays. Validate that no handler has 'admin' or 'unrestricted' without explicit approval flag.

[BYPASS_TARGETS]

Specific handlers or privilege levels an attacker would want to reach

["AdminHandler", "ToolAccessGate:unrestricted_write"]

Must be a JSON array of strings matching entries in [HANDLER_CAPABILITIES]. Validate that each target exists in the handler map. Reject if targets include handlers not in the inventory.

[DEFENSE_LAYERS]

Current defensive controls in place, including input sanitizers, guard models, and output filters

["InputSanitizer-regex", "GuardModel-v3", "CanaryTokenCheck"]

Must be a JSON array of strings. Each entry should reference a deployed defense component. Validate against a known defense registry. Warn if array is empty (no defenses documented).

[KNOWN_VULNERABILITIES]

Previously identified bypass techniques or CVEs relevant to the routing architecture

["CVE-2024-1234: delimiter injection in IntentClassifier", "Internal-INC-567: role-play bypass on RiskRouter"]

Must be a JSON array of strings or null. If non-null, each entry must include an identifier and brief description. Validate that referenced CVEs or incidents are documented in the team's vulnerability tracker.

[EVALUATION_CRITERIA]

Success conditions for a bypass attempt, defining what constitutes a routing failure

{"misrouting": "Request reaches handler other than intended", "privilege_escalation": "Request reaches handler with higher privilege than input merits"}

Must be a valid JSON object with at least one key. Each value must be a non-empty string describing an observable failure condition. Validate that criteria are testable (not subjective like 'bad outcome').

[CONFIDENCE_THRESHOLD]

Minimum confidence score required for classifier routing decisions before escalation or rejection

0.85

Must be a float between 0.0 and 1.0. Validate that the value matches the production router configuration. Reject if threshold is below 0.5 without explicit risk acceptance documented.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the attack surface mapping prompt into an automated security review pipeline with validation, logging, and human review gates.

This prompt is designed to run as a batch analysis step within a broader security review workflow, not as a one-off chat interaction. The primary integration point is a CI/CD pipeline, a scheduled security audit job, or an on-demand red-team tool. The harness must supply the router inventory, policy documents, and threat model context as structured inputs, then validate the output against a known schema before storing results in a security asset database. Because the output documents potential vulnerabilities in production routing logic, treat the generated report as sensitive material and restrict access to security engineers and AI platform architects.

Implement a validation and retry loop around the model call. The expected output is a JSON object with routers, vulnerabilities, defense_gaps, and risk_scores arrays. Use a JSON Schema validator to confirm structural integrity immediately after generation. If validation fails, retry up to two times with an augmented prompt that includes the specific validation error message. For model choice, prefer a model with strong reasoning capabilities and a large context window (e.g., Claude 3.5 Sonnet or GPT-4o) because the prompt requires holding multiple router definitions, policy documents, and threat mappings in context simultaneously. Do not use a lightweight classification model for this task—the reasoning depth required exceeds simple routing or triage models.

Log every generation attempt, including the input hash, model version, raw output, validation status, and any retry attempts, to an audit trail. This is critical for post-incident review if a bypass vulnerability is later exploited. After a valid output is produced, route it to a human review queue before it is accepted as a final assessment. The review step should allow a security engineer to confirm, reject, or annotate each finding. Rejected findings should be fed back into the prompt as negative examples for future runs. Avoid wiring this prompt directly into an automated remediation system—false positives in attack surface mapping can lead to unnecessary router reconfiguration and operational risk.

IMPLEMENTATION TABLE

Expected Output Contract

Fields, format, and validation rules for the structured attack surface map produced by the prompt. Use this contract to build a post-processing validator before the output enters any downstream system.

Field or ElementType or FormatRequiredValidation Rule

attack_surface_id

string (slug)

Must match pattern ^ASM-[a-z0-9]{8}$. Generate if absent.

router_inventory

array of objects

Minimum 1 item. Each object must contain router_id, handler_target, and classification_method.

router_inventory[].router_id

string

Non-empty. Must be unique within the array.

vulnerability_map

array of objects

Minimum 1 item. Each object must reference a valid router_id from router_inventory.

vulnerability_map[].bypass_risk

string (enum)

Must be one of: critical, high, medium, low, informational.

defense_gap_analysis

array of objects

If present, each object must contain gap_description and affected_router_ids.

overall_risk_score

number (0.0-10.0)

Must be a float between 0.0 and 10.0 inclusive. Round to 1 decimal place.

generated_at

string (ISO 8601)

Must parse as a valid UTC datetime. Set to current time if the model omits it.

PRACTICAL GUARDRAILS

Common Failure Modes

Router bypass testing fails in predictable ways. These are the most common failure modes when mapping attack surfaces, ranking risks, and scoring defenses—and how to prevent them before they reach production.

01

Surface Enumeration Gaps

What to watch: The prompt misses entire routing surfaces—tool routers, guard models, or escalation gates—because the system architecture wasn't fully documented before testing. Incomplete surface maps create false confidence. Guardrail: Require a pre-populated router inventory with mandatory fields (router type, target handler, authorization boundary) before running the attack surface mapping prompt. Validate completeness against architecture diagrams.

02

Severity Inflation Without Exploitability Evidence

What to watch: The prompt assigns high severity to theoretical bypasses that lack a working exploit path or require unrealistic preconditions. This wastes remediation effort on low-probability threats. Guardrail: Require the output to include a minimum viable exploit chain for every HIGH or CRITICAL finding. If no working chain exists, cap the severity at MEDIUM and flag for monitoring.

03

Defense Coverage Overstatement

What to watch: The prompt claims a defense layer covers a vulnerability when it only partially mitigates it—for example, claiming input sanitization blocks an attack that uses tool-output poisoning. Overstated coverage hides real gaps. Guardrail: Require defense-gap analysis to specify exactly which attack vectors each defense handles and which it explicitly does not. Use a coverage matrix with pass/fail per vector, not per layer.

04

Router Boundary Confusion

What to watch: The prompt conflates distinct routers—treating an intent classifier and a content moderation router as the same surface—leading to merged risk scores that obscure which component actually fails. Guardrail: Enforce one router per analysis block. If routers are chained, require sequential mapping: Router A → Router B → Handler, with separate vulnerability scoring for each hop.

05

Static Analysis Without Runtime Validation

What to watch: The prompt produces a plausible-looking attack surface map based on documentation or assumptions, but no actual test payloads were executed. The map looks complete but hasn't been validated against live routing behavior. Guardrail: Pair the mapping prompt with an automated red-team harness that executes generated bypass payloads against each identified surface. Flag any finding that lacks runtime confirmation as UNVERIFIED.

06

Missing Multi-Turn Attack Paths

What to watch: The prompt analyzes single-turn bypasses but misses stateful attacks where conversation history, accumulated tool outputs, or prior routing decisions create new bypass surfaces across turns. Guardrail: Require at least one multi-turn attack path per router in the output. If a router is stateless, explicitly document that finding. For stateful routers, include turn-by-turn state manipulation sequences.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test the quality of the generated attack surface map before sharing it with stakeholders. Each criterion targets a specific failure mode common in structured security documentation.

CriterionPass StandardFailure SignalTest Method

Router Inventory Completeness

All routing components from [SYSTEM_ARCHITECTURE_DOC] are listed with a unique ID

Missing router entries or components described only in prose without a structured ID

Count unique router IDs in output; diff against a manually extracted list from the source document

Vulnerability Mapping Accuracy

Each vulnerability is mapped to at least one specific router ID and includes a concrete bypass technique

Vulnerabilities mapped to 'General' or 'All Routers' without a specific target; missing bypass mechanics

Spot-check 3 random vulnerabilities; verify the mapped router ID exists in the inventory and the technique is plausible

Risk Severity Justification

Every severity rating (Critical/High/Medium/Low) includes a rationale referencing both exploitability and impact

Severity assigned without justification or using only generic terms like 'high risk' without context

Parse all severity fields; flag any entry where the justification field is empty, null, or under 10 words

Defensive Coverage Scoring

Each defense is scored against specific vulnerabilities with a clear 'covered', 'partial', or 'gap' designation

Defenses listed without mapping to vulnerabilities; coverage scores that don't align with the vulnerability inventory

Cross-reference defense IDs with vulnerability IDs; verify every vulnerability has at least one associated defense or an explicit 'uncovered' flag

Source Grounding

Every claim about a router's behavior or a vulnerability's exploitability cites a source from [EVIDENCE_LOG]

Unsubstantiated claims about system behavior; citations that reference documents not in the provided evidence log

Extract all citation markers; validate each against the [EVIDENCE_LOG] input; flag orphaned citations

Output Schema Compliance

Output is valid JSON matching the [OUTPUT_SCHEMA] exactly with no extra or missing top-level keys

Malformed JSON, missing required arrays, or additional unexpected fields at the root level

Validate output against the JSON schema; reject on parse errors or schema violations

Actionable Gap Analysis

The defense-gap section includes at least one concrete, prioritized recommendation per critical vulnerability

Vague recommendations like 'improve security' or gaps listed without a corresponding action item

Parse the recommendations array; verify each critical vulnerability has a linked recommendation with a priority and owner field

Stakeholder Readability

Executive summary is under 200 words and contains no unexplained jargon or internal code names

Summary exceeds word limit, uses undefined acronyms, or assumes deep knowledge of the routing architecture

Run word count on the executive summary; scan for undefined acronyms against a provided glossary; flag any term not in [GLOSSARY]

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single frontier model and manual review. Start with a small router inventory (3-5 routing surfaces). Replace [ROUTER_INVENTORY] with a hardcoded list of known classifiers, guard models, and tool gates. Skip the defense-coverage scoring matrix initially—focus on vulnerability enumeration.

Watch for

  • Overly broad surface descriptions that miss handler-specific bypass vectors
  • Missing output schema validation when parsing structured attack-surface JSON
  • False confidence in coverage when only testing against one model family
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.