Back to skill

Security audit

Clipboard Content Factory

Security checks for vulnerabilities and agentic risk

Overview

This skill is a clipboard automation tool, but it can continuously capture ordinary clipboard text and persist parts of it to desktop files without enough scoping or safeguards.

Install only if you intentionally want a clipboard watcher for Chinese social-content drafts. Avoid watch mode when copying passwords, tokens, private messages, customer data, or internal links; prefer one-time processing and a non-synced output folder, and review/delete generated files regularly. The package should ideally add explicit consent prompts, secret redaction, narrower content validation, safer clipboard APIs, and retention controls before broad use.

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_watcher.py:183
Finding

Indiscriminate Clipboard Capture and Plaintext Persistence

Content
View full analysis

Vulnerability Details

File Location: scripts/clipboard_watcher.py, lines 183-238 and 245-259
Vulnerability Type: Sensitive data exposure through insecure clipboard processing and plaintext storage
Risk Level: Medium

Vulnerable Code

python
if not text or len(text.strip()) < 5:
    return None

text = text.strip()
output_dir = output_dir or DEFAULT_OUTPUT

date_str = datetime.now().strftime("%Y-%m-%d_%H%M%S")
out_path = Path(output_dir) / date_str
out_path.mkdir(parents=True, exist_ok=True)

results = {}
summary = {
    "original": text[:200],
    "original_hash": hashlib.md5(text.encode()).hexdigest()[:8],
    "platforms": {},
    "generated_at": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
}
python
(out_path / "summary.json").write_text(
    json.dumps(summary, ensure_ascii=False, indent=2), encoding="utf-8"
)
python
text = get_clipboard_text()
if not text:
    return None

text_hash = hashlib.md5(text.encode()).hexdigest()[:8]

if text_hash == last_hash:
    return None

last_hash = text_hash
return process_content(text)

Technical Analysis

The continuous watcher processes every changed clipboard string containing at least five characters. It does not verify that the value is an article, supported URL, or other intended content type. It also does not detect likely credentials, access tokens, private keys, passwords, or other sensitive values.

The first 200 characters of the clipboard value are copied directly into summary.json. Additional source fragments are incorporated into generated Markdown files. These files are stored in timestamped directories beneath the configured output directory, which defaults to the user's desktop.

No restrictive file permissions, encryption, retention policy, deletion mechanism, or user confirmation is applied. Desktop directories may also be synchronized automatically by cloud-storage software, ...[truncated 1385 chars]

Remediation
View remediation

Remediation Suggestions

  1. Require explicit user confirmation before processing or storing clipboard content.
  2. Validate that the input matches an intended content type, such as an HTTP or HTTPS URL or sufficiently long article text.
  3. Reject or redact likely secrets, including private keys, bearer tokens, API keys, authentication cookies, and password-manager output.
  4. Do not retain the original clipboard value by default. Make source retention an explicit opt-in setting.
  5. Store only the minimum source fragment required for the requested transformation.
  6. Create output files with permissions restricted to the current user.
  7. Offer configurable retention and automatic deletion of old generated directories.
  8. Warn users that desktop folders may be synchronized to external services.
  9. Add a pause or exclusion mechanism so users can temporarily disable monitoring before copying sensitive data.
  10. Consider processing a user-selected clipboard item only once rather than continuously monitoring all clipboard changes.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/clipboard_watcher.py:105
Finding

PowerShell Command Injection in Clipboard-Writing Fallback

Content
View full analysis

Vulnerability Details

File Location: scripts/clipboard_watcher.py, lines 105-114
Vulnerability Type: OS command injection through unsafe PowerShell source construction
Risk Level: Medium

Vulnerable Code

python
else:
    import subprocess
    try:
        subprocess.run(
            ["powershell", "-Command", f"Set-Clipboard -Value '{text}'"],
            capture_output=True, timeout=3
        )
        return True
    except Exception:
        return False

Technical Analysis

The fallback implementation interpolates the text argument directly into PowerShell program source supplied through the -Command option. Wrapping the value in single quotes does not make this safe because an attacker-controlled single quote can terminate the string literal. The remaining input can then be interpreted as PowerShell statements.

Supplying subprocess.run() with an argument list prevents shell parsing by Python, but it does not prevent injection into the PowerShell language passed as the -Command argument. PowerShell itself parses and executes the interpolated string.

The current command-line workflow does not call set_clipboard_text(), so this flaw is dormant in the reviewed execution paths. Exploitation requires another caller, imported use of the function, or a future feature that invokes it with untrusted content. The vulnerable branch also requires both the pyperclip and Tkinter clipboard implementations to be unavailable.

Attack Path

  1. The application runs on Windows without a usable pyperclip or Tkinter clipboard implementation.
  2. Another code path, imported consumer, or future feature calls set_clipboard_text() with attacker-controlled text.
  3. The supplied text contains a single quote that terminates the intended PowerShell string, followed by additional PowerShell statements.
  4. The interpolated value becomes part of the program passed to powershell -Command ...[truncated 804 chars]
Remediation
View remediation

Remediation Suggestions

  1. Do not embed untrusted text in a PowerShell command string.
  2. Prefer a dedicated clipboard API or a safely configured clipboard library.
  3. If PowerShell is necessary, pass the clipboard content through standard input rather than incorporating it into executable source.
  4. A safer pattern is to invoke a fixed PowerShell command that reads raw standard input and sends that value to Set-Clipboard.
  5. Avoid attempting to fix the issue through manual quote replacement alone, because PowerShell has multiple parsing and expansion behaviors.
  6. Add tests containing single quotes, semicolons, newlines, subexpressions, and other PowerShell metacharacters.
  7. Remove set_clipboard_text() if clipboard writing is not an implemented feature, thereby eliminating the dormant attack surface.
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (12)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The documented behavior overstates and understates important actions at the same time: it implies a benign 'copy = publish' automation flow, but the actual described implementation continuously monitors clipboard data, fetches remote content from links, and writes outputs to local desktop folders. This mismatch can mislead users about data collection, persistence, and automation boundaries, which is dangerous because clipboard contents often include sensitive information and link fetching may contact untrusted sites.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill lacks clear warnings about three sensitive behaviors: ongoing clipboard monitoring, automatic retrieval of content from copied links, and writing generated files onto the desktop. In this context, that omission is especially risky because clipboard data commonly contains passwords, tokens, private messages, or internal URLs, and users may not realize the skill can capture or persist such data.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill describes running shell commands and writing generated content to local files, but it does not declare any explicit tool scope such as shell or file-write permissions. This creates a trust and review gap: users and host systems cannot accurately understand or constrain what the skill may do, increasing the chance of unintended command execution or filesystem modification.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger phrases are overly broad and overlap with ordinary user expressions such as asking to monitor the clipboard or auto-rewrite copied content. That increases the risk of accidental activation of a skill that performs sensitive actions like persistent clipboard surveillance and file output without the user intending to invoke it.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill continuously monitors clipboard content and saves clipboard-derived material to desktop files by default. Clipboard data often contains secrets, personal messages, tokens, or proprietary text, so automatic persistence creates a privacy and data leakage risk, especially in watch mode where collection is ambient and ongoing.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The code spawns PowerShell subprocesses to read and modify clipboard contents. This expands the attack surface, inherits platform-specific shell semantics, and in this skill context is especially sensitive because clipboard data may include confidential information and is being processed automatically.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/clipboard_watcher.py (reported line 98)May include surrounding context.

python
# Fallback: 尝试PowerShell
        import subprocess
        try:
            result = subprocess.run(
                ["powershell", "-Command", "Get-Clipboard"],
                capture_output=True, text=True, timeout=3
            )

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
83% confidence
Finding

The manifest emphasizes rewriting generated content, but the implementation also includes clipboard overwrite capability. Even if not exercised in the current main flow, hidden or undocumented write-back capability increases the risk of content tampering, accidental replacement of copied secrets, and abuse by future code paths.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
97% confidence
Finding

The code interpolates arbitrary clipboard-derived text directly into a PowerShell -Command string: Set-Clipboard -Value '{text}'. If text contains quotes or PowerShell metacharacters, this can break out of the quoted string and execute unintended commands, turning clipboard content into code execution.

Content

Scanner excerpt · scripts/clipboard_watcher.py (reported line 124)May include surrounding context.

python
else:
        import subprocess
        try:
            subprocess.run(
                ["powershell", "-Command", f"Set-Clipboard -Value '{text}'"],
                capture_output=True, timeout=3
            )

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

In watch mode, new clipboard content is processed and written to desktop files automatically without an upfront warning or per-item confirmation. Because users routinely copy passwords, API keys, personal data, and internal documents, this behavior can silently create persistent local artifacts and broaden exposure.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
77% confidence
Finding

描述中将输出固定为“抖音、小红书、B站三个平台的版本”,对应特定中文平台与语言环境,但未说明这是可选项,也未提供其他语言或平台选择。若该技能面向通用用户,这种默认强制特定语言/平台的设计可能构成语言/locale 策略问题。

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The module docstring presents the skill's purpose and behavior exclusively in Chinese, which can amount to a language-policy issue when no opt-in or locale justification is provided. Nothing in the file indicates that the skill is intentionally restricted to a Chinese-speaking or region-specific context.

Content

No source excerpt is available for this finding.