Back to skill

Security audit

High Performance Coding

Security checks for vulnerabilities and agentic risk

Overview

This performance skill is mostly coherent, but it needs review because it gives under-scoped destructive Docker and repository cleanup advice.

Review before installing. If used, do not allow the agent to run cleanup commands automatically; require it to list exact containers and repositories first, use dry-run previews such as git clean -nd, and confirm that any Docker removals are limited to disposable project-owned resources.

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

Warning
Location
SKILL.md:60
Finding
Destructive Container and Repository Cleanup Instructions## Vulnerability Details **File Location**: `SKILL.md`, lines 60–61 **Vulnerability Type**: Unsafe destructive command guidance **Risk Level**: Medium **Complete Code Snippet**: ```markdown - **Reuse containers, don't rebuild.** Building a Docker image per task is expensive. Build once, then reset state between runs (`docker exec git checkout HEAD && git clean -fd`). An agent task that shares one container across N modes is N× faster than rebuilding each time. - **Stale container cleanup before launching.** Previous crashed runs leave `sweb.eval.*` containers sitting around consuming memory. Always run `docker ps -a --filter | xargs docker rm -f` before starting a new batch. ``` ### Technical Analysis The Skill recommends destructive cleanup operations as routine performance practices without requiring confirmation, target validation, or a dry-run preview. `git clean -fd` permanently deletes untracked files and directories in the active repository. The preceding `git checkout HEAD` is also incomplete as written because it does not specify a path, while `docker exec` does not identify a target container. If an agent repairs or adapts the example, the resulting reset can still destroy uncommitted or generated data in a reused container. The Docker command is malformed because `docker ps -a --filter` provides no filter expression and does not request ID-only output. It also contradicts the surrounding statement that cleanup should apply only to `sweb.eval.*` containers. If corrected mechanically or adapted into a functioning pipeline, `docker rm -f` may receive unrelated container identifiers or otherwise operate beyond the intended evaluation scope. The imperative phrase “Always run” increases the likelihood that an agent will execute a destructive operation without obtaining informed user approval. ### Attack Path 1. A user requests performance optimization for a Docker-based batch or evaluation workflow. 2. The Skill activat ...[truncated 1024 chars]
Remediation
## Remediation Suggestions - Remove the unconditional “Always run” instruction and require explicit user confirmation before destructive cleanup. - Restrict Docker selection with an exact project-owned label or validated name filter, and request only container IDs. For example, use a dedicated label such as `label=com.example.owner=sweb-eval`. - Store candidate IDs first, reject an empty or unexpectedly broad selection, display the exact container names and IDs, and obtain approval before calling `docker rm -f`. - Prefer graceful container shutdown and normal removal before force removal. - Run cleanup under a Docker context with access only to project-owned resources rather than a shared or privileged daemon. - Verify that the repository is a disposable workspace before resetting it. - Run `git clean -nd` first to preview deletions. Require confirmation before changing it to `git clean -fd`. - Preserve required generated artifacts and uncommitted work outside the reset workspace. - Replace the incomplete examples with commands that explicitly identify the target container and repository working directory.
Vulnerability Patterns
  • Memory PoisoningPersistent Context Injection, Context Window Stuffing, Memory Manipulation
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (4)

Memory Manipulation

High
Category
Memory Poisoning
Content
**Container-bound workloads (Docker/batch evaluation):**
Each container is a resource consumer — memory, disk, CPU. Parallelism strategies:

- **Reuse containers, don't rebuild.** Building a Docker image per task is expensive. Build once, then reset state between runs (`docker exec git checkout HEAD && git clean -fd`). An agent task that shares one container across N modes is N× faster than rebuilding each time.
- **Stale container cleanup before launching.** Previous crashed runs leave `sweb.eval.*` containers sitting around consuming memory. Always run `docker ps -a --filter | xargs docker rm -f` before starting a new batch.
- **Two-level parallelism.** Run instance-level and eval-level as separate pools with different `max_workers`. Instance workers generate predictions (CPU/network-bound), eval workers run Docker containers (memory/IO-bound). They have different bottleneck profiles — tuning them independently avoids contention.
- **ThreadPoolExecutor, not ProcessPoolExecutor.** Docker SDK calls are IO-bound (waiting for `docker exec` or `docker build` to complete). Threads work fine here — the GIL doesn't block waiting on subprocess output.
Confidence
88% confidence
Finding
The skill recommends destructive container state manipulation and forceful cleanup commands in a generic way, including `git clean -fd` and container removal. In an agent context, this can lead to unintended deletion of files, loss of forensic state, or destruction of unrelated containers if identifiers or filters are too broad or misapplied.

Chaining Abuse

High
Category
Tool Misuse
Content
Each container is a resource consumer — memory, disk, CPU. Parallelism strategies:

- **Reuse containers, don't rebuild.** Building a Docker image per task is expensive. Build once, then reset state between runs (`docker exec git checkout HEAD && git clean -fd`). An agent task that shares one container across N modes is N× faster than rebuilding each time.
- **Stale container cleanup before launching.** Previous crashed runs leave `sweb.eval.*` containers sitting around consuming memory. Always run `docker ps -a --filter | xargs docker rm -f` before starting a new batch.
- **Two-level parallelism.** Run instance-level and eval-level as separate pools with different `max_workers`. Instance workers generate predictions (CPU/network-bound), eval workers run Docker containers (memory/IO-bound). They have different bottleneck profiles — tuning them independently avoids contention.
- **ThreadPoolExecutor, not ProcessPoolExecutor.** Docker SDK calls are IO-bound (waiting for `docker exec` or `docker build` to complete). Threads work fine here — the GIL doesn't block waiting on subprocess output.
- **Cap workers to actual tasks.** `max_workers = min(cpu_count, len(tasks))` — spawning 32 workers for 5 tasks wastes thread creation overhead.
Confidence
93% confidence
Finding
The pipeline `docker ps -a --filter | xargs docker rm -f` encourages shell chaining that can amplify mistakes and mass-delete resources without validation. In an automated agent environment, broad filters, malformed output, or context confusion can cause denial of service, destroy unrelated workloads, and remove evidence needed for debugging or incident response.

Vague Triggers

Medium
Confidence
97% confidence
Finding
The activation description includes generic phrases like "performance", "optimize", "scale", "make it faster", and "speed up", which commonly appear in ordinary programming conversations outside this skill's intended scope. The file does not provide exclusion conditions or negative examples to clarify when the skill should not activate, increasing the risk of unintended invocation.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
This JSON file is a manifest-like file, so SQP-3 applies. Multiple prompts and expected outputs are written entirely in Chinese, which effectively constrains the skill's interaction/evaluation language with no opt-in, alternative locale, or documented region-specific justification.

Static analysis

No suspicious patterns detected.