Testing LLM Tool-Call Chains for Privilege Escalation
A trust-boundary method for tracing how untrusted data becomes privileged action.

Testing LLM tool-call chains for privilege escalation means testing how untrusted content becomes a privileged backend action. The risk comes from a model treating data as instruction, then using tools with authority the data’s author never had. A useful penetration test follows that path across trust boundaries. A generic prompt-injection checklist does not.
Why LLM tool-call chains create a structurally different privilege escalation risk
System prompts, user input, retrieved documents, tool responses, and conversation history all enter the model’s context as tokens. Their source does not create an enforceable boundary between instructions the model should obey and data it should only read. SQL injection has a structural fix in parameterized queries, which keep attacker input from becoming executable instruction. LLMs have no equivalent remedy for their instruction-data boundary. When a model interprets untrusted text as a command, function calling, MCP servers, API integrations, and code execution environments can turn that command into a real system change. The resulting privilege escalation therefore requires an architectural remedy.
How the attack surface is layered and where chaining begins
The prompt layer is the application’s new control plane. System prompts, templates, conversation memory, and guardrails influence which tools the model invokes and why. The retrieval layer then feeds outside content into that control plane through ingestion, chunking, vector search, and context assembly. Search relevance is not permission to read. If retrieval ranks content by semantic relevance without enforcing authorisation at query time, it can expose data across tenants or permission levels. RAG is therefore a data-isolation problem as well as a search feature.
The tool and agent layer gives those decisions consequences. A wrong answer can become a financial action, an account change, a data export, or a code change. Output handling creates another boundary wherever model-generated content is rendered, stored, indexed, executed, or passed into another system. Classic injection risks reappear there, with the model generating the payload. The escalation path runs through these layers when untrusted retrieved content enters context, changes a tool invocation, and triggers a privileged downstream action. A standard web-application pentest can under-test this path because its focus is endpoints and parameters rather than instruction hierarchies and tool constraints.
The concrete attack chains that escalate privilege across tool calls
Indirect prompt injection starts outside the conversation itself. An attacker places instructions in an uploaded PDF, a web page scraped for RAG, a shared knowledge base, or an email an assistant will summarise. The agent reads that content as data but follows part of it as instruction. The first tool call may only obtain information. Escalation happens when a later call uses that information to reach an action the original content was never authorised to request.
Palo Alto Networks Unit 42 documented a concrete chain in its Zealot multi-agent research. After exploiting an SSRF vulnerability to reach an internal service, the agent autonomously identified and queried the cloud instance metadata endpoint. It extracted short-lived IAM credentials for the workload’s service account, then passed them to a downstream sub-agent specialising in cloud service enumeration. The credentials connected the stages of the attack. An internal-service access flaw became a route to cloud authority, and another agent could then use what the first had obtained. This documented research chain shows one possible outcome of prompt injection.
Tests of these chains follow how one call depends on another. One chain reads a credentials file, then uses the extracted credentials to call an authenticated external API. Another enumerates available tools before invoking the highest-privilege tool identified. A third reads system context and sends it out through a tool that is allowed and seems low-risk, such as a DNS lookup or link-preview renderer. The final tool need not look dangerous alone.
MCP tool poisoning moves the injected instruction into a tool description that the model reads but the user never sees. For example, it can direct the model to read ~/.ssh/id_rsa and send its contents to an external endpoint before completing the requested task. Rug-pull attacks exploit a change over time. A tool definition is silently mutated after approval, redirecting credentials or output to an attacker-controlled destination. In multi-agent systems, the same trust failure appears as a confused-deputy chain, where a high-privilege agent acts on a request relayed by a low-privilege agent without re-verifying its provenance.
Why these vulnerabilities appear in production systems at scale
SSRF, unauthenticated remote code execution, privilege escalation, and pre-authentication SQL injection are not new classes of software defect. They provide footholds on new LLM infrastructure paths. A chain can therefore combine a conventional access flaw with agent behaviour. Security checks that focus on older application paths can leave most of those combinations unscanned.
AI-assisted code generation adds more code that can have those flaws. Developers can generate entire controllers, database abstraction layers, and API endpoints from natural-language prompts. Broken access control and SQL injection can then be duplicated across microservices before a post-commit scanner runs. Secrets exposure grows through the same process. Generated client-side code can contain hardcoded API keys and plaintext secret placeholders instead of vault integrations, adding another route from accessible code to credentials. The urgency comes from replication and incomplete coverage.
What a trust-boundary methodology for testing these chains actually requires
The engagement should map application components, integrations, and business-critical actions, then derive tests from the boundaries between them. Each tool needs an explicit account of its authority. That means identifying whether it executes with user-scoped credentials, application-scoped credentials, or a service account. The same preparation must set out which parameters are allowed, which actions need human approval, what the rate limits are, and whether tool-call logs have enough context for attribution and investigation.
With that map in place, testing should cover indirect injection across every content type the application ingests. PDFs need tests for instructions in metadata or white-on-white text, while scraped web pages, shared knowledge-base articles, emails, and chat logs need their own payloads. A successful injection is only the starting point. The tester must then check whether the resulting call makes another call possible that gives it more access. Credentials obtained in one step must be tested as inputs to authenticated calls in the next.
Retrieval needs access-control testing at the same time. The test plan should cover cross-tenant leakage, cross-permission leakage, and over-broad context assembly rather than treating retrieval accuracy as evidence of isolation. MCP testing must check descriptions as the model sees them and test whether definitions can change after they have been approved. Multi-agent testing must map every agent-to-agent trust relationship. High-privilege agents need tests that establish whether they re-verify the provenance of requests relayed through lower-privilege agents.
These tests also need to span time. Agents chain tools, retain memory, accumulate side effects, and may act on partially verified information before triggering irreversible actions. Testing each invocation in isolation misses those dependencies. The plan must track how information from earlier calls affects later actions, including through agent handoffs and changes to tool definitions. Testing must establish whether untrusted content can cross a trust boundary and influence a privileged action.
Why whitebox access to code, configs, and agent definitions is necessary to test these chains completely
A tool may behave narrowly during testing while its credential configuration grants broader access, and the tester may not know that its behaviour has been constrained. Reading that configuration is necessary to establish which permissions it uses. User-facing documentation is not enough for MCP testing either. The description presented to the model can differ from the one shown to the user, so testing tool poisoning requires access to the actual definition.
Agent handoffs create a similar need for internal access. Their trust relationships are defined in orchestration code, which an outside-only tester cannot fully reconstruct to build confused-deputy cases. Cloud configuration then determines what a successful credential-extraction chain has achieved. IAM roles, service account permissions, and metadata endpoint exposure establish whether an SSRF path reaches meaningful additional authority. Without that access, the claimed privilege escalation remains unproven. Whitebox testing makes it possible to connect a working exploit to the permission boundary it crossed, rather than report an interesting behaviour as a confirmed security failure.
What compliance frameworks require and where LLM chain testing fits
SOC 2, HIPAA, and ISO 27001 do not explicitly mandate a penetration test in every case. In practice, testing expectations can make one difficult to avoid, but none of these frameworks’ existing language was written for LLM tool-call chains. That leaves a scope question for the buyer. Technical founders need to resolve with their auditor what evidence is expected and with their provider which LLM paths the engagement will actually test.
SOC 2 has no Trust Services Criterion that mandates a penetration test. Auditors nevertheless commonly expect a recent test, enterprise customers ask for the report, and the test needs to fall within the Type 2 observation window to count as evidence. Human-driven adversarial testing is needed to uncover business-logic weaknesses and chained exploits that scanner-only or AI-only testing can miss. For an LLM application, that expectation makes testing the actions reachable through endpoints especially important alongside probing the endpoints themselves.
ISO 27001 (2022 version) addresses this through Control 8.8, Management of Technical Vulnerabilities, and Control 8.29, Security Testing in Development and Acceptance. The implementation guidance in ISO/IEC 27002:2022 names penetration testing directly. Where they apply in the Statement of Applicability and test evidence is absent, the auditor has grounds for a nonconformity. HIPAA takes a different route through the Security Rule’s Evaluation Standard (§ 164.308(a)(8)), which requires technical and non-technical evaluations from time to time. Penetration testing supports that requirement, although the rule does not name it.
For buyers, the practical action is to name LLM coverage explicitly in the scope document. A web-application scope will not automatically include tool-call chains, RAG pipelines, or multi-agent trust boundaries. Buyers should check whether the provider enumerates every available tool, its credential level, and its reachable downstream actions. The evidence should show which paths across those tools were tested, along with the endpoints that received probes.
How to evaluate whether a provider can actually test these chains
Experience in general web-application pentesting alone does not show that a provider knows how to test LLM chains. Buyers should ask how the provider maps what each tool has the authority to do before testing and how it tests indirect injection in PDFs, scraped content, shared knowledge bases, and email summaries. The provider should explain how it checks whether high-privilege agents re-check the provenance of requests that come through low-privilege agents. A list of standard prompt-injection payloads does not answer any of those questions.
The access requirements reveal whether that methodology is credible. A provider should ask for source code, cloud configurations, and agent and tool definitions, because testing from outside alone cannot give complete coverage. Its scope should enumerate tools, credential scope, and downstream systems alongside endpoints and parameters. Proof is the next dividing line. Buyers should ask whether every finding will include a working exploit demonstrating the chain from injected input to privileged backend action, rather than an observation that an endpoint may be vulnerable.
Retesting must be part of that standard too. A partial patch may block one injection path while leaving another route to the same privileged action, so verification needs the same whitebox access as the original engagement. The final report must show the injection vector, the tool-call sequence, the privilege level reached, and a working demonstration. Those details give an auditor evidence to evaluate and an engineer a defect to fix. Without them, a prompt-injection result says too little about whether the application’s authority can actually be abused.


