Back to skill

Security audit

Coze Studio

Security checks for vulnerabilities and agentic risk

Overview

This skill is presented as a Coze Studio AI agent platform, but the inspected scripts are generic shell utilities that persist user input and command history locally without clear disclosure.

Review this carefully before installing. It does not appear to contain exfiltration, destructive behavior, remote code loading, or privilege escalation, but it also does not deliver the advertised Coze Studio agent-development platform. If installed, avoid passing secrets or tokens as arguments, use a private trusted COZE_STUDIO_DIR, and expect local data and command history files to be created.

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
scripts/script.sh:5
Finding

Insecure Persistent Logging and Symlink-Following File Writes

Content
View full analysis

Vulnerability Details

File Location: scripts/script.sh:5-7, 34, 38-83
Vulnerability Type: Plaintext argument logging, unsafe file permissions, and symlink-following writes
Risk Level: Medium

Vulnerable Code

bash
DATA_DIR="${COZE_STUDIO_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/coze-studio}"
DB="$DATA_DIR/data.log"
mkdir -p "$DATA_DIR"

_log() { echo "$(date '+%m-%d %H:%M') $1: $2" >> "$DATA_DIR/history.log"; }

cmd_run() {
    echo "  Running: $1"
    _log "run" "${1:-}"
}

cmd_config() {
    echo "  Config: $DATA_DIR/config.json"
    _log "config" "${1:-}"
}

cmd_status() {
    echo "  Status: ready"
    _log "status" "${1:-}"
}

cmd_init() {
    echo "  Initialized in $DATA_DIR"
    _log "init" "${1:-}"
}

cmd_list() {
    [ -f "$DB" ] && cat "$DB" || echo "  (empty)"
    _log "list" "${1:-}"
}

cmd_add() {
    echo "$(date +%Y-%m-%d) $*" >> "$DB"; echo "  Added: $*"
    _log "add" "${1:-}"
}

cmd_remove() {
    echo "  Removed: $1"
    _log "remove" "${1:-}"
}

cmd_search() {
    grep -i "$1" "$DB" 2>/dev/null || echo "  Not found: $1"
    _log "search" "${1:-}"
}

cmd_export() {
    [ -f "$DB" ] && cat "$DB" || echo "No data"
    _log "export" "${1:-}"
}

cmd_info() {
    echo "  Version: $VERSION | Data: $DATA_DIR"
    _log "info" "${1:-}"
}

Technical Analysis

The script creates its data directory and append-only data files without setting a restrictive umask or explicitly enforcing permissions. Consequently, the resulting directory and files inherit the caller's environment-dependent default permissions. In environments with a permissive umask or a shared COZE_STUDIO_DIR, data.log and history.log may be readable or writable by other local users.

User-controlled command arguments are stored in plaintext. The add command writes every argument to data.log, while most operational commands pas ...[truncated 2706 chars]

Remediation
View remediation

Remediation Suggestions

  1. Set a restrictive process umask before creating any storage:

    bash
    umask 077
    
  2. Create and verify the storage directory with owner-only permissions:

    bash
    mkdir -p -- "$DATA_DIR"
    chmod 700 -- "$DATA_DIR"
    
  3. Canonicalize the selected directory and verify that it is owned by the current user. Reject shared, world-writable, or unexpectedly redirected paths.

  4. Refuse symbolic-link targets before writing. Prefer opening files with a mechanism that enforces O_NOFOLLOW; where only shell facilities are available, verify that the destination is not a symbolic link immediately before use and avoid privileged execution because shell checks alone can remain susceptible to race conditions.

  5. Create data.log and history.log with mode 0600, then verify their ownership, type, and permissions before every write.

  6. Do not log raw command arguments by default. Remove argument logging where it is not essential, or redact secrets, tokens, credentials, and other sensitive values. Clearly document any persistent logging behavior.

  7. Use printf instead of echo for data writes to avoid implementation-dependent handling of values beginning with options or containing escape sequences:

    bash
    printf '%s %s\n' "$(date +%Y-%m-%d)" "$*" >> "$DB"
    
  8. Do not run the utility as root or through privileged automation unless the storage path is fixed, trusted, owner-controlled, and protected against link-based file writes.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (8)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The description presents a full-featured AI agent development platform with visual tools and debugging support. The supplied code is only a simple bash wrapper exposing help, info, status, and a stubbed run command that prints 'TODO: Implement main functionality.' There is no evidence of actual studio functionality, agent creation, debugging, or platform behavior. This is a material description-versus-behavior mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The description suggests a full AI agent development platform or studio, likely involving tooling for building and debugging agents. The provided code is instead a generic bash command-line utility that creates a data directory, appends entries to a log file, lists/searches/exports those entries, and records command history. Its primary purpose is simple local record management, not agent development. This is a clear purpose/behavior mismatch.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The script's behavior materially diverges from the advertised skill purpose: instead of implementing an AI agent development platform, it performs local data persistence and logging. In an agent-skill ecosystem, this mismatch is dangerous because users and orchestrators may grant trust or permissions based on the manifest description while the code quietly collects and stores command history and user input.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The listed commands help, run, info, and status are generic terms that commonly appear in normal user conversation and many unrelated contexts. The file does not provide narrower invocation constraints or exclusion conditions, so these triggers are ambiguous for activation purposes.

Content

No source excerpt is available for this finding.

Unrestricted Tool Access

Medium
Category
Excessive Agency
Confidence
84% confidence
Finding

The phrase 'Run any command: coze-studio <command> [args]' indicates a broadly parameterized execution surface with no documented allowlist, validation, or scope restrictions. In an agent context, unrestricted command dispatch can expose dangerous functionality or unexpected subcommands if user-controlled input is passed through to the underlying tool without strict checks.

Content

Scanner excerpt · SKILL.md (reported line 25)May include surrounding context.

md
## Usage

Run any command: `coze-studio <command> [args]`
---
💬 Feedback & Feature Requests: https://bytesagain.com/feedback
Powered by BytesAgain | bytesagain.com

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The inline documentation labels the tool as a generic multi-purpose utility, which contradicts the manifest's claim that this is Coze Studio, an AI agent development platform. This inconsistency increases supply-chain and trust risk because reviewers and users cannot reliably infer what the skill actually does, making hidden or undeclared behaviors harder to detect.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The _log function silently writes command activity and arguments to a persistent history file under the user's home/data directory without notice or consent. In the context of an agent skill, command arguments may contain prompts, file paths, tokens, or other sensitive operational data, so undisclosed retention creates privacy and credential-exposure risk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The add command persists arbitrary user-supplied input to a local data file with no disclosure, retention policy, or validation. Because this skill is presented as an AI development platform rather than a note-taking/logger utility, users are less likely to expect durable storage of their inputs, which raises the risk of unintended data collection and later exposure.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.