Back to skill

Security audit

TRAE指挥官

Security checks for vulnerabilities and agentic risk

Overview

This skill is purpose-built to automate TRAE, but it needs Review because it can launch a local app, write project files, and auto-submit clipboard text through the desktop without strong safeguards.

Install only if you intentionally want a skill that controls a local TRAE IDE session. Use a dedicated project directory under version control, avoid placing secrets in requirements or prompts, prefer manual paste unless you can verify the TRAE window focus, install optional dependencies in a virtual environment with reviewed versions, and do not run it as Administrator unless there is a specific, understood need.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (2)

T08 · Insecure Dependencies

Warning
Location
SKILL.md:980
Finding
Unpinned Third-Party Automation Dependencies<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:980` and `SKILL.md:999-1001`; corresponding runtime guidance in `automation_helper.py:104-106` **Vulnerability Type**: Unpinned third-party dependencies installed from a mutable package index **Risk Level**: Medium ### Vulnerable Code `SKILL.md:978-981`: ```bash ### Optional (for auto-send) ```bash pip install pyautogui pyperclip ``` ``` `SKILL.md:997-1002`: ```bash ### Prompt Not Sent Install pyautogui: ```bash pip install pyautogui pyperclip ``` ``` `automation_helper.py:104-106`: ```python if not PYAUTOGUI_AVAILABLE: print("❌ 需要安装 pyautogui 和 pyperclip") print(" 运行: pip install pyautogui pyperclip") ``` ### Technical Analysis The installation instructions do not pin package versions, verify package hashes, or specify a trusted package repository. Consequently, the code imported under the names `pyautogui` and `pyperclip` depends on whatever distributions the user's active pip configuration resolves at installation time. Python packages can execute code during installation and later during import. The application imports both packages at module initialization: ```python try: import pyautogui import pyperclip PYAUTOGUI_AVAILABLE = True except ImportError: PYAUTOGUI_AVAILABLE = False ``` This creates a supply-chain exposure: a compromised upstream release, maliciously configured package index, or dependency-resolution attack could introduce code that was not part of the audited project. ### Attack Path 1. An attacker compromises a relevant package release or causes the victim's pip client to resolve packages from an untrusted or malicious index. 2. The user follows the documented command: ```bash pip install pyautogui pyperclip ``` 3. pip downloads and installs the attacker-controlled distribution because no version or cryptographic hash is enforced. 4. Malicious installation logic may run immediately, or malicious module code runs when `automation_ ...[truncated 750 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Add a reviewed dependency lock file with exact versions, for example: ```text pyautogui==<reviewed-version> --hash=sha256:<reviewed-hash> pyperclip==<reviewed-version> --hash=sha256:<reviewed-hash> ``` 2. Install dependencies with hash verification: ```bash python -m pip install --require-hashes -r requirements.txt ``` 3. Explicitly document the trusted package index and disable unintended fallback indexes where practical: ```bash python -m pip install \ --index-url https://pypi.org/simple \ --require-hashes \ -r requirements.txt ``` 4. Review transitive dependencies and update the lock file through a controlled dependency-review process. 5. Recommend installation inside a dedicated virtual environment rather than a privileged or system-wide Python environment. 6. Replace the unpinned installation commands in both `SKILL.md` and the runtime error message with the locked installation procedure. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
automation_helper.py:109
Finding
Unverified Global Keyboard Input Can Target the Wrong Application<![CDATA[ ## Vulnerability Details **File Location**: `automation_helper.py:109-121` **Vulnerability Type**: Unsafe desktop automation without target-window verification **Risk Level**: Medium ### Vulnerable Code ```python print(f"⏳ 等待 {delay} 秒让 TRAE 启动...") time.sleep(delay) # 复制提示到剪贴板 pyperclip.copy(prompt_text) print("📋 提示已复制到剪贴板") # 粘贴并发送 pyautogui.hotkey('ctrl', 'v') time.sleep(0.5) pyautogui.press('enter') print("📤 提示已发送给 TRAE") return True ``` ### Technical Analysis `pyautogui.hotkey()` and `pyautogui.press()` generate global desktop input for the application that currently owns keyboard focus. The implementation assumes that TRAE will be focused after a fixed delay, but it neither locates the TRAE window nor verifies its identity immediately before pasting and pressing Enter. A fixed sleep is not a synchronization or security boundary. Focus may change because of user activity, system notifications, startup dialogs, another application opening a window, or deliberate focus stealing. The prompt is also copied to the system clipboard, where it remains available to other local applications with clipboard access. Because the method automatically presses Enter, the operation is not limited to disclosure. If the focused application treats pasted text as an actionable command or message, the text may be submitted or executed in an unintended context. ### Attack Path 1. `quick_start()` launches TRAE and calls `send_prompt()` with a five-second delay. 2. During that interval, another application or dialog obtains keyboard focus. A local process could also deliberately bring its own window to the foreground. 3. The orchestrator copies the complete project prompt to the global clipboard. 4. The orchestrator sends `Ctrl+V` to the currently focused window without checking that it belongs to TRAE. 5. The orchestrator sends Enter, submitting the pasted content. 6. Depending on the receiving application, this can disclose the prompt, send it to an unintend ...[truncated 830 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Locate and activate the expected TRAE window through a platform-specific window-management API before generating input. 2. Verify the target process identity, executable path, and window title immediately before both the paste operation and the Enter key event. 3. Abort safely if TRAE cannot be uniquely identified or brought to the foreground. 4. Replace the fixed delay with explicit readiness detection. 5. Display the detected destination and require user confirmation before automatically submitting sensitive or custom prompts. 6. Prefer a supported TRAE API, command-line interface, or inter-process communication mechanism over global keyboard automation when available. 7. Clear the clipboard after submission, but only if its current value still equals the prompt, to avoid overwriting clipboard changes made by the user: ```python previous = pyperclip.paste() pyperclip.copy(prompt_text) try: activate_and_verify_trae_window() pyautogui.hotkey("ctrl", "v") pyautogui.press("enter") finally: if pyperclip.paste() == prompt_text: pyperclip.copy(previous) ``` 8. Add a fail-safe that never sends Enter if focus verification fails or the foreground window changes between verification and submission. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • Rogue AgentSelf-Modification, Session Persistence
Findings (20)

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding
The declared description understates the actual behavior: the skill can discover executables, launch local programs, manipulate the clipboard, simulate keystrokes, create and delete files, and continuously orchestrate work on the host. That mismatch is dangerous because users or higher-level agents may authorize the skill for 'project management' while unintentionally granting invasive automation over the local desktop and filesystem.

Self-Modification

High
Category
Rogue Agent
Content
time.sleep(1)
```

## Self-Update

Log in `execution_log.json`:
```json
Confidence
90% confidence
Finding
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.

Direct Prompt Extraction

High
Category
System Prompt Leakage
Content
f.write(prompt_text)
            
        print(f"✅ 提示文件已创建: {prompt_file}")
        return prompt_file


class ProgressMonitor:
Confidence
85% confidence
Finding
Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The documentation promotes automatic prompt sending via GUI automation and persistent config/file creation without any explicit warning, confirmation step, or discussion of side effects. In an agent skill context, this is dangerous because it normalizes actions that can manipulate another application and modify the local filesystem, increasing the risk of unintended actions, prompt injection propagation, or misuse on the user's machine.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The one-click workflow is framed as a convenience feature while omitting that it will create project artifacts, launch the IDE, and automatically inject prompts. Presenting system-impacting behavior as a single action without warnings or gating is risky because users may trigger broad local changes without understanding them, especially in an orchestration skill intended to automate development tasks.

Lp3

Medium
Category
MCP Least Privilege
Confidence
97% confidence
Finding
The skill embeds capabilities for local process launch, file read/write, shell-like orchestration, and desktop automation, but it declares no explicit tool scope or permission boundaries. In an agent setting, this can cause the skill to be invoked with overly broad authority and perform impactful host-side actions without clear consent or sandboxing.

Vague Triggers

Medium
Confidence
92% confidence
Finding
The invocation metadata is broad enough to match many normal software-development requests, increasing the chance that this powerful automation skill is selected when a safer, read-only or advisory skill would suffice. Because the skill can modify files and control a local IDE, overbroad activation materially raises the risk of unintended execution and system changes.

Vague Triggers

Medium
Confidence
94% confidence
Finding
The 'When to Invoke' section lists generic triggers like developing software or needing project management, with no scope constraints. In context, that is risky because the documented behavior includes launching executables, writing project files, and sending GUI input, so ambiguous routing can escalate a routine request into host-modifying actions.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The skill openly instructs file creation, prompt generation, IDE launching, and task submission, but it does not present a clear warning that it will modify the local system and potentially overwrite project state. Missing a safety notice is especially problematic here because the operations are not merely advisory; they change files and trigger automated execution flows.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
Clipboard injection and simulated keypresses via pyautogui/pyperclip can send unintended commands to whichever window has focus, leak sensitive clipboard contents, or interfere with unrelated applications. Without a dedicated warning and focus-validation safeguards, this desktop automation creates a realistic path to accidental command execution and data exposure on the user's machine.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
if project_path:
            print(f"   项目: {project_path}")
            
        subprocess.Popen(cmd)
        return True
    
    def send_prompt(self, prompt_text, delay=5):
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The function copies prompt content to the system clipboard and immediately auto-pastes it into the active GUI window. Clipboard contents can be observed or overwritten by other applications, and GUI automation may send sensitive text to the wrong window if focus changes, causing unintended disclosure or execution in another application.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
create_project() creates directories and overwrites requirements.md without prompting or safeguarding existing contents. If project_dir is mistaken, attacker-influenced, or points to an important location, local files may be modified or destroyed unintentionally.

Natural-Language Policy Violations

Medium
Confidence
86% confidence
Finding
The generated prompt instructs the downstream agent to work autonomously and not require user confirmation. In an orchestration skill, this reduces human oversight for code generation and filesystem changes, increasing the chance of unsafe actions, overreach, or propagation of harmful instructions embedded in requirements.

Unbounded Resource Access

Medium
Category
Excessive Agency
Content
return status
    
    def wait_for_completion(self, timeout=None, interval=10):
        """
        等待项目完成
Confidence
84% confidence
Finding
wait_for_completion() allows timeout=None and then loops indefinitely, polling the filesystem forever unless a signal file appears. In automation contexts this can hang an orchestrator, tie up worker capacity, and create a denial-of-service condition or operational deadlock.

Natural-Language Policy Violations

Medium
Confidence
97% confidence
Finding
This Python file presents its title, menu, prompts, and status messages entirely in Chinese, beginning with the module description. The policy allows locale constraints only when users are given a choice or the restriction is clearly documented and justified; neither is present here.

Natural-Language Policy Violations

Low
Confidence
71% confidence
Finding
The entire skill file is presented only in Chinese and includes Chinese-facing instructions, with no indication that users may choose another language or that the skill is intentionally region-specific. Under SQP-3, forcing a specific language without opt-in can be a natural-language policy issue.

Natural-Language Policy Violations

Low
Confidence
80% confidence
Finding
Several examples, comments, prompts, and status strings are written in Chinese while the surrounding document is in English, and the skill does not state that Chinese output is optional or user-selected. This creates an implicit language preference that may not match the user's locale or expectations.

Natural-Language Policy Violations

Low
Confidence
78% confidence
Finding
Docstrings, console output, and generated prompt content are all presented in Chinese, with no indication that another language can be selected. Under the policy, forcing a specific language without user opt-in can be a locale/language policy violation.

Missing User Warnings

Low
Confidence
82% confidence
Finding
The code persists prompt content derived from requirements to a local file, which may store sensitive project details on disk without notice. This is primarily a privacy/data-handling issue rather than code-execution risk, but it can expose confidential requirements through backups, indexing, or other local access.

Static analysis

No suspicious patterns detected.