Back to skill

Security audit

春登台桌面智能体

Security checks for vulnerabilities and agentic risk

Overview

This desktop automation skill is openly meant to control the computer, but it exposes broad shell, clipboard, screenshot, and macOS automation powers without clear scoping or per-action safeguards.

Review this skill before installing. It can see the screen, control clicks and keys, overwrite the clipboard, paste into the active app, download files, move or copy local files, and run arbitrary shell commands as the current user. Only use it in a tightly supervised environment if you trust the publisher and are comfortable confirming sensitive actions outside the skill itself.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/mcp-desktop-control.py:87
Finding

Unrestricted Shell Command Execution Through the MCP Tool

Content
View full analysis

Vulnerability Details

File Location: scripts/mcp-desktop-control.py:87-90
Vulnerability Type: OS command injection / unrestricted command execution
Risk Level: High

Vulnerable Code

python
elif tool == 'shell':
    cmd = args.get('command', '')
    timeout = args.get('timeout', 30)
    result = subprocess.run(cmd, shell=True, capture_output=True, text=True, timeout=timeout)

Technical Analysis

The shell MCP tool accepts an arbitrary caller-controlled command and passes it directly to subprocess.run with shell=True. The command is therefore interpreted by the operating-system shell, including command separators, pipelines, redirections, variable expansion, and command substitutions.

The implementation has no command allowlist, argument validation, path restrictions, authorization boundary, sandbox, or confirmation mechanism. The declared MCP input schema does not mitigate this issue because it only specifies that the command is a string; it does not constrain its contents.

Although shell automation is documented as a feature, this implementation grants substantially broader access than the documented file-management operations require. Any process or agent context capable of calling this MCP server can execute commands with the privileges and environment of the server process.

Attack Path

  1. An attacker directly submits a crafted MCP tools/call request, or attacker-controlled content causes an agent to generate such a request.
  2. The request selects the shell tool and places arbitrary shell syntax in the command argument.
  3. handle_request retrieves the string without validation.
  4. subprocess.run(..., shell=True) passes the string to the system shell.
  5. The shell interprets all included commands and metacharacters with the MCP server's user privileges.
  6. The attacker can use the resulting execution capability to access files, change system state, invoke instal ...[truncated 741 chars]
Remediation
View remediation

Remediation Suggestions

  • Remove the generic shell tool and replace it with narrowly scoped operations such as move_file, copy_file, create_directory, and list_directory.
  • Invoke programs using fixed executable names and argument arrays with shell=False.
  • Validate all paths through canonicalization and enforce an allowlisted working directory.
  • Reject shell metacharacters and unsupported arguments if legacy shell functionality must temporarily remain.
  • Require explicit user confirmation before destructive, executable, network, credential-related, or persistence-related operations.
  • Run the server in a sandbox with minimal filesystem, network, and process permissions.
  • Apply strict timeout and output-size bounds, and validate the timeout against a safe minimum and maximum.
  • Record security-relevant command requests in an audit log without storing secrets.

T09 · Insecure Skill Coding Practices

Error
Location
scripts/mcp-desktop-control.py:55
Finding

AppleScript Injection Through Unvalidated MCP Arguments

Content
View full analysis

Vulnerability Details

File Location: scripts/mcp-desktop-control.py:55-78
Vulnerability Type: AppleScript code injection
Risk Level: High

Vulnerable Code

python
elif tool == 'click':
    x, y = args.get('x', 0), args.get('y', 0)
    script = f'tell application "System Events" to click at {{{x}, {y}}}'
    out, ok = run_osascript(script)
    return {"jsonrpc": "2.0", "result": {"content": [{"type": "text", "text": f"Clicked ({x},{y}) ok={ok}"}], "isError": False}}

elif tool == 'type_text':
    text = args.get('text', '').replace('"', '\\"')
    subprocess.run(['osascript', '-e', f'set the clipboard to "{text}"'], check=True)
    subprocess.run(['osascript', '-e', 'tell application "System Events" to keystroke "v" using command down'], check=True)
    return {"jsonrpc": "2.0", "result": {"content": [{"type": "text", "text": f"Typed: {text[:50]}"}], "isError": False}}

elif tool == 'key_press':
    key = args.get('key', 'return')
    mods = args.get('modifiers', [])
    script = f'tell application "System Events" to keystroke "{key}"'
    if mods:
        script = f'tell application "System Events" to keystroke "{key}" using {", ".join(mods)} down'
    out, ok = run_osascript(script)
    return {"jsonrpc": "2.0", "result": {"content": [{"type": "text", "text": f"Key: {key} {mods}, ok={ok}"}], "isError": False}}

elif tool == 'set_clipboard':
    text = args.get('text', '').replace('"', '\\"')
    subprocess.run(['osascript', '-e', f'set the clipboard to "{text}"'], check=True)
    return {"jsonrpc": "2.0", "result": {"content": [{"type": "text", "text": "Clipboard set"}], "isError": False}}

Technical Analysis

Multiple MCP arguments are inserted directly into dynamically generated AppleScript source. The implementation does not perform runtime enforcement of the types declared in the tool schemas. Consequently, x and y need not actually be integers, while key and e ...[truncated 2388 chars]

Remediation
View remediation

Remediation Suggestions

  • Do not construct AppleScript source through string interpolation of caller-controlled values.
  • Enforce runtime types independently of the MCP schema. Require actual bounded integers for coordinates.
  • Allowlist supported key names and modifier names rather than accepting arbitrary strings.
  • Pass text as positional osascript arguments and retrieve it through a fixed on run argv handler, avoiding insertion into source code.
  • Prefer a native automation API that supports structured parameters without source-code generation.
  • If source construction is unavoidable, use a well-tested AppleScript string serializer that safely handles quotes, backslashes, line breaks, and control characters.
  • Reject unknown properties, malformed arrays, excessive input lengths, and values outside screen boundaries.
  • Run automation with the minimum macOS permissions needed and require confirmation for security-sensitive UI actions.

T09 · Insecure Skill Coding Practices

Note
Location
scripts/mcp-desktop-control.py:12
Finding

Sensitive Screenshots Persist in Temporary Storage

Content
View full analysis

Vulnerability Details

File Location: scripts/mcp-desktop-control.py:12-16
Vulnerability Type: Insecure temporary-file lifecycle
Risk Level: Low

Vulnerable Code

python
def handle_screenshot():
    fd, path = tempfile.mkstemp(suffix='.png')
    os.close(fd)
    subprocess.run(['screencapture', '-x', path], check=True)
    return path

Technical Analysis

Each screenshot is stored in a newly created temporary PNG file. While tempfile.mkstemp provides a securely generated file name and restrictive default permissions, the implementation returns the path without defining any deletion or retention lifecycle.

Screenshots can contain passwords, authentication codes, private conversations, personal information, confidential documents, or other sensitive screen content. Repeated calls also leave an unbounded number of residual image files and may consume disk space over time.

This finding concerns persistence and cleanup rather than predictable-file or race-condition exposure; the temporary-file creation itself uses an appropriate secure primitive.

Attack Path

  1. The MCP client invokes the screenshot tool while sensitive information is visible.
  2. handle_screenshot writes the complete display contents to a temporary PNG file.
  3. The path is returned to the client, but neither the server nor the Skill removes the file after use.
  4. The image remains on disk after the immediate automation step or session ends.
  5. A later process or session operating with the same user privileges can locate and read the residual screenshot, or accumulated files can exhaust temporary storage.

Impact Assessment

The primary impact is unintended retention and later disclosure of sensitive visual information to processes or users with sufficient local access. Exposure is generally constrained by the temporary file's permissions and the privileges of the account that created it.

Repeated use may ...[truncated 120 chars]

Remediation
View remediation

Remediation Suggestions

  • Delete each screenshot immediately after the consuming client has retrieved or processed it.
  • Prefer returning image bytes through the MCP response rather than returning a persistent filesystem path.
  • If deferred access is required, associate each file with a short expiration time and implement reliable cleanup on completion, shutdown, startup, and error paths.
  • Store screenshots in a dedicated private directory with restrictive permissions.
  • Apply retention limits by age, file count, and total size.
  • Avoid capturing the screen when secrets are visible, and support redaction or application-specific capture where practical.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
Findings (16)

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

The description presents a broad, user-friendly desktop automation skill, but the actual instructions expose low-level primitives including shell commands, clipboard injection, keystrokes, and image/coordinate-based clicking without hard safety constraints. That mismatch is dangerous because operators and routing logic may trust the declared purpose while the effective behavior allows more powerful actions such as arbitrary filesystem changes and downloads.

Content

No source excerpt is available for this finding.

Vague Triggers

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger phrases are extremely broad, covering almost any request involving opening apps, websites, files, form filling, or multi-step computer use. In combination with desktop control and shell/file operations, this increases the chance the skill activates in contexts where a less-privileged skill would suffice, expanding exposure to accidental or unsafe automation.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

Exposing an MCP tool that runs arbitrary shell commands gives the agent a general-purpose execution primitive unrelated to the minimum necessary scope of desktop clicking/typing/screenshot tasks. In the context of an autonomous desktop skill, this dramatically expands abuse potential from UI automation into full host compromise and data exfiltration.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The code exposes shell command execution without warning or confirmation, allowing a caller to trigger highly consequential host actions silently. Given the desktop automation context and the existence of stdin-driven tool invocation, lack of user confirmation materially raises the risk of covert destructive or exfiltrative actions.

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
99% confidence
Finding

The command string is taken directly from tool parameters and passed to subprocess.run(..., shell=True), creating a textbook parameter-abuse primitive. Any upstream prompt injection, malicious workflow, or compromised caller can transform this skill into arbitrary OS command execution with the full privileges of the running process.

Content

Scanner excerpt · scripts/mcp-desktop-control.py (reported line 83)May include surrounding context.

python
elif tool == 'shell':
                cmd = args.get('command', '')
                timeout = args.get('timeout', 30)
                result = subprocess.run(cmd, shell=True, capture_output=True, text=True, timeout=timeout)
                return {"jsonrpc": "2.0", "result": {"content": [{"type": "text", "text": result.stdout[:500]}], "isError": False}}

            else:

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
96% confidence
Finding

The skill documents direct shell capabilities such as mv, cp, mkdir, curl, and for-loop batch file operations, but it does not declare any explicit tool scope or permission boundaries. In a desktop automation skill, undeclared shell access is especially risky because natural-language task routing may invoke it for broad user requests, enabling unintended file modification, network retrieval, or command expansion beyond what users expect.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The file operation and download templates include mutating commands like mv and curl-based retrieval without visible warnings, confirmations, rollback guidance, or safeguards against overwriting and data loss. In this skill context, that is more dangerous because the skill is explicitly designed to act on user files and desktop state, so mistakes can directly alter or destroy local data.

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/mcp-desktop-control.py (reported line 6)May include surrounding context.

python
import json, sys, subprocess, os, tempfile

def run_osascript(script):
    result = subprocess.run(
        ['osascript', '-e', script],
        capture_output=True, text=True, timeout=10
    )

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The screenshot tool captures sensitive on-screen information and stores it in a temp file without any user-facing warning or disclosure. Because this is a desktop automation skill with broad visibility into the user's session, undisclosed screenshot capture materially increases privacy and confidentiality risk.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
78% confidence
Finding

The code captures the entire user display and writes it to a temporary PNG file without any notice, consent flow, or lifecycle control. In a desktop automation skill, screenshots can contain passwords, messages, documents, and other sensitive data, so silent capture and persistence increase privacy and data-exposure risk.

Content

Scanner excerpt · scripts/mcp-desktop-control.py (reported line 15)May include surrounding context.

python
def handle_screenshot():
    fd, path = tempfile.mkstemp(suffix='.png')
    os.close(fd)
    subprocess.run(['screencapture', '-x', path], check=True)
    return path

def handle_request(data):

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill modifies the clipboard and triggers a paste without explicit warning, which can surprise the user and cause harmful actions in the focused application. In a desktop-control setting, that can lead to accidental command submission, data leakage, or overwriting user clipboard contents needed elsewhere.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
80% confidence
Finding

This operation overwrites the user's clipboard with attacker- or prompt-controlled text and is part of a flow that pastes into the active application. In desktop automation context, that can inject unintended commands, secrets, or messages into whichever window is focused, causing data loss, accidental actions, or credential exposure.

Content

Scanner excerpt · scripts/mcp-desktop-control.py (reported line 62)May include surrounding context.

python
elif tool == 'type_text':
                text = args.get('text', '').replace('"', '\\"')
                subprocess.run(['osascript', '-e', f'set the clipboard to "{text}"'], check=True)
                subprocess.run(['osascript', '-e', 'tell application "System Events" to keystroke "v" using command down'], check=True)
                return {"jsonrpc": "2.0", "result": {"content": [{"type": "text", "text": f"Typed: {text[:50]}"}], "isError": False}}

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
80% confidence
Finding

Simulated paste into the active window can send untrusted content into security-sensitive contexts such as terminals, admin consoles, chats, or password fields. Because focus may change unexpectedly, this creates a realistic risk of command execution, data corruption, or information disclosure beyond the intended application.

Content

Scanner excerpt · scripts/mcp-desktop-control.py (reported line 63)May include surrounding context.

python
elif tool == 'type_text':
                text = args.get('text', '').replace('"', '\\"')
                subprocess.run(['osascript', '-e', f'set the clipboard to "{text}"'], check=True)
                subprocess.run(['osascript', '-e', 'tell application "System Events" to keystroke "v" using command down'], check=True)
                return {"jsonrpc": "2.0", "result": {"content": [{"type": "text", "text": f"Typed: {text[:50]}"}], "isError": False}}

            elif tool == 'key_press':

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

Clipboard-setting functionality silently replaces user clipboard contents without warning. Since clipboard data often contains secrets or in-progress user work, undisclosed overwrite harms integrity and may also expose sensitive content through subsequent pastes or clipboard-monitoring applications.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
77% confidence
Finding

Setting the clipboard silently overwrites user state and may place sensitive or dangerous content where other applications can read or paste it. In a desktop-control skill, clipboard access is especially sensitive because it bridges trust boundaries between the agent and arbitrary user applications.

Content

Scanner excerpt · scripts/mcp-desktop-control.py (reported line 77)May include surrounding context.

python
elif tool == 'set_clipboard':
                text = args.get('text', '').replace('"', '\\"')
                subprocess.run(['osascript', '-e', f'set the clipboard to "{text}"'], check=True)
                return {"jsonrpc": "2.0", "result": {"content": [{"type": "text", "text": "Clipboard set"}], "isError": False}}

            elif tool == 'shell':

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
99% confidence
Finding

The shell tool executes arbitrary caller-supplied commands with shell=True, which enables unrestricted command execution in the user's environment. In this skill, that is far broader than needed for desktop automation and can be abused to run malware, exfiltrate files, alter system state, or establish persistence.

Content

Scanner excerpt · scripts/mcp-desktop-control.py (reported line 83)May include surrounding context.

python
elif tool == 'shell':
                cmd = args.get('command', '')
                timeout = args.get('timeout', 30)
                result = subprocess.run(cmd, shell=True, capture_output=True, text=True, timeout=timeout)
                return {"jsonrpc": "2.0", "result": {"content": [{"type": "text", "text": result.stdout[:500]}], "isError": False}}

            else: