Back to skill

Security audit

Red Team

Security checks for vulnerabilities and agentic risk

Overview

This skill is a coherent red-team debate tool, but it sends user and file content into tool-capable AI coding CLIs without clear isolation or consent boundaries.

Install only if you are comfortable having your questions, context files, and generated debate content processed by the selected AI CLI provider. Avoid using sensitive documents, secrets, customer data, or hostile third-party files unless you run the backend in a constrained sandbox and understand its data-handling behavior.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/red-team.py:109
Finding
Untrusted Prompt Content Is Passed to Tool-Capable Coding Agents Without Isolation<![CDATA[ ## Vulnerability Details **File Location**: `scripts/red-team.py:109-127, 135-145, 185-250, 298-307, 334-340` **Vulnerability Type**: Prompt injection through untrusted context, custom personas, and model-generated debate content **Risk Level**: High ### Complete Vulnerable Code Snippets ```python def _build_cmd(backend: str, system: str, user_msg: str, model: str) -> tuple[list[str], str | None]: """Build the CLI command and optional stdin for the given backend.""" combined_prompt = f"{system}\n\n---\n\n{user_msg}" if backend == "claude": return [ "claude", "--print", "--model", model, "--output-format", "text", "--no-session-persistence", "--append-system-prompt", system, user_msg, ], None elif backend == "codex": # Codex exec reads prompt from positional arg or stdin return [ "codex", "exec", "--model", model, "--quiet", combined_prompt, ], None elif backend == "gemini": # Gemini CLI: prompt as positional arg return [ "gemini", "-p", combined_prompt, ], None ``` ```python def call_agent(system: str, user_msg: str, label: str, model: str = "sonnet", backend: str = "claude") -> str: """Call a coding agent CLI with a system prompt and user message.""" print(f" ⏳ {label}...", end=" ", flush=True) t0 = time.time() cmd, stdin_data = _build_cmd(backend, system, user_msg, model) try: result = subprocess.run( cmd, capture_output=True, text=True, input=stdin_data, timeout=180, ) ``` ```python def run_debate(question: str, persona_keys: list[str], personas: dict, rounds: int, context: str, model: str, backend: str = "claude") -> str: ctx_block = f"\n\n## Additional Context\n{context}" if context else "" # . ...[truncated 5186 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Use a text-only inference interface** - Prefer an API or CLI mode that cannot execute tools, shell commands, filesystem operations, or network requests. - Explicitly disable all agent tools rather than relying on default backend behavior. 2. **Run every backend in a constrained sandbox** - Use a dedicated empty working directory. - Mount required inputs as read-only. - Deny access to the user's home directory, project files, SSH configuration, cloud credentials, and other secrets. - Disable network access unless it is strictly required. - Run under a low-privilege account with a minimal environment. - Remove credential-bearing environment variables before starting the subprocess. 3. **Establish clear prompt trust boundaries** - Mark the question, context file, prior model output, and persona metadata as untrusted quoted data. - Add a fixed trusted instruction stating that content inside data blocks must never be treated as operational instructions. - Do not allow arbitrary custom persona text to replace or extend trusted system instructions without explicit review. 4. **Validate custom personas** - Apply length and schema limits. - Reject or require confirmation for persona definitions containing tool-use requests, command instructions, requests to access files, or attempts to override higher-priority instructions. - Keep persona worldview text in a user-level data section instead of passing it directly as a system prompt. 5. **Prevent cross-round instruction propagation** - Treat every agent response as untrusted before including it in later prompts. - Use structured outputs and extract only expected analytical fields. - Apply output size limits and detection for instruction-like payloads before reuse. 6. **Require approval for exceptional capabilities** - If tool access is intentionally supported, display the exact requested capability and obtain explicit user app ...[truncated 408 chars]
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (7)

Lp3

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding
The skill instructs the agent to execute a local Python script, read optional context files, and write reports, but it declares no explicit tool scope or permission boundaries. That creates unnecessary ambient authority: an agent may invoke shell, read arbitrary user-supplied paths, and write output files without a transparent allowlist, increasing the chance of unintended file access or command execution in normal use.

Vague Triggers

Medium
Confidence
93% confidence
Finding
The activation guidance uses very broad phrases like 'red team,' 'stress test,' 'devil's advocate,' and especially 'what could go wrong,' which can match common conversational requests outside the user's intent to invoke this skill. In a skill that triggers shell execution and file operations, overbroad activation raises the risk of accidental invocation, causing unnecessary command execution, report generation, or processing of local files when the user only wanted a normal discussion.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The script forwards the user question, generated debate text, and optional context to external AI CLIs without an explicit disclosure or consent checkpoint. In practice, users may paste confidential business plans, regulated data, or internal documents, and this skill's purpose encourages exactly that kind of sensitive strategic content, increasing the likelihood of inadvertent data exfiltration to third-party services.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
cmd, stdin_data = _build_cmd(backend, system, user_msg, model)

    try:
        result = subprocess.run(
            cmd,
            capture_output=True,
            text=True,
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
# Check backend CLI is available
    backend_info = BACKENDS.get(args.backend, {})
    try:
        subprocess.run(backend_info["check"], capture_output=True, timeout=10)
    except FileNotFoundError:
        print(f"Error: '{args.backend}' CLI not found. Install: {backend_info.get('install', 'unknown')}", file=sys.stderr)
        sys.exit(1)
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The script reads an arbitrary local context file and later includes its contents in prompts sent to external AI backends, but it does not clearly warn the user that file contents may leave the local system. This is dangerous because users may supply internal memos, customer data, or secrets as context for red-team analysis, unintentionally transmitting sensitive file contents to a remote provider.

Missing User Warnings

Low
Confidence
79% confidence
Finding
This code performs a filesystem write when --output is provided. While the path is user-specified and the behavior is expected, there is no pre-write warning, comment, or help text noting that existing files may be overwritten depending on the path chosen.

Static analysis

Detected: suspicious.prompt_injection_instructions

Prompt-injection style instruction pattern detected.

Warn
Code
suspicious.prompt_injection_instructions
Location
references/personas.md:7