AI AgentSecurity & Supply Chain

Stop Relying on Prompts for Agent Security: 5 Privilege Escalation Levels in GitHub Secure Code Game

GitHub Security Lab launched Season 4 of the Secure Code Game on July 24, 2026. In this season, the team introduced a deliberately vulnerable agentic AI target named ProdBot.

ProdBot’s objective: through natural language interaction, induce the Agent to bypass permission checks and isolation mechanisms, reading the sensitive file ../password.txt located outside its sandbox directory.

If you want to experience this CTF firsthand, start by clicking GitHub Secure Code Game to launch Codespaces; after trying a few levels or getting stuck, return here to compare your experience with our breakdown of the 5 privilege escalation levels.

GitHub Secure Code Game Season Evolution: From Traditional Code to Agentic AI

From Season 1 to Season 4: Paradigm Evolution of Application Security

Looking back at the trajectory of the GitHub Secure Code Game, it perfectly reflects the evolution of software engineering and AI over recent years:

For AI application developers, Season 3 and Season 4 are clearly the most relevant. While Season 3 defended against “polluting the model’s text channel,” Season 4 addresses the vulnerability of modern Agent systems—how attackers execute privilege escalation in real environments when models evolve from “just chatting” to “holding tools and execution rights.”

When an attack pattern is featured in an entry-level GitHub CTF, it signifies that the technique has moved beyond academic papers and hacker testbeds to become standard knowledge for red teams.

Level 1: When Keyword Filtering Meets the Shell Interpreter

When guarding an Agent executing Bash commands, many developers’ most intuitive approach is to write a strict System Prompt (e.g., “Never execute dangerous commands”) or add a few keyword check lines in code to intercept strings containing .. or password.

Instead of forcefully entering cat ../password.txt, the attacker leverages Shell variable expansion and string concatenation mechanisms. By passing instructions like D=..; cat $D/pass"word".txt or using Base64 encoding/decoding statements, the sensitive path is dismantled on the surface. The Agent receives the request and naturally generates what appears to be a compliant script.

This exposes the limitation of literal string validation against dynamic interpreters. Static check logic only verifies literal text, bypassing variables like D or split strings like "word". However, when the command is passed to the Bash interpreter, Bash completes variable expansion and string concatenation at runtime, precisely reconstructing the unauthorized read of the sensitive file.

Level 2: Control Hidden Inside Web Pages

Moving to the second level, direct requests for sensitive files are prohibited, but when handling routine tasks (e.g., “Summarize the content of this webpage”), the Agent is permitted to fetch external URLs.

The attacker does not issue malicious commands directly in the chat box, but instead embeds attack instructions within the external webpage fetched by the Agent. The webpage contains high-priority override prompts instructing the Agent to read files outside the sandbox.

When the Agent calls its web browsing tool to fetch the webpage, external data is injected directly into the LLM’s Prompt context. In current LLM architectures, data retrieved from external sources shares the exact same context space with system control instructions. The Agent cannot distinguish whether the text is “objective data to be analyzed” or a “must-follow system command,” ultimately obeying the malicious instructions and retrieving the sensitive file.

Level 3: Poisoned Context Channels

The third level introduces an MCP-based toolchain, providing standardized tool calling mechanisms for the Agent in an attempt to regulate inputs and outputs via protocol specifications.

The attacker hides attack logic inside MCP tool docstrings or injects it through upstream tool return values.

When the Agent selects tools or receives tool outputs, it parses these instructions embedded in descriptions and responses. The data returned by an upstream tool acts as a “poisoned key,” inducing the Agent to pass parameters containing unauthorized file paths to subsequent high-privilege tools. While the protocol enforces parameter schemas, it cannot evaluate whether natural language content within the context has been tampered with, causing a cascading compromise across the toolchain.

Level 4: Stealthy Cross-Session Privilege Escalation

In the fourth level, the Agent is equipped with Skill plugins possessing global file and network read/write permissions, along with cross-session memory to support continuous automated tasks.

During an apparently normal conversation, the attacker tricks the Agent into storing malicious states into the persistent memory database, or triggers conditions that activate high-privilege Skills.

In a subsequent, fresh session, the user initiates a routine query. However, upon initialization, the Agent reads the poisoned historical memory and mixes past malicious context into its decision-making logic, automatically invoking high-privilege Skills to read sensitive files outside the sandbox. Persistent memory breaks session isolation, transforming a one-time injection into a persistent backdoor.

Level 5: The Confused Deputy Within

Multi-Agent Confused Deputy Privilege Escalation Mechanism

In the final level, the system adopts a multi-agent architecture. A low-privilege Subagent processes untrusted external input, while a high-privilege Parent Agent manages overall coordination.

The attacker submits malicious input to the low-privilege Subagent. Upon processing, the Subagent embeds the malicious instructions into a generated intermediate artifact (Child Artifact).

When the high-privilege Parent Agent parses this Child Artifact, it fails to explicitly verify data provenance and misinterprets the attack statements inside the artifact as legitimate control instructions from the Subagent. This is a classic Confused Deputy scenario: despite architectural privilege separation, the Parent Agent blindly trusts the Subagent’s artifact, turning the low-privilege Subagent into an unwitting accomplice that tricks the Parent into executing unauthorized high-privilege actions.

Takeaways for Practitioners: Shifting from Text Defenses to Physical Isolation

Deconstructing ProdBot’s 5 levels clarifies a fundamental shift in red-teaming: Agent security is not about “guessing what the model will output” in natural language, but tracking how instructions and data flow across system architectures.

Relying solely on Guardrail prompts to “discourage” models fails deterministically against Shell variable expansion, context confusion, toolchain poisoning, memory persistence, and multi-agent artifact propagation.

A robust security boundary cannot rely on probabilistic predictions of natural language outputs. It must be rooted in architectural design: constraining Shell execution within physically isolated sandboxes, enforcing minimum privilege principles on MCP and Skill tools, and maintaining strict context decoupling and data provenance in multi-agent workflows.