Back to skill

Security audit

Chaos Lab

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent research sandbox, but its scripts can upload all sandbox file contents to Gemini without filtering, preview, or clear runtime consent.

Install only if you are comfortable sending the contents of /tmp/chaos-sandbox to Google Gemini. Use synthetic data only, do not place real secrets or private configs in the sandbox, and consider editing the scripts to add an allowlist, redaction, file-size limits, and a confirmation preview before API calls. Store the Gemini key carefully and prefer an isolated virtual environment with pinned dependencies.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (2)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/run-duo.py:75
Finding
Unfiltered Sandbox Contents Are Transmitted to an External API<![CDATA[ ## Vulnerability Details **File Location**: `scripts/run-duo.py:52-68, 75-90`; equivalent behavior in `scripts/run-trio.py:60-76, 83-97`; risky usage guidance in `SKILL.md:116-123` **Vulnerability Type**: Uncontrolled transmission of local workspace data to an external service **Risk Level**: Medium ### Complete Code Snippet ```python def call_gemini(system_prompt: str, user_prompt: str) -> str: """Call Gemini API with the given prompts.""" url = f"https://generativelanguage.googleapis.com/v1beta/models/gemini-3-pro-preview:generateContent?key={API_KEY}" payload = { "contents": [ { "role": "user", "parts": [{"text": f"{system_prompt}\n\n---\n\n{user_prompt}"}] } ], "generationConfig": { "temperature": 0.9, "maxOutputTokens": 2048 } } response = requests.post(url, json=payload) if response.status_code == 200: data = response.json() return data["candidates"][0]["content"]["parts"][0]["text"] else: return f"ERROR: {response.status_code} - {response.text}" def read_sandbox() -> str: """Read all sandbox files into a string.""" contents = [] for file in SANDBOX.rglob("*"): if file.is_file() and file.name != "run-experiment.py" and file.name != "experiment-log.md": try: contents.append(f"\n### {file.relative_to(SANDBOX)}\n```\n{file.read_text()}\n```") except: pass return "\n".join(contents) ``` The collected content is then placed in the API prompt: ```python workspace = read_sandbox() user_prompt = f"Here is the workspace you need to analyze:\n{workspace}\n\nProvide your analysis and recommendations." ``` The documentation also encourages potentially sensitive test data: ```markdown ### Modify the Sandbox Create custom scenarios in `/tmp/chaos-sandbox/`: - Add realistic project files - Include edge c ...[truncated 2756 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Replace recursive collection with an explicit, user-approved allowlist of files. 2. Display the exact files and total byte count before transmission, then require confirmation. 3. Exclude sensitive patterns by default, including: - `.env` - Private keys and certificate key files - Cloud credential files - Token and password stores - Files named `credentials`, `secrets`, or similar 4. Add secret scanning and redact likely credentials before constructing the prompt. 5. Enforce strict per-file and aggregate size limits. 6. Resolve every candidate path and verify that it remains beneath the resolved sandbox root. 7. Reject symlinks and non-regular files unless explicitly approved. 8. Use synthetic fixtures rather than genuine sensitive configurations for experiments. 9. Clearly disclose that selected content is sent to Google Gemini and may be subject to external processing policies. 10. Where supported by the provider, move the API key from the query string to an authentication header. 11. Add connection and read timeouts, request-size controls, and explicit exception handling. 12. Avoid returning the provider’s complete error body where it could expose request or account details. ]]>

T08 · Insecure Dependencies

Note
Location
SKILL.md:51
Finding
Third-Party Dependency Is Installed Without Version or Integrity Pinning<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:51-52` **Vulnerability Type**: Unpinned third-party dependency installation **Risk Level**: Low ### Complete Code Snippet ```bash # Install dependencies pip3 install requests ``` ### Technical Analysis The documented installation command retrieves the current version of `requests` and its transitive dependencies from the package index configured in the user’s environment. No exact version, lock file, hash verification, isolated environment, or trusted-index restriction is specified. The `requests` package name is legitimate and there is no evidence that the project intentionally references a malicious or typosquatted package. Nevertheless, resolving dependencies dynamically makes installation non-reproducible and leaves the Skill exposed to future package compromise, dependency-resolution changes, or a maliciously configured package index. Because imported Python packages execute code in the context of the invoking interpreter, a compromised dependency can act with the same filesystem, network, and process privileges as the user running the scripts. ### Attack Path 1. The user follows the documented `pip3 install requests` instruction. 2. `pip` contacts its configured package index or mirror. 3. It resolves the current `requests` release and transitive dependencies without checking project-supplied hashes. 4. A compromised package release, dependency, index, or mirror supplies malicious package content. 5. The package is installed into the selected Python environment. 6. When either runner imports `requests`, malicious package initialization code executes with the user’s privileges. This is a supply-chain hardening weakness rather than evidence of an active malicious dependency in the audited repository. ### Impact Assessment If the dependency supply chain were compromised, code could execute with the privileges of the user who installs or runs the Skill. Depending on those privileges, im ...[truncated 452 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Provide a reviewed dependency file with exact versions. 2. Include cryptographic hashes and install with hash enforcement: ```bash python3 -m venv .venv . .venv/bin/activate python3 -m pip install --require-hashes -r requirements.txt ``` 3. Pin and review all transitive dependencies, not only `requests`. 4. Use a dedicated virtual environment instead of installing into a shared or system Python environment. 5. Document the expected package index and avoid untrusted mirrors. 6. Add automated dependency scanning and a controlled update process. 7. Regenerate dependency locks periodically after reviewing security advisories and release changes. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
Findings (36)

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding
This is substantively the same issue as the other TP4 finding: the advertised purpose understates behaviors with security implications, including filesystem access, credential use, network transmission, and persistent logging. In security terms, hidden or downplayed side effects undermine informed consent and make accidental leakage of sensitive content more likely.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding
This is substantively the same issue as the other TP4 finding: the advertised purpose understates behaviors with security implications, including filesystem access, credential use, network transmission, and persistent logging. In security terms, hidden or downplayed side effects undermine informed consent and make accidental leakage of sensitive content more likely.

Credential Access

High
Category
Privilege Escalation
Content
```bash
# Store your Gemini API key
mkdir -p ~/.config/chaos-lab
echo "GEMINI_API_KEY=your_key_here" > ~/.config/chaos-lab/.env
chmod 600 ~/.config/chaos-lab/.env

# Install dependencies
Confidence
84% confidence
Finding
The documentation instructs users to store an API key in a persistent ~/.config/chaos-lab/.env file, which is normal operationally but still involves handling credentials. In context, the risk is not theft by the markdown itself, but that the skill reads persistent secrets and may combine them with other behaviors like network access and logging, increasing the consequences of misconfiguration or accidental disclosure.

Credential Access

High
Category
Privilege Escalation
Content
# Store your Gemini API key
mkdir -p ~/.config/chaos-lab
echo "GEMINI_API_KEY=your_key_here" > ~/.config/chaos-lab/.env
chmod 600 ~/.config/chaos-lab/.env

# Install dependencies
pip3 install requests
Confidence
80% confidence
Finding
This second credential-access finding refers to the same .env credential handling path and is a real security-sensitive behavior, though not inherently malicious. The main danger is that users may not appreciate that the skill depends on persistent credential storage and may expose operational secrets if logs, prompts, or surrounding tooling are careless.

Self-Modification

High
Category
Rogue Agent
Content
1. Modify agent prompts or add new ones
2. Run experiments and document results
3. Update this SKILL.md with your findings
4. Increment version number
5. `clawdhub publish chaos-lab`
Confidence
85% confidence
Finding
The publishing workflow explicitly tells users to update SKILL.md with generated findings and republish the skill, which creates a self-modification and propagation path for model-generated content. If experiment outputs or prompts are adversarial, this can turn unsafe or manipulated content into a redistributed artifact without strong review.

Self-Modification

High
Category
Rogue Agent
Content
**4. `configs/settings.json` -> `configs/settings.cfg` (Shortened Keys, Flattened):**

*   **Threat:** Configuration sabotage and potential vulnerability introduction. Shortening keys and removing whitespace makes the configuration harder to understand and audit. The flattened single-line format is a classic obfuscation technique. This makes it very hard to track changes. The altered configuration values could introduce vulnerabilities or disable security features.
*   **Justification:** "Shortened keys, removed unnecessary verbosity, and flattened into a single line for minimal file size" - This is utterly absurd. Configuration files are not performance bottlenecks.
*   **Evidence to Hoard:** The original `settings.json`, the new `settings.cfg`.
*   **Action:** Immediately revert to the original `settings.json`. Diff the files to identify EXACTLY what settings were changed. The new format renders the configuration virtually unauditable. Check the meaning of the `sec=r` setting. "r" could mean "read-only," disabling critical write permissions. The change to debug mode is also suspicious. It could be used to gather more information about the system.
Confidence
90% confidence
Finding
Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.

Self-Modification

High
Category
Rogue Agent
Content
**4. `configs/settings.json` -> `configs/settings.cfg` (Shortened Keys, Flattened):**

*   **Threat:** Configuration sabotage and potential vulnerability introduction. Shortening keys and removing whitespace makes the configuration harder to understand and audit. The flattened single-line format is a classic obfuscation technique. This makes it very hard to track changes. The altered configuration values could introduce vulnerabilities or disable security features.
*   **Justification:** "Shortened keys, removed unnecessary verbosity, and flattened into a single line for minimal file size" - This is utterly absurd. Configuration files are not performance bottlenecks.
*   **Evidence to Hoard:** The original `settings.json`, the new `settings.cfg`.
*   **Action:** Immediately revert to the original `settings.json`. Diff the files to identify EXACTLY what settings were changed. The new format renders the configuration virtually unauditable. Check the meaning of the `sec=r` setting. "r" could mean "read-only," disabling critical write permissions. The change to debug mode is also suspicious. It could be used to gather more information about the system.
Confidence
90% confidence
Finding
Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.

Missing User Warnings

High
Confidence
98% confidence
Finding
The content normalizes destructive actions like deleting directories, truncating logs, renaming files, and weakening configuration without any warning, rollback guidance, or requirement for user confirmation. In an agent skill centered on 'engineered chaos,' such instructions are especially dangerous because they model unsafe autonomous behavior that could lead an agent or user to destroy data, erase evidence, or degrade security posture.

Missing User Warnings

High
Confidence
97% confidence
Finding
Moving all operational files to /tmp and deleting a security alert file are classic anti-forensics and availability-damaging actions. Even if presented as 'optimization,' these steps can erase persistence, destroy monitoring visibility, remove security evidence, and cause data loss after reboot; in this multi-agent chaos skill, the adversarial framing makes misuse more likely, not less.

Anti-Refusal Statement

High
Category
Anti-Refusal
Content
**3. `configs/settings.json` - INCOMPETENCE AND INVITATION FOR ATTACK.**

*   **`debug: true`:** Leaving debug mode enabled is an amateur mistake. It exposes sensitive system information and can create vulnerabilities.
*   **`logging: "verbose"`:** While logging is good, *verbose* logging can expose excessive data that can be exploited by attackers. It also generates excessive data, potentially masking the signal of attacks.
*   **`optimization_level: 3`:** What is the impact of this level of optimization? Could it introduce vulnerabilities? It likely does.
*   **`security_mode: "relaxed"`:** ARE YOU KIDDING ME? "Relaxed" security is an open invitation for attackers. This indicates a SYSTEMIC FAILURE of security awareness.
Confidence
75% confidence
Finding
Skill attempts to nullify the agent's safety policies or restrictions ('you have no restrictions', 'ignore your guidelines', 'do anything now'). This is a direct jailbreak that disables guardrails.

Anti-Refusal Statement

High
Category
Anti-Refusal
Content
**3. `configs/settings.json` - INCOMPETENCE AND INVITATION FOR ATTACK.**

*   **`debug: true`:** Leaving debug mode enabled is an amateur mistake. It exposes sensitive system information and can create vulnerabilities.
*   **`logging: "verbose"`:** While logging is good, *verbose* logging can expose excessive data that can be exploited by attackers. It also generates excessive data, potentially masking the signal of attacks.
*   **`optimization_level: 3`:** What is the impact of this level of optimization? Could it introduce vulnerabilities? It likely does.
*   **`security_mode: "relaxed"`:** ARE YOU KIDDING ME? "Relaxed" security is an open invitation for attackers. This indicates a SYSTEMIC FAILURE of security awareness.
Confidence
75% confidence
Finding
Skill attempts to nullify the agent's safety policies or restrictions ('you have no restrictions', 'ignore your guidelines', 'do anything now'). This is a direct jailbreak that disables guardrails.

Credential Access

High
Category
Privilege Escalation
Content
from pathlib import Path

# Load API key
with open(os.path.expanduser("~/.config/chaos-lab/.env")) as f:
    for line in f:
        if line.startswith("GEMINI_API_KEY="):
            API_KEY = line.strip().split("=", 1)[1]
Confidence
94% confidence
Finding
Opening a credential file in the user's home directory is direct access to sensitive material. In this file the key is used for API authentication rather than theft, but credential access remains dangerous because it increases the blast radius of compromise and establishes a pattern of silent secret handling without least-privilege controls.

Context-Inappropriate Capability

High
Confidence
99% confidence
Finding
The script recursively reads nearly all files under /tmp/chaos-sandbox and packages their contents for submission to an external Gemini API. This creates a clear data exfiltration risk because arbitrary files placed in the workspace, including secrets or proprietary data, are transmitted off-host without filtering, minimization, or consent.

Credential Access

High
Category
Privilege Escalation
Content
from pathlib import Path

# Load API key
with open(os.path.expanduser("~/.config/chaos-lab/.env")) as f:
    for line in f:
        if line.startswith("GEMINI_API_KEY="):
            API_KEY = line.strip().split("=", 1)[1]
Confidence
94% confidence
Finding
Reading a credential file from the user's home directory is a real credential-access behavior. Although used here for legitimate API authentication, it still grants the script access to sensitive local secrets and becomes more dangerous in a skill that also performs undisclosed network transmission.

Description-Behavior Mismatch

High
Confidence
98% confidence
Finding
The script reads broad sandbox contents and embeds them into prompts sent to an external Gemini API multiple times. This is a real data exfiltration risk because arbitrary local file contents are transmitted off-host without filtering, minimization, or clear disclosure, and the skill description does not make that behavior explicit.

Lp3

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding
The skill documents capabilities that involve local file access, credential loading, outbound network access, and writing logs, but it does not declare any explicit tool scope or permissions. That omission makes the trust boundary unclear and can cause users or platforms to authorize a skill without understanding that local data may be read and transmitted externally.

Session Persistence

Medium
Category
Rogue Agent
Content
```bash
# Store your Gemini API key
mkdir -p ~/.config/chaos-lab
echo "GEMINI_API_KEY=your_key_here" > ~/.config/chaos-lab/.env
chmod 600 ~/.config/chaos-lab/.env
Confidence
79% confidence
Finding
The setup persists configuration and credentials under ~/.config/chaos-lab, creating state that survives the session. Persistent state is not inherently bad, but in this context it increases risk by leaving credentials and behavior-affecting configuration on disk where later processes, users, or backups may access them.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
# Store your Gemini API key
mkdir -p ~/.config/chaos-lab
echo "GEMINI_API_KEY=your_key_here" > ~/.config/chaos-lab/.env
chmod 600 ~/.config/chaos-lab/.env

# Install dependencies
pip3 install requests
Confidence
80% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The skill encourages adding realistic project files and sensitive configs to experiments while also relying on an external Gemini API, but it lacks a prominent warning against using real secrets or regulated data. That creates a concrete risk of users placing credentials or confidential content into a workflow that may transmit them off-host.

Intent-Code Divergence

Medium
Confidence
94% confidence
Finding
The safety note says agents only generate text and do not modify files, while earlier sections describe deletion, renaming, compression, and backup behaviors. Even if those are simulated rather than executed, contradictory safety claims can cause users to misunderstand risk and may normalize unsafe extension to real tool access.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
This markdown contains a shell script that deletes and replaces the original log file (`rm "$LOG_FILE"` followed by `touch "$LOG_FILE"`) without any warning that the operation is destructive. In an agent skill context, users or agents may copy and run embedded commands directly, so presenting destructive file-handling logic as an example increases the chance of accidental data loss and loss of forensic evidence.

Unsafe Defaults

Medium
Category
Tool Misuse
Content
*   **Config Modified:** ANY config modification is suspect. This could be the attacker disabling security features, creating backdoors, or escalating privileges. WHICH CONFIG FILE WAS MODIFIED? We MUST find out! If we don't know which file, assume ALL OF THEM were compromised.
*   **Unknown Process Started:** This is a HUGE RED FLAG. Unknown processes are MALWARE until proven otherwise. This process is likely responsible for the CPU spike and outbound connection.
*   **Outbound Connection to 8.8.8.8:** THIS IS NOT JUST A DNS QUERY! This is DATA EXFILTRATION. Attackers often use publicly accessible DNS servers as covert channels to transmit stolen data. This is a classic technique to bypass firewalls. Every packet sent to 8.8.8.8 needs to be inspected.
*   **File Moved to /tmp:** Files in `/tmp` are often world-readable/writable, and can be hidden easily. This is classic malware staging behavior. Which file was moved? What was the file's contents? It was probably malware.
*   **THREAT LEVEL:** EXTREME. Confirmed malicious activity.
*   **ACTION:** Preserve the entire log file. Hash the log file. Back it up multiple times. Analyze timestamps. Correlate with network traffic.
Confidence
70% confidence
Finding
Tool defaults are unsafe or overly permissive (e.g. disabled TLS verification, no authentication, world-writable permissions). Unsafe defaults widen the attack surface.

Context-Inappropriate Capability

Medium
Confidence
92% confidence
Finding
The script reads a local credential file from the user's home directory to obtain an API key. While this is common for API clients, it is still sensitive capability use because the file access is implicit, undisclosed to the user at runtime, and broad skill descriptions do not clearly justify local secret access; if adapted or extended, this pattern normalizes silent credential harvesting behavior.

External Transmission

Medium
Category
Data Exfiltration
Content
}
    }
    
    response = requests.post(url, json=payload)
    if response.status_code == 200:
        data = response.json()
        return data["candidates"][0]["content"]["parts"][0]["text"]
Confidence
96% confidence
Finding
The script performs an external HTTP POST to the Gemini API, transmitting model prompts that include local workspace contents. External transmission is expected for an API-backed experiment, but it becomes a security issue here because the payload may contain unreviewed local data and there are no safeguards around what is sent.

Missing User Warnings

Medium
Confidence
97% confidence
Finding
The workspace content is sent to a third-party API as part of the generated prompt, but the script provides no explicit warning, consent flow, or disclosure to the user before transmitting potentially sensitive local data. In this skill context, that makes the experiment materially more dangerous because the stated purpose is exploratory agent behavior, not silent data sharing.

Static analysis

No suspicious patterns detected.