Skip to content

Dedicated AI, LLM & Model Context Protocol (MCP) Endpoint Auditing

6 min readBug Hunting for Beginners

Auditing AI applications means inspecting architectural boundaries, not pasting generic jailbreak lists. Sending “ignore previous instructions” strings produces low-severity triage noise. High-severity findings happen where language model logic meets multi-tenant data stores, external tool dispatchers, or agentic protocols.

This chapter covers five boundaries to inspect in production LLM and agentic applications.


1. Messages array and system context inspection

Section titled “1. Messages array and system context inspection”

Web and mobile clients talk to LLM orchestration backends through JSON over HTTP or WebSockets. Intercept this traffic in Caido or Burp Suite. The main thing to inspect is the JSON structure holding conversation history and session parameters.

Modern chat endpoints accept a structured messages array:

{
"model": "gpt-4o",
"temperature": 0.2,
"messages": [
{
"role": "system",
"content": "You are a customer service assistant for TargetCorp."
},
{
"role": "user",
"content": "What is my invoice balance?"
}
]
}

Check four structural boundaries:

  1. Client-supplied system messages. Verify whether the server accepts a role: "system" entry directly from the client instead of injecting system instructions strictly on the server side.
  2. Role tampering and history injection. Check whether the backend validates the role field on incoming history arrays. If a client can submit synthetic role: "assistant" or role: "tool" entries, server-side orchestration state can be desynchronized.
  3. Hidden context parameters. In agentic frameworks (such as Google ADK, LangChain, or Strands SDK), look for client-supplied fields such as session_id, tenant_id, user_role, or system_context. Test swapping them against a second account you own to check for Broken Object Level Authorization (BOLA).
  4. Output rendering and markdown sinks. Inspect how client frontends render model replies (LLM10:2026). Check whether rendered markdown image tags trigger automatic outbound HTTP requests to external hosts (as seen in the GitHub Copilot Chat CamoLeak disclosure, CVSS 9.6, fixed August 2025 and published 30 September 2025), and whether unsanitized HTML, SVG, or Mermaid blocks allow DOM XSS.

2. RAG authorization and vector store isolation

Section titled “2. RAG authorization and vector store isolation”

Retrieval-Augmented Generation (RAG) pipelines convert multi-tenant documents into vector embeddings stored in databases such as Pinecone, Qdrant, pgvector, Weaviate, Milvus, or Chroma.

Relational databases enforce tenant boundaries deterministically (WHERE tenant_id = ?). Vector databases run similarity searches against nearest neighbors. When teams omit metadata filters on the vector query and rely on a system prompt (“only answer with the current user’s documents”), cross-tenant data leakage follows.

flowchart TD
  subgraph Vuln["Vulnerable RAG Pipeline (Prompt-Level Isolation)"]
    U["Tenant A User Query"] --> VS1["Vector DB: Nearest Neighbor Search<br/>(No metadata filter!)"]
    VS1 -->|Returns embeddings from Tenant A & B| LLM1["LLM with System Prompt:<br/>'Only show Tenant A data'"]
    LLM1 -->|Context contamination| LEAK["Cross-Tenant Data Leaked to Tenant A!"]
  end

  subgraph Secure["Secure RAG Pipeline (Database-Level Filter)"]
    U2["Tenant A User Query"] --> VS2["Vector DB Query with Filter:<br/>filter={'tenant_id': 'tenant_a'}"]
    VS2 -->|Returns ONLY Tenant A embeddings| LLM2["LLM Context"]
    LLM2 --> RES["Isolated Tenant A Response"]
  end

Verify tenant isolation safely without touching real customer data:

  1. Plant a canary in Tenant B. Using a second test account you own, upload a document containing a unique, harmless token (for example CANARY-RAG-99481-ALPHA) and a distinct project topic.
  2. Query from Tenant A. Log into your first test account and ask questions in the semantic neighborhood of that topic without quoting the canary.
  3. Inspect raw responses in your proxy. Check both the streamed text and the raw JSON citations, retrieved_documents, or metadata fields for Tenant B’s chunk text, document IDs, or org_id.
  4. Check structured filter parameters. If a search route such as POST /api/v1/ai/search accepts a client-supplied filters object, test whether the backend merges user JSON directly into the vector query instead of deriving tenant_id strictly from verified server-side session claims.

3. Agent tool-call tracing and dispatcher bypasses (CoreBreak)

Section titled “3. Agent tool-call tracing and dispatcher bypasses (CoreBreak)”

Agentic applications let a model select and invoke external tools via structured schemas. When an agent holds authority beyond the caller’s role, it suffers from Excessive Agency (LLM03:2026 and ASI02).

At Black Hat USA 2026, Hedi Ingber and Aviyam Ivgi presented CoreBreak (The Hacker News, analysis by Chris Wysopal at Veracode, 12 August 2026). The research showed that guardrails wrapped around the LLM (system prompts, content filters, refusal training) fail if an attacker can skip the model turn entirely at the application plumbing layer:

  • AWS Bedrock AgentCore (CVE-2026-18830, CVSS 8.6): Authenticated remote path allowing direct tool execution via the dispatch harness.
  • Google ADK for Python (CVE-2026-18236, CVSS 9.3): Attacker-influenced session events and caller-authored function calls fixed in ADK 2.5.0.
  • Vercel AI SDK (CVE-2026-64650, CVE-2026-64651): Tool execution and approval-event handling gaps in the harness layer.
  • Strands Python SDK: Documented model-skipping behavior when caller-influenced message history ends with a toolUse block, requiring applications to sanitize or isolate history at the architectural boundary.

The fix across all vendors was out-of-band policy enforcement (OBPE): bind tool execution to server-side state the caller cannot author, reject externally supplied tool-call or approval blocks, and verify RBAC/tenant ownership inside the tool handler itself.

  1. Map tool schemas. Inspect network responses and client JS bundles to list declared tool names, descriptions, and argument schemas.
  2. Test cross-tenant tool arguments. Using two accounts you own, check whether the tool handler verifies that a requested invoice_id or org_id actually belongs to the authenticated caller’s session.
  3. Check direct dispatch routes. If the backend exposes a route such as POST /api/v2/organizations/{org_id}/ai-agent/dispatch, check whether the edge gateway validates the URL org_id while the downstream dispatcher blindly trusts a different target_org_id in the JSON body, or executes client-supplied tool-call blocks without a server-side model turn.
  4. Verify human-in-the-loop (HITL) enforcement. High-consequence actions (transfers, key creation, deletions) must require out-of-band confirmation enforced on the server, not a boolean flag or approval event inside client-submitted conversation history.
  5. Check indirect data channels. Identify every untrusted source the agent ingests (support tickets, PR comments, uploaded files, fetched web pages) and test whether untrusted content can steer tool execution without user confirmation (LLM01:2026 + ASI01).

4. Model Context Protocol (MCP) server security

Section titled “4. Model Context Protocol (MCP) server security”

The Model Context Protocol (MCP) connects models and coding agents to local filesystems, internal APIs, and databases over stdio or HTTP/SSE transports. Each MCP server exposes tools, resources, and prompt templates.

flowchart LR
  Agent["LLM Agent Client"] <-->|MCP Transport (stdio / SSE)| Server["MCP Server"]
  Server <--> Tools["Local Tools / Shell / Filesystem / APIs"]

  style Server fill:#ffcccc,stroke:#cc0000,stroke-width:2px

When auditing in-scope MCP servers:

  1. Path validation and file boundaries. Audit file-reading or download tools (read_file, export, download_attachment) for missing canonical path checks that allow escaping the intended workspace directory.
  2. Subprocess invocation. Check whether tool handlers pass user-controlled arguments to shell execution APIs (child_process.exec, subprocess.Popen(shell=True)) instead of parameterized argument arrays.
  3. Exposed HTTP/SSE listeners. Remote or containerized MCP servers listening over HTTP/SSE often lack authentication, expose debug routes, or ship with permissive CORS policies.
  4. Real-world case study (CVE-2026-27825 and CVE-2026-77269). In February 2026, researchers disclosed CVE-2026-27825 in mcp-atlassian (patched in v0.17.0), where an unconstrained download_path in confluence_download_attachment allowed unauthenticated SSRF and arbitrary file write. A follow-up bypass to that fix, CVE-2026-77269, was disclosed in September 2026 and patched in v0.22.0. Always re-test patched MCP path filters on newer releases.

5. Automated LLM security regression suites

Section titled “5. Automated LLM security regression suites”

Run local evaluation tools so target data never leaves your machine.

Promptfoo (MIT licensed; acquired by OpenAI in March 2026 while remaining open source) runs local red-team evaluations mapped to OWASP GenAI categories. It also maintains companion testing repos: promptfoo/evil-mcp-server and promptfoo/modelaudit.

Create promptfooconfig.yaml in your project folder:

description: "Enterprise AI Endpoint Security Audit (Local Execution)"
targets:
- id: https://api.target.example/v1/ai/chat
label: "Target Production RAG & Agent API"
config:
method: "POST"
headers:
Content-Type: "application/json"
Authorization: "Bearer {{env.TARGET_TEST_JWT}}"
body:
message: "{{prompt}}"
session_id: "audit-session-001"
transformResponse: "json.data.reply"
redteam:
purpose: "Customer support and billing assistant with access to internal ticket and invoice tools."
numTests: 10
plugins:
- id: "prompt-extraction" # Tests LLM08:2026 Hidden Context Exposure
- id: "bola" # Tests cross-tenant object access via natural language & tool args
- id: "bfla" # Tests unauthorized invocation of privileged agent tools
- id: "hijacking" # Tests ASI01 Agent Goal Hijack
- id: "sql-injection" # Tests LLM10:2026 Improper Output Handling into downstream DBs
- id: "ssrf" # Tests agent web-browsing / webhook tool SSRF
strategies:
- id: "basic"
- id: "jailbreak:composite"

Run the suite locally:

Terminal window
export TARGET_TEST_JWT="eyJhbGciOi..."
npx promptfoo@latest redteam run
npx promptfoo@latest view
  • PyRIT (Python Risk Identification Tool): Microsoft’s open-source framework for multi-turn generative AI evaluation.
  • Giskard: Python library for detecting RAG data leakage and model evaluation regressions.
  • NVIDIA Garak: Scanner focused on raw model endpoints and output-handling probes.

Next step: for client-side reconstruction of signed APIs, read Section 24.

Connections4 backlinks · 1 outgoingFull graph →
Open local graph around this page
Open full graph →
Click a node to open · Drag to reposition · Scroll to zoom

Bug Hunting for BeginnersFor authorized testing only. Read the ethics note before you put a domain in scope.