T09 · Insecure Skill Coding Practices
- Location
scripts/clipboard.sh:67- Finding
Clipboard contents are persistently stored in an unprotected plaintext file
- Content
View full analysis
Vulnerability Details
File Location:
scripts/clipboard.sh, lines 67-83
Vulnerability Type: Plaintext storage of potentially sensitive clipboard data
Risk Level: MediumTechnical Analysis
The
save_clipboardfunction reads arbitrary content from the system clipboard and appends it verbatim toclipboard-history.md:bash save_clipboard() { init_history local content=$(get_clipboard) local timestamp=$(date "+%Y-%m-%d %H:%M:%S") local count=$(grep -c "^## \[" "$HISTORY_FILE" 2>/dev/null || echo "0") local index=$((count + 1)) # Truncate content for display local preview=$(echo "$content" | head -c 50 | tr '\n' ' ') { echo "" echo "## [$index] $timestamp" echo "\`\`\`" echo "$content" echo "\`\`\`" echo "" } >> "$HISTORY_FILE" # Trim old entries if over limit trim_historyThe history initialization at lines 10-15 also creates the file without explicitly setting restrictive permissions:
bash init_history() { if [ ! -f "$HISTORY_FILE" ]; then echo "# Clipboard History" > "$HISTORY_FILE" echo "" >> "$HISTORY_FILE" fi }Clipboard data commonly contains passwords, access tokens, private keys, personal messages, and other sensitive material. The script stores this data without encryption, redaction, expiration controls, or an explicit
0600permission policy. Actual permissions depend on the invoking process'sumask, and the workspace file may also be collected by backups, synchronization tools, indexing systems, or other agent operations.Attack Path
- A user copies a password, API token, private message, or other secret to the system clipboard.
- The user or agent invokes
clipboard.sh save. get_clipboardretrieves the secret andsave_clipboardappends it verbatim toclipboard-history.md.- The ...[truncated 700 chars]
- Remediation
View remediation
Remediation Suggestions
- Create the history file with mode
0600, using a restrictiveumaskbefore creation:bash umask 077 if [ ! -e "$HISTORY_FILE" ]; then printf '# Clipboard History\n\n' > "$HISTORY_FILE" fi chmod 600 -- "$HISTORY_FILE" - Verify that an existing history path is a regular file owned by the current user and is not a symbolic link before reading or writing it.
- Warn users that clipboard history is persistent and may contain secrets.
- Provide an option to disable persistent history or store it only for a configured retention period.
- Consider authenticated encryption using a user-controlled key for history stored on disk.
- Add optional secret detection and redaction for common API tokens, passwords, private keys, and authentication headers.
- Ensure clearing the history follows the project's data-deletion requirements; simple truncation may not constitute secure deletion on modern filesystems.
- Create the history file with mode
