Back to skill

Security audit

clipboard-manager-tool

Security checks for vulnerabilities and agentic risk

Overview

This clipboard-history skill is purpose-aligned and user-invoked, but users should know it can store sensitive clipboard contents in a plaintext workspace file.

Install only if you are comfortable with saved clipboard entries being written to `clipboard-history.md` in the workspace. Avoid saving passwords, API keys, MFA codes, private messages, or proprietary text, and clear the history when it is no longer needed.

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 (2)

T09 · Insecure Skill Coding Practices

Warning
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: Medium

Technical Analysis

The save_clipboard function reads arbitrary content from the system clipboard and appends it verbatim to clipboard-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_history

The 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 0600 permission policy. Actual permissions depend on the invoking process's umask, and the workspace file may also be collected by backups, synchronization tools, indexing systems, or other agent operations.

Attack Path

  1. A user copies a password, API token, private message, or other secret to the system clipboard.
  2. The user or agent invokes clipboard.sh save.
  3. get_clipboard retrieves the secret and save_clipboard appends it verbatim to clipboard-history.md.
  4. The ...[truncated 700 chars]
Remediation
View remediation

Remediation Suggestions

  • Create the history file with mode 0600, using a restrictive umask before 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.

T09 · Insecure Skill Coding Practices

Note
Location
scripts/clipboard.sh:108
Finding

Unvalidated command arguments can be interpreted as utility options or unsafe numeric values

Content
View full analysis

Vulnerability Details

File Location: scripts/clipboard.sh, lines 108-121
Vulnerability Type: Argument and option injection
Risk Level: Low

Technical Analysis

The history limit and search keyword are accepted without validation or an option terminator:

bash
show_history() {
    local limit="${1:-10}"
    init_history
    echo "📋 Clipboard History (last $limit):"
    echo ""
    grep "^## \[" "$HISTORY_FILE" | tail -n "$limit"
}

# Search history
search_history() {
    local keyword="$1"
    init_history
    echo "🔍 Searching clipboard history for: $keyword"
    echo ""
    grep -A 2 -B 1 -i "$keyword" "$HISTORY_FILE" | head -50
}

Shell quoting prevents ordinary shell metacharacter injection, so this is not direct arbitrary shell-command execution. Nevertheless, a search keyword beginning with - can be interpreted by grep as an option rather than as the intended pattern. The history limit is passed as the argument to tail -n without checking that it is a bounded positive integer, allowing unsupported or unexpectedly large and negative values to alter behavior or cause errors.

Attack Path

  1. An attacker or untrusted caller supplies a search term beginning with a hyphen, or supplies a malformed, negative, or excessively large history limit.
  2. The agent invokes the documented search or history operation with that value.
  3. grep may parse the search value as an option, while tail may apply unintended numeric semantics or reject the value.
  4. The operation returns misleading output, exposes more history metadata than intended by the requested limit, consumes unnecessary resources, or fails.

Impact Assessment

No arbitrary command execution or privilege escalation is demonstrated because the values are quoted and are not evaluated by a shell. The practical impact is limited to manipulation or disruption of clipboard-history search and display behavior, ...[truncated 228 chars]

Remediation
View remediation

Remediation Suggestions

  • Require limit to be a bounded positive integer:
    bash
    case "$limit" in
        ''|*[!0-9]*) printf 'Invalid history limit\n' >&2; return 2 ;;
    esac
    if [ "$limit" -lt 1 ] || [ "$limit" -gt "$MAX_HISTORY" ]; then
        printf 'History limit must be between 1 and %s\n' "$MAX_HISTORY" >&2
        return 2
    fi
    
  • Terminate grep option processing before the user-controlled pattern:
    bash
    grep -A 2 -B 1 -i -- "$keyword" "$HISTORY_FILE" | head -50
    
  • Reject empty search terms if returning broad portions of history is not intended.
  • Return nonzero exit codes and clear error messages for invalid input.
  • Add tests covering keywords such as --help, -f, empty strings, and limits that are negative, nonnumeric, zero, or excessively large.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Memory PoisoningPersistent Context Injection, Context Window Stuffing, Memory Manipulation
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (10)

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill states that it manages clipboard history and stores data in a workspace file, but it does not warn that clipboard contents will be persisted to disk. Clipboard data frequently contains secrets or sensitive personal information, so silent persistence materially increases the risk of credential leakage, accidental disclosure, and long-term retention of confidential data.

Content

No source excerpt is available for this finding.

Memory Manipulation

High
Category
Memory Poisoning
Confidence
80% confidence
Finding

Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Content

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

bash skills/clipboard-manager-1.0.0/scripts/clipboard.sh restore

text

### Clear History
When user says: "clear clipboard history"
```bash
bash skills/clipboard-manager-1.0.0/scripts/clipboard.sh clear

Memory Manipulation

High
Category
Memory Poisoning
Confidence
80% confidence
Finding

Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Content

Scanner excerpt · scripts/clipboard.sh (reported line 126)May include surrounding context.

sh
grep -A 2 -B 1 -i "$keyword" "$HISTORY_FILE" | head -50
}

# Clear history
clear_history() {
    echo "# Clipboard History" > "$HISTORY_FILE"
    echo "" >> "$HISTORY_FILE"

Memory Manipulation

High
Category
Memory Poisoning
Confidence
80% confidence
Finding

Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Content

Scanner excerpt · scripts/clipboard.sh (reported line 159)May include surrounding context.

sh
grep -A 2 -B 1 -i "$keyword" "$HISTORY_FILE" | head -50
}

# Clear history
clear_history() {
    echo "# Clipboard History" > "$HISTORY_FILE"
    echo "" >> "$HISTORY_FILE"

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown file documents a clear operation for clipboard history, which can affect user data, but it provides no warning that the action may remove stored clipboard items or be irreversible. Under the markdown-specific warning criteria, user-facing documentation should disclose behaviors that can affect user data or system integrity.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The trigger description is broad enough that the skill may activate on loosely related phrases and handle clipboard content when the user did not explicitly intend persistent clipboard management. In a clipboard skill, unintended invocation can expose, overwrite, or persist sensitive copied data such as passwords, tokens, or private notes.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The documented clear-history command is destructive and presented without a warning, preview, or confirmation step. This can lead to accidental irreversible deletion of stored clipboard history, causing loss of user data and making audit or recovery of saved content impossible.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

This code persistently logs clipboard contents in plaintext to a history file, creating durable storage of transient and potentially sensitive user data. In the context of a clipboard-management skill, this is especially risky because users commonly copy credentials, MFA codes, private messages, and internal documents, all of which become retrievable long after the original clipboard use.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The script saves raw clipboard contents directly to a persistent markdown file on disk without user warning, consent, or any sensitivity filtering. Clipboard data frequently contains secrets such as passwords, tokens, API keys, personal data, or proprietary text, so this creates unintended at-rest retention and increases disclosure risk if the file is accessed later, synced, backed up, or exposed through other tooling.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The get operation prints the full clipboard contents to stdout, which can leak sensitive data into terminal scrollback, logs, recordings, CI traces, or shared shell sessions. Because clipboard contents often include secrets or private user data, exposing them verbatim materially increases the chance of accidental disclosure.

Content

No source excerpt is available for this finding.