Back to skill

Security audit

Multi Agent Codegen

Security checks for vulnerabilities and agentic risk

Overview

This code-generation skill largely does what it claims, but it automatically modifies the Python environment and sends user requirements and generated artifacts to a third-party LLM service without enough user control.

Review this skill before installing. It is not clearly malicious, but running it can install Python packages automatically, may bypass Python environment protections, uses EM_API_KEY or MINIMAX_API_KEY, sends your requirements and generated code/tests/review to MiniMax, and saves outputs under ~/.openclaw. Use it only with non-sensitive requirements, preferably in an isolated virtual environment or disposable workspace, and review dependencies before first run.

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)

T08 · Insecure Dependencies

Warning
Location
scripts/cli.sh:29
Finding
Automatic Installation of Unpinned Dependencies with PEP 668 Protection Bypass## Vulnerability Details **File Location**: `scripts/cli.sh:29-52`; dependency constraints are defined in `requirements.txt:1-3` **Vulnerability Type**: Unsafe automatic dependency installation and package-management protection bypass **Risk Level**: Medium **Vulnerable code in `scripts/cli.sh`:** ```bash # 首次运行:检查依赖,没有就提示安装 if ! "$PY" -c "import langgraph, langchain_anthropic" 2>/dev/null; then echo "⚠️ 检测到首次运行,需要安装依赖..." >&2 # 检测 PEP 668(Debian/Ubuntu 系统 Python 保护) # 用 set +e +o pipefail 同时禁用错误退出和 pipefail # (因为 pip dry-run 遇到 PEP 668 会 exit 1,但 grep 找到需要退出 0) PEP668_FLAG="" set +e +o pipefail "$PY" -m pip install --dry-run -r "$REQ" 2>&1 | grep -q "externally-managed-environment" PEP668_DETECTED=$? set -e -o pipefail if [[ $PEP668_DETECTED -eq 0 ]]; then PEP668_FLAG="--break-system-packages" echo " 检测到 PEP 668 保护,自动加 --break-system-packages" >&2 fi echo " 自动执行:$PY -m pip install $PEP668_FLAG -r $REQ" >&2 "$PY" -m pip install $PEP668_FLAG --user -r "$REQ" 2>&1 | tail -5 if ! "$PY" -c "import langgraph, langchain_anthropic" 2>/dev/null; then echo "❌ 依赖安装失败,请手动:$PY -m pip install $PEP668_FLAG -r $REQ" >&2 exit 1 fi echo "✅ 依赖装好" >&2 fi ``` **Dependency constraints in `requirements.txt`:** ```text langgraph>=1.2.0 langchain-anthropic>=1.4.0 pytest>=9.0.0 ``` ### Technical Analysis The CLI automatically invokes `pip` when the required imports are unavailable. All three dependencies use open-ended lower-bound constraints and have neither exact version pins nor package hashes. A future release satisfying these constraints is therefore eligible for automatic installation without having been reviewed as part of this skill. Python package installation can execute package build hooks and other installation-time behavior with the privileges of the user running the skill. Thi ...[truncated 2249 chars]
Remediation
## Remediation Suggestions 1. Remove automatic installation into the current or OS-managed interpreter. Create and use a dedicated virtual environment under the skill directory or an approved application data directory. 2. Never add `--break-system-packages` automatically. If an externally managed environment is detected, stop with a clear instruction to create an isolated virtual environment. 3. Replace open-ended dependency constraints with an auditable lockfile containing exact versions for direct and transitive dependencies. 4. Use `pip --require-hashes` with hashes generated from trusted artifacts to prevent unreviewed package substitutions. 5. Require explicit user confirmation before any network-backed installation, and clearly identify the package index and packages to be installed. 6. Remove `langgraph` because the current Python implementation does not use it. Remove `pytest` from runtime dependencies unless the skill actually executes tests. 7. Add automated dependency review, vulnerability scanning, and controlled lockfile update procedures. 8. Consider installing from a trusted internal package mirror or otherwise restricting the approved package source.

T09 · Insecure Skill Coding Practices

Note
Location
scripts/multi_codegen.py:343
Finding
Predictable Output Files Can Follow Attacker-Controlled Symbolic Links## Vulnerability Details **File Location**: `scripts/multi_codegen.py:343-348` **Vulnerability Type**: Symbolic-link file overwrite **Risk Level**: Low **Vulnerable code:** ```python out_dir = Path.home() / ".openclaw/workspace-coding-advisor/output/multi_agent_codegen" out_dir.mkdir(parents=True, exist_ok=True) (out_dir / "plan.md").write_text(result["plan"], encoding="utf-8") (out_dir / "code.py").write_text(result["code"], encoding="utf-8") (out_dir / "test_code.py").write_text(result["tests"], encoding="utf-8") (out_dir / "refine.md").write_text(result["refine_feedback"], encoding="utf-8") ``` ### Technical Analysis The application writes generated content to four fixed, predictable paths on every run. `Path.write_text()` opens an existing destination using normal symbolic-link-following behavior. The code does not verify that the output directory is owned by the expected user, that directory components are not symbolic links, or that each destination is a regular file. Consequently, an attacker who can modify the output directory can replace one of the predictable output files with a symbolic link to another file writable by the victim. The next skill run then truncates and overwrites the link target with LLM-generated plan, code, test, or review content. The check and write would also need to be atomic: a separate `is_symlink()` check followed by `write_text()` would remain vulnerable to a time-of-check/time-of-use race. Secure creation should use no-follow semantics and an atomic replacement strategy within a trusted directory. ### Attack Path 1. An attacker obtains write access to `~/.openclaw/workspace-coding-advisor/output/multi_agent_codegen/`, or replaces an untrusted directory component before the victim runs the skill. 2. The attacker creates a symbolic link with one of the predictable names, for example: ```bash ln -s "$HOME/.config/example.conf" \ "$HOME/.openclaw/workspace-coding- ...[truncated 1139 chars]
Remediation
## Remediation Suggestions 1. Create a new unpredictable per-run output directory rather than repeatedly overwriting fixed filenames. 2. Ensure the base output directory is owned by the invoking user and has restrictive permissions such as `0700`. 3. Reject symbolic links in every relevant directory component and reject non-regular destination files. 4. On platforms that support it, open destination files with `os.open()` using `O_NOFOLLOW`, `O_CREAT`, and `O_EXCL`, then write through the returned file descriptor. 5. For replaceable output, create a temporary regular file securely in the verified destination directory, flush and close it, and atomically rename it into place only after validating the destination policy. 6. Do not rely solely on `Path.is_symlink()` before `write_text()`, because an attacker could replace the path between validation and opening. 7. If existing outputs must be preserved, fail safely when a destination already exists or require explicit user approval before replacement.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
Findings (24)

Lp3

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding
The skill advertises capabilities that can modify the local environment and write files, but it declares no explicit tool scope or permissions boundary. In a code-generation skill, this makes it easier for the agent to perform dependency installation and filesystem writes without transparent authorization, increasing the risk of unintended system changes or abuse if invoked too broadly.

Vague Triggers

Medium
Confidence
95% confidence
Finding
The trigger phrases like '做个软件', '开发工具', and '写个脚本' are extremely broad and overlap with common user requests, making accidental or overbroad activation likely. Because this skill can generate code, install dependencies, and write files, ambiguous triggering materially raises the chance that powerful behavior is invoked in contexts where the user did not intend it.

Session Persistence

Medium
Category
Rogue Agent
Content
## 架构(半串行 + 循环)

```
START → Plan → Write → Test → Refine → 条件分支
                                       ├─ score >= 70 → END
                                       └─ score < 70 → Write(带 Refine 反馈重写)
```
Confidence
60% confidence
Finding
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Session Persistence

Medium
Category
Rogue Agent
Content
## 架构(半串行 + 循环)

```
START → Plan → Write → Test → Refine → 条件分支
                                       ├─ score >= 70 → END
                                       └─ score < 70 → Write(带 Refine 反馈重写)
```
Confidence
60% confidence
Finding
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The documentation states that first run will automatically detect and install dependencies and that outputs are written to a fixed directory, but it does not clearly warn the user about these system modifications beforehand. Automatic package installation and filesystem writes are high-risk side effects because they can alter the execution environment, consume resources, or overwrite/create persistent artifacts without informed consent.

Vague Triggers

Medium
Confidence
88% confidence
Finding
The applicability section uses subjective conditions like '复杂需求' and broad phrases such as '做个软件/工具/脚本', which are not reliable invocation boundaries. In this context, unclear applicability increases the chance of unnecessary activation of a workflow that produces code and persistent artifacts, amplifying the operational risk.

Context-Inappropriate Capability

Medium
Confidence
93% confidence
Finding
The CLI silently installs dependencies on first run and may invoke pip with --break-system-packages, which can modify the user's Python environment beyond the stated code-generation function. This creates supply-chain and environment-integrity risk because running the skill can unexpectedly change host state and pull code from package indexes without explicit approval.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The script performs environment-modifying pip installs without an interactive confirmation step, and even auto-adds --break-system-packages when PEP 668 is detected. In the context of an AI codegen skill, silently changing the user's Python setup is broader than expected behavior and can lead to unintended system disruption or execution of unreviewed third-party package code.

Missing User Warnings

Medium
Confidence
83% confidence
Finding
The script reads EM_API_KEY and MINIMAX_API_KEY from the environment and exports them to the child process, but provides no disclosure in comments or user-visible messaging that credentials will be consumed and passed through. For safety-sensitive credential handling, some form of warning or documentation should be present.

Ssd 3

Medium
Confidence
84% confidence
Finding
User-supplied natural-language requirements are injected into agent prompts and then echoed into downstream artifacts, creating prompt-persistence across stages and disk storage. This can preserve malicious prompt content or sensitive business instructions and reintroduce them to later agents, amplifying prompt-injection and data-retention risks.

Ssd 4

Medium
Confidence
87% confidence
Finding
The multi-stage loop promotes outputs from earlier agents into authoritative context for later agents and retries, so a malicious or compromised intermediate output can steer subsequent code, tests, and refinements. This architectural pattern increases susceptibility to prompt injection, self-reinforcing errors, and unsafe instruction propagation.

External Transmission

Medium
Category
Data Exfiltration
Content
return ChatAnthropic(
        model="MiniMax-M3",
        api_key=api_key,
        base_url="https://api.minimaxi.com/anthropic",
    )
Confidence
94% confidence
Finding
The code is explicitly configured to transmit data to an external API endpoint, which creates a real data egress path for user requirements and generated artifacts. In a code-generation skill, this is especially relevant because prompts and outputs may contain sensitive source code, internal designs, or secrets pasted by users.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The pipeline sends the user's requirement, then generated code, tests, and refinement content to a third-party LLM service without any explicit warning, consent, or redaction step. If the requirement or generated artifacts contain proprietary logic, credentials, or sensitive internal data, they are transmitted off-host to an external provider.

Description-Behavior Mismatch

Medium
Confidence
93% confidence
Finding
The skill persistently writes generated plan, code, tests, and review output to a fixed directory under the user's home folder without explicit consent or a configurable destination. This exceeds the narrow expectation of transient code generation and can unintentionally retain sensitive prompts, proprietary code, or generated artifacts on disk.

Natural-Language Policy Violations

Medium
Confidence
90% confidence
Finding
The manifest description is written entirely in Chinese, which signals a language-specific presentation without any indication of user choice or opt-in. Under the language/locale policy, this can be a natural-language policy violation when the skill appears generally applicable rather than clearly region-specific.

Natural-Language Policy Violations

Low
Confidence
84% confidence
Finding
The top-level description is primarily in Chinese and specifies Chinese trigger phrases, but does not indicate that users may invoke or receive behavior in other languages. This can constitute a language-policy issue when the skill appears to assume a fixed language without opt-in or documented justification.

Unpinned Dependencies

Low
Category
Supply Chain
Content
langgraph>=1.2.0
langchain-anthropic>=1.4.0
pytest>=9.0.0
Confidence
94% confidence
Finding
The dependency is specified with a lower bound only, so builds may resolve to different versions over time, including versions with newly disclosed vulnerabilities or breaking changes. In a multi-agent code generation skill that orchestrates external libraries, this weakens supply-chain integrity and makes security review and reproduction harder.

Unverifiable Dependency: langgraph has 3 known advisory(ies) (CVE-2026-28277 (LangGraph checkpoint loading has unsafe msgpack deserialization); CVE-2026-48776 (LangGraph Python SDK is used to connect to running LangGraph API servers, manage); CVE-2026-28277 (LangGraph SQLite Checkpoint is an implementation of LangGraph CheckpointSaver th)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
86% confidence
Finding
The manifest references langgraph without an exact version while known advisories exist, so there is no way to verify from this file whether installation will select a patched or vulnerable release. In this skill context, langgraph is a core orchestration component, so a vulnerable resolved version could materially affect agent workflow execution and data handling.

Unpinned Dependencies

Low
Category
Supply Chain
Content
langgraph>=1.2.0
langchain-anthropic>=1.4.0
pytest>=9.0.0
Confidence
94% confidence
Finding
Using an unpinned version for langchain-anthropic allows installation of any future release above the minimum, which can introduce vulnerable or incompatible code without review. Because this skill relies on agentic LLM tooling, unexpected dependency changes can directly affect execution behavior and expand attack surface.

Unverifiable Dependency: langchain-anthropic has 2 known advisory(ies) (CVE-2026-55443 (LangChain: Path traversal and sandbox escape in LangChain file-search middleware); CVE-2026-55443 (LangChain: Path traversal and sandbox escape in LangChain file-search middleware)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
84% confidence
Finding
Because langchain-anthropic is unpinned and has known advisories in the broader LangChain ecosystem, the actual installed version may be vulnerable and this cannot be verified from the manifest alone. Given the skill's purpose of generating software through LLM-agent tooling, flaws in this dependency could influence file access, prompt handling, or execution boundaries.

Unpinned Dependencies

Low
Category
Supply Chain
Content
langgraph>=1.2.0
langchain-anthropic>=1.4.0
pytest>=9.0.0
Confidence
91% confidence
Finding
Pytest is also unpinned, which reduces reproducibility and may pull in a vulnerable or behavior-changing release during installation. Although this is primarily a test dependency, compromised or vulnerable test tooling can still affect CI environments and developer machines.

Unverifiable Dependency: pytest has 2 known advisory(ies) (CVE-2025-71176 (pytest has vulnerable tmpdir handling); CVE-2025-71176 (pytest has vulnerable tmpdir handling)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
78% confidence
Finding
Pytest has known advisories and is not pinned, so the file does not allow verification that a safe version will be installed. The risk is lower than for runtime dependencies, but vulnerable test dependencies can still impact CI pipelines, temporary file handling, and developer environments.

Context-Inappropriate Capability

Low
Confidence
76% confidence
Finding
The manifest describes a 4-agent pipeline that builds Python software, but it does not mention credential access or reliance on environment-held secrets. Although using an LLM backend may be implementation-related, reading EM_API_KEY or MINIMAX_API_KEY is still a sensitive capability that is not justified by the description alone.

Missing User Warnings

Low
Confidence
90% confidence
Finding
The skill writes multiple artifacts into the user's home directory without prior notice, which can leave behind sensitive requirements, generated code, and review commentary. While not inherently malicious, silent persistence increases privacy and data-handling risk, especially on shared systems.

Static analysis

No suspicious patterns detected.