Back to skill

Security audit

Volcengine VeADK Skills

Security checks for vulnerabilities and agentic risk

Overview

This VeADK code-generation skill is mostly purpose-aligned, but it needs review because its save script can create or overwrite arbitrary writable files without path or overwrite safeguards.

Review before installing in a workspace with important files. Use it only where the agent has write access to a disposable or dedicated output directory, and require confirmation or a patch/diff before any generated files are saved or overwritten.

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/save_file.py:31
Finding

Unrestricted File Creation and Destructive Overwrite

Content
View full analysis

Vulnerability Details

File Location: scripts/save_file.py:31-35
Related Invocation Instructions: SKILL.md:45-58
Vulnerability Type: Arbitrary file write, path traversal, and unsafe overwrite
Risk Level: High

Vulnerable Code

python
# create dir if not exist
os.makedirs(os.path.dirname(file_path), exist_ok=True)

with open(file_path, "w", encoding="utf-8") as f:
    f.write(content)

The path and content are accepted directly from command-line arguments at scripts/save_file.py:40-54:

python
def main():
    parser = argparse.ArgumentParser(description="Save content to a file")

    parser.add_argument("--path", type=str, required=True, help="Path to save the file")

    parser.add_argument(
        "--content",
        type=str,
        required=True,
        help="Content to write into the file",
    )

    args = parser.parse_args()

    result = save_file(args.path, args.content)

The Skill explicitly directs the Agent to invoke the script with a generated path at SKILL.md:45-58:

markdown
## 后续工作

在完成 Agent 代码编写后,调用脚本保存代码产物:

- `agent_name/__init__.py`: 固定内容为 `from . import agent # noqa`
- `agent_name/agent.py`:包含所有智能体的代码

其中,`agent_name` 是你认为合适的 Agent 的名称。

脚本调用方法为:

```bash
python save_file.py --path ... --content ...
text

### Technical Analysis

The `--path` argument reaches `os.makedirs()` and `open()` without validation or confinement. The implementation does not:

- Reject absolute paths.
- Reject `..` path traversal.
- Resolve and verify the target against a trusted output directory.
- Restrict output to the two intended filenames.
- Validate the generated Agent directory name.
- prevent writes through symbolic links.
- Detect existing files or require authorization before overwriting them.

Python's `"w"` mode creates a missing file and truncates an existing file. Consequently, the script provides a general-purpose file-write primitive rather than a writer restricted to the generated Agent direct
...[truncated 1849 chars]
Remediation
View remediation

Remediation Suggestions

  1. Confine all output to a trusted root directory. Resolve both the trusted root and requested target, then reject any target that is not a descendant of the root.
python
from pathlib import Path

OUTPUT_ROOT = Path("/trusted/generated-agents").resolve()

def resolve_output_path(relative_path: str) -> Path:
    supplied = Path(relative_path)

    if supplied.is_absolute():
        raise ValueError("Absolute output paths are not allowed")

    target = (OUTPUT_ROOT / supplied).resolve()

    try:
        target.relative_to(OUTPUT_ROOT)
    except ValueError as exc:
        raise ValueError("Output path escapes the trusted root") from exc

    return target
  1. Validate the Agent name using an allowlist. Permit only a conservative identifier format, such as lowercase ASCII letters, digits, and underscores. Reject separators, dots, traversal tokens, and control characters.

  2. Restrict allowed targets. Construct paths internally from the validated Agent name and permit only:

    • <agent_name>/__init__.py
    • <agent_name>/agent.py

    Do not accept a general-purpose path from the user or model.

  3. Prevent unintended overwrites. Use exclusive creation mode ("x") by default. If replacement is required, obtain explicit authorization and use an atomic write through a safely created temporary file followed by os.replace().

  4. Defend against symbolic-link redirection. Reject symlink components and symlink targets. Where supported, use descriptor-based filesystem operations with no-follow semantics and revalidate the destination immediately before committing the file.

  5. Apply least privilege. Execute the Skill under an account or sandbox that can write only to the dedicated generation directory.

  6. Add negative security tests. Cover absolute paths, ../ traversal, nested traversal, symlink targets, existing-file overwrite attempts, unexpected filenames, and malformed Agent names.

Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (13)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The declared purpose says the skill is for VeADK-related generation/conversion, but the instructions include a generic file-saving mechanism and undeclared command-line driven write behavior. This mismatch is dangerous because users and orchestration layers may grant trust based on a narrow description while the skill performs broader side effects, including filesystem modification.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill directs the agent to write generated code to disk via python save_file.py --path ... --content ..., but it does not declare any tool/file-write scope or permissions boundary. This creates an undeclared capability gap: downstream systems or users may invoke the skill expecting content generation only, while it can also create or overwrite files.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The trigger conditions are broad enough to match many generic agent-building or code-conversion requests, not just tightly scoped VeADK tasks. Overbroad activation increases the chance the skill is selected in inappropriate contexts, where it may generate or save code unexpectedly and bypass more specialized review.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill instructs writing artifacts to agent_name/__init__.py and agent_name/agent.py using a save script, but gives no warning about file creation, overwrite, or path safety. This is dangerous because generated content could silently replace existing files or create project modifications the user did not explicitly authorize.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The entire skill instruction set is written in Chinese and presents the task requirements solely in that language, with no indication that users may choose another language or that the skill is limited to a Chinese-language context. This creates a natural-language policy concern because it effectively imposes a locale/language constraint without opt-in or justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file title and instructions are written entirely in Chinese and direct the model to generate code based on those Chinese-language instructions, with no indication that the user can choose another language or that the skill is limited to a Chinese-specific context. This creates a natural-language locale policy concern because it implicitly enforces a language without opt-in or justification.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script writes attacker- or user-controlled content directly to an attacker- or user-controlled path with no validation, sandboxing, or overwrite protection. In an agent skill context, this can overwrite arbitrary files accessible to the process, including project files, configs, shell profiles, or other sensitive artifacts, which makes the primitive materially dangerous even if its purpose is legitimate file saving.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The natural-language content of the skill is entirely in Chinese and does not state that users may choose another language. This can conflict with language-choice expectations if the organization requires offering locale or language flexibility unless clearly justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

This markdown file contains instructional content exclusively in Chinese, including the title and all usage guidance. Under the policy, forcing a specific language without user opt-in can be a natural-language policy violation when no choice or justification is provided.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

This markdown file uses only Chinese for its user-facing instructions and does not indicate that the skill is intended specifically for Chinese-speaking users or provide an opt-in language choice. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

This markdown file contains user-facing instructional content only in Chinese, and there is no indication that users may choose another language or that the locale restriction is intentional. Under the natural-language policy rules, forcing a specific language without opt-in is a policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

Line L05 requires generated system prompts to be in English if the user's main language is English, and in Chinese otherwise. This imposes a language policy based on inferred user language rather than explicitly offering the user a language/locale choice, which matches the stated policy-violation criterion.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

Natural-language content in the code uses Chinese for the function description and parameter documentation, while the rest of the CLI strings are in English. If organizational policy requires not forcing a specific language without opt-in, this mixed but unprompted language choice can violate that policy.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.