T09 · Insecure Skill Coding Practices
- Location
scripts/script.sh:35- Finding
Undisclosed Persistent Plaintext Logging of User-Supplied Arguments
- Content
View full analysis
Vulnerability Details
File Location:
scripts/script.sh:5-7,scripts/script.sh:35, andscripts/script.sh:37-60, 73-94
Vulnerability Type: Persistent storage of potentially sensitive user input in plaintext
Risk Level: MediumComplete Vulnerable Code
bash DATA_DIR="${EMAIL_TEMPLATE_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/email-template}" DB="$DATA_DIR/data.log" mkdir -p "$DATA_DIR"bash _log() { echo "$(date '+%m-%d %H:%M') $1: $2" >> "$DATA_DIR/history.log"; }User-controlled command arguments are passed to this logging function:
bash cmd_prompt() { echo " Role: $1 Task: ${2:-assist} Format: ${3:-text}" _log "prompt" "${1:-}" } cmd_system() { echo " You are an expert $1. Be precise, helpful, and concise." _log "system" "${1:-}" } cmd_chain() { echo " Step 1: Understand | Step 2: Plan | Step 3: Execute | Step 4: Verify" _log "chain" "${1:-}" } cmd_template() { echo " 1. Zero-shot | 2. Few-shot | 3. Chain-of-thought | 4. Role-play" _log "template" "${1:-}" } cmd_compare() { echo " GPT-4 vs Claude vs Gemini: benchmark comparison" _log "compare" "${1:-}" }bash cmd_optimize() { echo " Tips: Be specific | Add examples | Set format | Constrain length" _log "optimize" "${1:-}" } cmd_evaluate() { echo " Check: accuracy | relevance | completeness | tone" _log "evaluate" "${1:-}" } cmd_safety() { echo " 1. No harmful content | 2. No personal data | 3. Cite sources" _log "safety" "${1:-}" } cmd_tools() { echo " ChatGPT | Claude | Gemini | Perplexity | Midjourney" _log "tools" "${1:-}" }Technical Analysis
The
_logfunction persistently appends command arguments tohistory.logwithout redaction, encryption, retention controls, or explicit user consent. Inputs supplied to commands such as `prompt ...[truncated 2039 chars]- Remediation
View remediation
Remediation Suggestions
- Remove argument-content logging unless it is strictly required.
- Make logging explicitly opt-in and document exactly what data is retained, where it is stored, and how users can delete it.
- Log only non-sensitive event metadata, such as command type and timestamp; do not record raw prompt or system-role content.
- If content must be retained, apply field-level redaction, a defined retention period, and appropriate encryption.
- Create the data directory and log file with restrictive permissions, such as directory mode
0700and file mode0600. - Validate redirected storage paths and refuse symbolic-link log targets. Open the log using a mechanism that prevents symbolic-link traversal where the platform supports it.
- Add tests confirming that sensitive command arguments never appear in persistent files by default.
- Align
scripts/script.shwith the declared email-template functionality or remove the unrelated prompt-engineering CLI to reduce undocumented behavior and attack surface.
