Back to skill

Security audit

Agent Tool Scout

Security checks for vulnerabilities and agentic risk

Overview

This Mac automation skill is mostly honest about controlling local apps, but it grants broad app-control power with weak safeguards and has a verified AppleScript injection risk.

Review this before installing. Use it only with trusted agents and approve each app/action, especially for Mail, Messages, Finder, Terminal, browsers, office apps, and System Settings. Grant Automation or Accessibility only to a trusted terminal or agent host, and avoid scanning/installing wrappers for untrusted local apps because crafted app or menu metadata could abuse the current AppleScript construction.

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

T09 · Insecure Skill Coding Practices

Error
Location
src/clam/scanner/menu_scanner.py:65
Finding
AppleScript Injection Through Unescaped Application and Menu Metadata<![CDATA[ ## Vulnerability Details **File Location**: `src/clam/scanner/menu_scanner.py:65-164` **Vulnerability Type**: AppleScript source injection **Risk Level**: High ### Vulnerable Code Application names are inserted directly into executable AppleScript: ```python def _get_process_name(app_name: str) -> str | None: """Get the System Events process name for an app. Prefers foreground (non-background-only) processes to avoid picking helper agents like "figma_agent" instead of the main "Figma" process. """ script = f''' tell application "System Events" set procs to every process whose name contains "{app_name}" and background only is false if (count of procs) > 0 then return name of item 1 of procs end if -- Fallback to any matching process set procs to every process whose name contains "{app_name}" if (count of procs) > 0 then return name of item 1 of procs end if end tell''' return _run_osascript(script) ``` Detected process names are also inserted directly: ```python # Step 1: Get menu bar item names bar_script = f''' tell application "System Events" tell process "{process_name}" get name of every menu bar item of menu bar 1 end tell end tell''' raw = _run_osascript(bar_script) ``` Process and menu names are again inserted when scanning individual menu groups: ```python def _scan_menu_group(process_name: str, bar_name: str) -> MenuGroup | None: """Scan a single menu bar item for its menu items (including one level of submenus).""" script = f''' tell application "System Events" tell process "{process_name}" set output to "" try set menuItems to every menu item of menu 1 of menu bar item "{bar_name}" of menu bar 1 repeat with mi in menuItems try set n to name of mi if n is not missing value then -- Check for submenu ...[truncated 4548 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Stop interpolating values into AppleScript source.** Pass application, process, and menu names as separate `osascript` arguments and access them through an `on run argv` handler. Example pattern: ```python script = ''' on run argv set targetName to item 1 of argv tell application "System Events" set procs to every process whose name contains targetName if (count of procs) > 0 then return name of item 1 of procs end if end tell end run ''' subprocess.run( ["osascript", "-e", script, app_name], capture_output=True, text=True, timeout=timeout, ) ``` 2. **Apply the same argument-passing design to all dynamic values**, including `process_name`, `bar_name`, menu item names, and submenu names used by generated wrappers. 3. **If source interpolation cannot be eliminated**, implement a single audited AppleScript string-encoding routine that escapes at least backslashes, quotation marks, carriage returns, line feeds, and relevant Unicode control characters. Argument passing remains preferable because manual escaping is error-prone. 4. **Validate discovered identities before use.** Resolve the target application through canonical bundle paths or bundle identifiers and verify that process names and menu metadata belong to that application. 5. **Constrain application identifiers and generated package names** to a conservative allowlist where possible, such as ASCII letters, digits, periods, underscores, and hyphens. Reject unexpected control characters and quoting characters. 6. **Add regression tests** using application, process, and menu names containing quotes, backslashes, newlines, Unicode separators, and attempted AppleScript statement termination. Tests should confirm that each value remains data and cannot alter program structure. 7. **Limit permission exposure.** Clearly separate full AppleScript ...[truncated 204 chars]
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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 (47)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The declared description presents a broad Mac automation capability covering many apps with auto-discovery, wrapper generation, and structured JSON output. The supplied code chunk is instead a specific terminal demo for Music.app. It invokes an existing 'app-agent-music' CLI and AppleScript to control playback, volume, and track search, and prints results to stdout. While Music.app control is consistent with one example named in the description, the primary purpose and scope are materially narrower than claimed, and key advertised capabilities (multi-app support, discovery, wrapper generation, structured JSON responses) are absent from this code.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
The declared description promises a broad end-user capability: discovering Mac apps, generating wrappers, and enabling AI control with structured JSON output. The actual code chunk is much narrower and only manages lifecycle operations for wrapper packages after generation: pip editable install, entry-point verification, uninstall, filesystem deletion, and registry cleanup. While wrapper installation could be a supporting part of the larger system, this specific chunk does not implement the key advertised behaviors. Therefore the supplied description does not accurately represent what this code chunk actually does.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding
The declared description presents a broad automation system for controlling many Mac apps, including auto-discovery of installed apps and CLI wrapper generation. This code chunk does not implement those capabilities. It is a narrow support utility that provides default AppleScript references for a few app IDs and a generic document default. While this may support a larger app-control system, the behavior in this chunk is materially narrower than the declared purpose, so the description does not accurately represent what this specific supplied code actually does.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The declared description promises a Mac application control system with app discovery, wrapper generation, and broad app integrations. The supplied code chunk does none of that. It is a generic output module responsible solely for formatting and printing results to stdout/stderr in JSON or Rich text/table form. While JSON output is mentioned in the description, that alone is only a small supporting detail and does not match the skill's primary claimed functionality. Therefore this chunk materially differs from the declared purpose.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
The description presents a broad automation skill that can control Mac apps and generate CLI wrappers. The actual code chunk only contains tests for an application scanner: checking scan directories, known UI app lists, sdef detection, bundle paths, and app lookup helpers. While app auto-discovery is partially aligned, the primary described capabilities—controlling apps, generating wrappers, and returning structured JSON—are not represented in this code. Therefore the description materially overstates what this code chunk does.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The declared description presents an end-user capability for controlling Mac applications and generating wrappers. However, the provided code does not implement or exercise app control, discovery, or wrapper generation. It only contains unit tests for a local registry's persistence and CRUD behavior using temporary files. While a registry could be a supporting component of such a system, this code chunk itself has a materially different immediate purpose and does not substantiate the advertised capabilities.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The README explicitly markets broad AI-driven control over native Mac applications, including actions that can affect user data, communications, files, and system state, but it does not warn users about the risk of unintended or destructive agent actions. In the context of an agent skill, this omission is dangerous because users may grant powerful capabilities to autonomous systems without understanding that the tool can send emails, manipulate documents, open files, or trigger other sensitive app behaviors.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The permission instructions tell users to grant Automation and Accessibility access so the terminal or agent can control target apps, but they omit a warning that these macOS permissions are highly sensitive and may allow broad control of other applications and UI elements. In this skill's context, that makes the risk more serious because the entire product is designed to let AI agents drive local applications, so elevated OS permissions substantially expand the blast radius of agent mistakes or abuse.

Lp3

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding
The skill advertises and instructs use of shell commands (`pip install`, `clam`, generated `clam-<app>` wrappers) and broad app automation, but it declares no explicit tool scope or permission boundaries. In an agent environment, that omission can let the skill invoke shell, read local state, and potentially write files or trigger side effects without clear sandboxing or user-approved limits.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The skill promotes broad Mac app control, command execution, and automation of native applications without prominent warnings about destructive actions, privacy exposure, or irreversible changes. In this context, an agent could open files, alter application state, send messages, modify documents, or interact with UI elements on the user's behalf, making missing safety guidance materially dangerous.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
def music(cmd: str) -> str:
    result = subprocess.run(
        ["app-agent-music"] + cmd.split(),
        capture_output=True, text=True, timeout=15,
    )
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The file contains hard-coded Chinese output such as "未找到" and additional Chinese-only terminal messages elsewhere, with no option for the user to choose another language. The policy explicitly forbids forcing a specific language without user opt-in, and this file does not document a justified region-specific constraint.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
end if
end tell
'''
    result = subprocess.run(
        ["osascript", "-e", script],
        capture_output=True, text=True, timeout=15,
    )
Confidence
98% confidence
Finding
The AppleScript passed to osascript is built with direct string interpolation of keyword inside a quoted script string. If keyword contains quotes or AppleScript syntax, an attacker could break out of the intended string literal and inject arbitrary AppleScript commands, which on macOS can control apps and potentially execute further system actions via automation.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The module docstring and most user-visible console output are written in Chinese, which imposes a language choice on all users. The file does not offer localization, user opt-in, or explain that the script is intended only for a Chinese-speaking audience or region-specific context.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
def run(cmd: str, timeout: int = 30) -> str:
    """执行命令并返回 stdout。"""
    result = subprocess.run(
        cmd.split(), capture_output=True, text=True, timeout=timeout,
    )
    if result.returncode != 0 and result.stderr.strip():
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The script performs state-changing actions against the user's Music app, including starting playback and changing volume, without a clear upfront warning or confirmation. In an agent context, that can surprise users, disrupt an active session, or alter personal environment state in ways the user did not explicitly approve.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
Automatically skipping tracks and manipulating the current media session changes user state without explicit consent. While not a high-severity security flaw, this is unsafe behavior for agent tooling because it can interfere with ongoing playback, playlists, or demonstrations running on a user's machine.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The cleanup phase silently resets volume and stops playback, which modifies user environment state even after the visible demo has ended. Hidden cleanup side effects are particularly problematic in agent skills because users may not realize the tool changed persistent or session-level settings.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The natural-language instructions throughout the README are presented in Chinese, and the file does not indicate that this language choice is optional or specific to a region-bound use case. Under the stated policy, forcing a specific language without user opt-in is a locale/language policy concern.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
The README markets unrestricted AI control over native Mac applications, including actions that can affect files, communications, media, and other system-integrated apps, but it does not warn about destructive, privacy-sensitive, or irreversible operations. In an agent context, presenting this capability as seamless and routine increases the chance that users or downstream agents will grant broad permissions and execute impactful actions without understanding the risk.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The documentation presents an automatic flow where an AI agent scans installed apps, installs wrappers, and executes commands with no safety caveat, approval checkpoint, or confirmation guidance. In this skill's context, that is especially dangerous because the generated wrappers can operate arbitrary installed applications using macOS automation permissions, enabling unintended system changes, data access, or actions in third-party apps.

Vague Triggers

Medium
Confidence
88% confidence
Finding
This is a TOML manifest file, so vague-trigger review applies. The description says "Give any AI Agent hands to control your Mac," which is very broad and lacks constraints on when or how the skill should be invoked, increasing the risk of unintended activation in agent ecosystems that rely on manifest text for routing.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
This code embeds the primary skill description in Chinese and continues using Chinese-only user-facing strings throughout the CLI, which imposes a specific language on users and downstream agents. The file does not offer any opt-in, locale selection, or justification for a Chinese-only interface.

Missing User Warnings

Medium
Confidence
85% confidence
Finding
The `remove` command invokes `uninstall_wrapper(app_id)` after only a status message, with no confirmation prompt, warning comment/docstring about deletion effects, or other user disclosure in this file. Because this is a destructive operation affecting installed wrappers, the lack of a clear warning or confirmation meets the missing-user-warning criterion for code files.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
Returns:
        安装和验证均成功则返回 True。
    """
    result = subprocess.run(
        [sys.executable, "-m", "pip", "install", "-e", str(wrapper_dir)],
        capture_output=True,
        text=True,
Confidence
92% confidence
Finding
This code installs an editable Python package from a caller-controlled directory using pip, which executes arbitrary package build/install logic and trusts the local package metadata. In this skill's context, wrappers are generated dynamically for app control, so if an attacker can influence wrapper_dir or the generated package contents, they can achieve arbitrary code execution during installation.

Static analysis

Detected: suspicious.dynamic_code_execution, suspicious.exposed_secret_literal, suspicious.insecure_tls_verification

Dynamic code execution detected.

Critical
Code
suspicious.dynamic_code_execution
Location
path/to/venv/lib/python3.14/site-packages/docutils/utils/math/math2html.py:3139

Dynamic code execution detected.

Critical
Code
suspicious.dynamic_code_execution
Location
path/to/venv/lib/python3.14/site-packages/docutils/writers/s5_html/themes/default/slides.js:353

Dynamic code execution detected.

Critical
Code
suspicious.dynamic_code_execution
Location
path/to/venv/lib/python3.14/site-packages/jaraco/functools/__init__.py:563

Dynamic code execution detected.

Critical
Code
suspicious.dynamic_code_execution
Location
path/to/venv/lib/python3.14/site-packages/pip/_vendor/pygments/formatters/__init__.py:91

Dynamic code execution detected.

Critical
Code
suspicious.dynamic_code_execution
Location
path/to/venv/lib/python3.14/site-packages/pygments/formatters/__init__.py:91

Dynamic code execution detected.

Critical
Code
suspicious.dynamic_code_execution
Location
path/to/venv/lib/python3.14/site-packages/pygments/lexers/_julia_builtins.py:150

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
path/to/venv/lib/python3.14/site-packages/keyring/backend.py:178

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
path/to/venv/lib/python3.14/site-packages/keyring/backends/chainer.py:49

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
path/to/venv/lib/python3.14/site-packages/keyring/backends/kwallet.py:113

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
path/to/venv/lib/python3.14/site-packages/keyring/cli.py:151

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
path/to/venv/lib/python3.14/site-packages/pip/_internal/network/auth.py:97

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
path/to/venv/lib/python3.14/site-packages/pip/_vendor/requests/adapters.py:257

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
path/to/venv/lib/python3.14/site-packages/pip/_vendor/requests/sessions.py:322

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
path/to/venv/lib/python3.14/site-packages/pip/_vendor/urllib3/connection.py:423

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
path/to/venv/lib/python3.14/site-packages/pip/_vendor/urllib3/connectionpool.py:991

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
path/to/venv/lib/python3.14/site-packages/pip/_vendor/urllib3/contrib/_securetransport/low_level.py:231

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
path/to/venv/lib/python3.14/site-packages/pip/_vendor/urllib3/contrib/socks.py:102

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
path/to/venv/lib/python3.14/site-packages/requests_toolbelt/auth/guess.py:118

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
path/to/venv/lib/python3.14/site-packages/requests/adapters.py:257

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
path/to/venv/lib/python3.14/site-packages/requests/sessions.py:322

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
path/to/venv/lib/python3.14/site-packages/twine/auth.py:275

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
path/to/venv/lib/python3.14/site-packages/urllib3/connection.py:807

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
path/to/venv/lib/python3.14/site-packages/urllib3/connectionpool.py:1073

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
path/to/venv/lib/python3.14/site-packages/urllib3/contrib/socks.py:116

HTTPS certificate verification is disabled.

Warn
Code
suspicious.insecure_tls_verification
Location
path/to/venv/lib/python3.14/site-packages/pip/_internal/network/session.py:312

HTTPS certificate verification is disabled.

Warn
Code
suspicious.insecure_tls_verification
Location
path/to/venv/lib/python3.14/site-packages/pip/_vendor/truststore/_macos.py:371

HTTPS certificate verification is disabled.

Warn
Code
suspicious.insecure_tls_verification
Location
path/to/venv/lib/python3.14/site-packages/pip/_vendor/truststore/_windows.py:458

HTTPS certificate verification is disabled.

Warn
Code
suspicious.insecure_tls_verification
Location
path/to/venv/lib/python3.14/site-packages/pip/_vendor/urllib3/connection.py:454

HTTPS certificate verification is disabled.

Warn
Code
suspicious.insecure_tls_verification
Location
path/to/venv/lib/python3.14/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py:113

HTTPS certificate verification is disabled.

Warn
Code
suspicious.insecure_tls_verification
Location
path/to/venv/lib/python3.14/site-packages/pip/_vendor/urllib3/contrib/securetransport.py:794

HTTPS certificate verification is disabled.

Warn
Code
suspicious.insecure_tls_verification
Location
path/to/venv/lib/python3.14/site-packages/pip/_vendor/urllib3/util/ssl_.py:140

HTTPS certificate verification is disabled.

Warn
Code
suspicious.insecure_tls_verification
Location
path/to/venv/lib/python3.14/site-packages/urllib3/connection.py:951

HTTPS certificate verification is disabled.

Warn
Code
suspicious.insecure_tls_verification
Location
path/to/venv/lib/python3.14/site-packages/urllib3/contrib/pyopenssl.py:84

HTTPS certificate verification is disabled.

Warn
Code
suspicious.insecure_tls_verification
Location
path/to/venv/lib/python3.14/site-packages/urllib3/util/ssl_.py:353