Back to skill

Security audit

Leave Doc

Security checks for vulnerabilities and agentic risk

Overview

This looks like a legitimate Chinese leave-letter generator, but it includes an extra undocumented utility that can persist entered text and command history in plaintext on disk.

Install only if you want a Chinese/PRC-oriented leave-letter helper. Use the documented `scripts/doc.sh` path for generation, and avoid invoking `scripts/script.sh` with personal, medical, family, employment, or secret information unless you are comfortable with plaintext files being retained under the local leave-doc data directory.

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

Undocumented Plaintext Persistence of Potentially Sensitive User Input

Content
View full analysis

Vulnerability Details

File Location: scripts/script.sh:5-8, scripts/script.sh:31, scripts/script.sh:34-77
Vulnerability Type: Plaintext storage and logging of potentially sensitive data
Risk Level: Medium

The undocumented script.sh utility creates persistent storage outside the project and writes user-supplied data to plaintext files. This behavior is not described in SKILL.md, which identifies scripts/doc.sh as the supported entry point.

Vulnerable Code

bash
DATA_DIR="${LEAVE_DOC_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/leave-doc}"
DB="$DATA_DIR/data.log"
mkdir -p "$DATA_DIR"
bash
_log() { echo "$(date '+%m-%d %H:%M') $1: $2" >> "$DATA_DIR/history.log"; }
bash
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 ${XDG_DATA_HOME}/leave-doc or $HOME/.local/share/leave-doc as soon as it starts, even when the requested operation does not require persistent storage. It does not establish a restrictive umask or explicitly set permissions on the direc ...[truncated 2254 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove scripts/script.sh from the package if it is unrelated to the documented leave-document functionality.
  2. If persistent storage is required, document every file created, the stored fields, retention behavior, and deletion procedure.
  3. Do not log raw command arguments. Record only non-sensitive event metadata, or make logging explicitly opt-in.
  4. Require an explicit initialization or consent step before creating persistent files.
  5. Apply restrictive permissions before creating storage:
    bash
    umask 077
    mkdir -p -- "$DATA_DIR"
    chmod 700 -- "$DATA_DIR"
    
  6. Create data and history files with owner-only permissions and verify that existing files are not symbolic links before writing.
  7. Implement remove so that it actually removes the selected record, and provide a command that securely clears all retained application data.
  8. Define and enforce a retention period instead of preserving entries indefinitely.
  9. Avoid storing sensitive leave reasons unless they are strictly necessary; prefer identifiers or redacted summaries.
  10. Add automated tests confirming that deletion works, sensitive arguments are not logged, and generated files have restrictive permissions.
Vulnerability Patterns
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (5)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill description strongly prescribes Chinese-language behavior and Chinese-specific leave-document workflows without any indication that this should depend on user preference. This can cause the agent to respond in an unintended language or assume locale-specific HR/OA context, which is a safety and quality issue because it may override user expectations and reduce usability in multilingual environments.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This shell skill identifies itself with a Chinese-only description and the generated output throughout the embedded script is also Chinese-only. The policy requires flagging language or locale constraints when a skill forces a specific language without user opt-in, and there is no indication that users can choose another language or that the locale restriction is documented as intentional.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script persistently logs command activity and arguments to a history file via the _log function, but the help text and interface do not clearly disclose that user actions and inputs are being stored. This creates a privacy and data-handling risk because users may unknowingly provide sensitive terms or identifiers that are retained on disk.

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 writes arbitrary user-supplied input directly to a persistent data file, and this behavior is not clearly communicated to the user. In combination with command logging elsewhere in the script, this can lead to unintentional retention of sensitive information entered at the command line.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The entire markdown file is written in Chinese and presents all usage guidance, examples, and outputs only in that language. Under the policy rule, forcing a single language without opt-in or an explicit statement that the skill is intended only for a Chinese-speaking or China-specific context is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.