T09 · Insecure Skill Coding Practices
- Location
src/platform/linux.js:30- Finding
Shell Command Injection in the Linux Calculator Module
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is meant to show chat-derived numbers in a calculator, but it ships under-scoped desktop automation and command-execution code that users should review before installing.
Review this skill before installing. It has no obvious exfiltration or persistence, but it can launch and manipulate local calculator applications, close existing calculator windows, and includes exported platform modules with command-injection flaws. Use only in a controlled desktop environment unless the publisher narrows triggers, removes unsafe platform modules, avoids pkill and shell interpolation, and documents explicit per-use consent for GUI automation.
src/platform/linux.js:30Shell Command Injection in the Linux Calculator Module
src/platform/macos.js:21Shell Command Injection in the macOS AppleScript Launcher
src/platform/windows.js:75Command Injection in the Windows PowerShell Invocation
src/platform/windows.js:75Predictable and Unsafely Cleaned Temporary PowerShell Script
If the implementation uses a custom GTK window or arbitrary text display instead of the stated system calculator and phrase-mapping flow, the skill is materially different from what it claims. While this may not always be directly exploitable, deceptive or inaccurate behavior weakens trust boundaries and can conceal unexpected UI spoofing or broader input acceptance.
If the implementation uses a custom GTK window or arbitrary text display instead of the stated system calculator and phrase-mapping flow, the skill is materially different from what it claims. While this may not always be directly exploitable, deceptive or inaccurate behavior weakens trust boundaries and can conceal unexpected UI spoofing or broader input acceptance.
If the implementation uses a custom GTK window or arbitrary text display instead of the stated system calculator and phrase-mapping flow, the skill is materially different from what it claims. While this may not always be directly exploitable, deceptive or inaccurate behavior weakens trust boundaries and can conceal unexpected UI spoofing or broader input acceptance.
If the implementation uses a custom GTK window or arbitrary text display instead of the stated system calculator and phrase-mapping flow, the skill is materially different from what it claims. While this may not always be directly exploitable, deceptive or inaccurate behavior weakens trust boundaries and can conceal unexpected UI spoofing or broader input acceptance.
Auto-triggering on broadly defined emotional expressions can cause the skill to activate unexpectedly during normal conversation, launching GUI actions without clear user intent. In this context, opening or manipulating a desktop calculator is low-to-moderate impact, but the trigger ambiguity increases the chance of nuisance behavior, focus stealing, and accidental execution of local actions.
Examples like common everyday phrases make the activation surface too broad, so ordinary chat may trigger the skill unintentionally. Because the skill affects the local desktop environment, accidental activations can repeatedly open or alter calculator windows and degrade user control over the system session.
Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.
Files:
calculator-chat/SKILL.mdStep 1: Write SKILL.md
---
The file implements a standalone GTK calculator GUI, while the skill metadata describes a chat-triggered calculator-display behavior. This mismatch is dangerous because it can conceal undeclared functionality, mislead reviewers about what will execute, and expand the runtime/UI attack surface beyond the documented skill behavior.
Direct eval() call evaluates arbitrary expressions. This can be exploited to execute malicious code or exfiltrate data.
}
# 使用 eval 但只允许数字和运算符
result = eval(expr, {"__builtins__": {}}, allowed_names)
return result
except Exception:
return None
The AppleScript subprocess uses System Events keystroke automation to type content into the GUI, which is dangerous because keystrokes may be delivered to the wrong window if focus changes and because this pattern can be repurposed for broader host interaction. The escaping is also not a strong safety boundary for shell-embedded AppleScript, so the combination of subprocess execution and UI injection creates elevated risk relative to the skill's simple stated purpose.
The skill declares executable dependencies and its documentation describes shell/process interactions, but it does not declare any explicit tool scope or permissions. This creates a transparency and containment problem: a host may grant or infer broader shell/file/env access than users expect, making local process control and command execution harder to review safely.
The description specifies responding with calculator-number meanings based on Chinese homophonic interpretation and states support for Chinese phonetic translation, but it does not indicate that this is optional or user-selected. This can violate language or locale policy when a skill imposes one language behavior by default.
The design document defines the trigger as /calc <message>, while the skill metadata describes activation on /calc-chat or emotional expressions. This mismatch is security-relevant because users, reviewers, and enforcement systems may misunderstand when the skill activates and what scope of behavior to expect, increasing the chance of unintended execution or insufficient review of the real behavior.
The design proposes OS-level window discovery and synthetic input mechanisms such as Win32 messaging, AppleScript, and xdotool to control a system application. Even if intended for a calculator, these primitives are broadly applicable to desktop automation and can be repurposed to manipulate other windows, inject input without focus, or bypass normal user awareness, making the skill materially more dangerous in context.
The design explicitly states that it will launch the system calculator and send input in the background without focus, yet provides no user warning or consent model. Hidden application launching and background UI manipulation reduce transparency and can surprise users, creating opportunities for misuse, social engineering, or unauthorized desktop interaction under the guise of a harmless chat feature.
The implementation plan expands a narrowly described skill into a generic CLI that accepts arbitrary user-provided input and automates OS GUI actions based on that input. This increases capability beyond the declared scope, making the skill easier to invoke in unintended contexts and reducing opportunities for policy gating or user consent.
The plan grants the skill subprocess-based GUI automation across Windows, macOS, and Linux, including PowerShell, AppleScript, and xdotool execution. These are powerful primitives that exceed a simple text-mapping feature and materially raise the risk of abuse, accidental interaction with the wrong window, or future extension into arbitrary desktop control.
The SKILL.md documentation changes activation from the declared /calc-chat or emotional-expression behavior to /calc <message>, creating a mismatch between user expectations, manifest semantics, and actual execution. Such trigger drift can bypass review assumptions and cause the skill to run in broader situations than intended.
The user-facing skill description and usage omit a clear warning that the skill will launch and control a local GUI application through OS automation. Lack of transparency can lead to surprising execution, unsafe consent assumptions, and users authorizing a skill without understanding that it can manipulate desktop state.
The module docstring explicitly describes a full arithmetic calculator, contradicting the stated chat-based emotional-number skill. While not directly exploitable on its own, misleading internal documentation can help hide unauthorized behavior and reduce the chance that reviewers detect functionality drift or policy violations.
The skill launches local processes and opens a system calculator based on user-controlled input. While the input is somewhat constrained by pattern matching and digit extraction, the code still triggers host-side application execution, which is a real security concern for agent skills because it crosses from text handling into local OS interaction and could be abused for unwanted application launches or user disruption.
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
"""检查计算器是否正在运行"""
try:
# 使用 pgrep 检查进程,避免直接杀进程
result = subprocess.run(
['pgrep', '-x', 'gnome-calculator'],
capture_output=True,
timeout=2
Closing existing calculator processes is unnecessary for the advertised function of displaying calculator-chat responses. In a desktop automation setting, this broad side effect can interfere with unrelated user activity and indicates overbroad permissions/capability relative to the skill's declared purpose.
This code kills all gnome-calculator processes on the desktop, which exceeds the stated purpose of merely showing a number in the calculator. In an agent/skill context, terminating user applications is a disruptive side effect and can cause denial of service or loss of unsaved calculator state for the current user.
def close_calculator():
"""关闭已打开的计算器"""
try:
subprocess.run(
['pkill', '-x', 'gnome-calculator'],
capture_output=True,
timeout=2
The ability to kill desktop calculator processes is not justified by a skill that should only display numeric messages. Even without privilege escalation, an agent that can terminate user applications creates an avoidable denial-of-service capability and weakens trust boundaries on the desktop.