Back to skill

Security audit

Nerve Bridge Skill

Security checks for vulnerabilities and agentic risk

Overview

The skill is not clearly malicious, but it can control Trae to run IDE instructions and uses a weak local feedback file, so it needs careful review before installation.

Install only if you intentionally want Codex to drive Trae through macOS Accessibility. Review the instruction text before sending it, avoid using it in sensitive repositories or active sessions, and treat the completion file as an unreliable signal unless the skill is changed to use per-run authenticated feedback and safer cleanup.

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

Warning
Location
scripts/nerve_bridge.py:66
Finding
Unauthenticated and Race-Prone Feedback Channel<![CDATA[ ## Vulnerability Details **File Location**: `scripts/nerve_bridge.py`, lines 10, 14-18, and 66-72 **Vulnerability Type**: Predictable feedback file, unauthenticated completion signal, symlink/TOCTOU race **Risk Level**: Medium ### Vulnerable Code ```python # Define feedback file path FEEDBACK_FILE = os.path.expanduser("~/.openclaw/workspace/trae_feedback.json") ``` ```python # 1. Clear old signal (Reset the mailbox) if os.path.exists(FEEDBACK_FILE): try: os.remove(FEEDBACK_FILE) except: pass ``` ```python if os.path.exists(FEEDBACK_FILE): # Signal received! try: with open(FEEDBACK_FILE, 'r') as f: data = json.load(f) print(f"✅ [Ack] Feedback received from Trae: {data}") return except: # File might be writing, wait a bit time.sleep(1) ``` ### Technical Analysis The completion channel uses a fixed, predictable path and accepts any syntactically valid JSON found there. The feedback contains no cryptographically random per-run identifier, authentication token, expected schema validation, ownership check, permission check, or verification that the path refers to a regular file. Any local process or user with write access to `~/.openclaw/workspace` can therefore create `trae_feedback.json` after the bridge removes the previous file and cause the bridge to accept a forged completion signal. The code also performs a separate `os.path.exists()` check before calling `open()`. This creates a time-of-check-to-time-of-use window in which another local process can replace the checked path. Because `open()` follows symbolic links by default, an attacker with the required directory access can substitute a symlink to another JSON file readable by the victim account. The bare exception during cleanup suppresses errors such as permission failures or unexpected file types. This can leave an attacker-controlled path in place without notifying the caller. ### Attack Path 1. A ...[truncated 1628 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Generate a cryptographically random nonce for every invocation using `secrets.token_urlsafe()` or `secrets.token_hex()`. 2. Use a unique feedback filename for each run instead of the fixed `trae_feedback.json` path. 3. Include the nonce in the completion payload and require an exact match before accepting the response. 4. Validate the complete JSON schema, including the expected status value, nonce, and data types. 5. Store feedback files in a private directory owned by the current user and enforce mode `0700` on the directory. 6. Reject symbolic links and non-regular files. On supported systems, open the path using `os.open()` with `O_NOFOLLOW`, then inspect it with `os.fstat()`. 7. Verify that the feedback file is owned by the expected user and is not group- or world-writable. 8. Replace the `exists()`-then-`open()` sequence with a single secure open operation to reduce TOCTOU exposure. 9. Do not use bare `except` clauses. Catch specific exceptions, report cleanup failures, and abort when the feedback channel cannot be reset safely. 10. Have the Trae-side hook create the response atomically by writing to a private temporary file and renaming it into place only after the JSON document is complete. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Rogue AgentSelf-Modification, Session Persistence
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (7)

Lp3

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding
The skill clearly describes capabilities to inject clipboard contents into an IDE, execute commands indirectly through Trae, and write a feedback file, yet it declares no explicit permission or allowed-tools scope. That mismatch weakens user consent and policy enforcement, making it easier for the skill to perform system-affecting actions without transparent guardrails.

Session Persistence

Medium
Category
Rogue Agent
Content
Example:

```bash
python3 nerve_bridge.py "Create a new Python file and add a simple 'Hello World' function. After creating, add a print statement to test it."
```

## How It Works
Confidence
83% confidence
Finding
The skill establishes a persistence-like feedback mechanism by requiring generated code to write a status file under the user's home directory and then waiting on that file as an out-of-band signal. In context this is likely intended as synchronization, not stealth, but it still creates a durable control channel that could be repurposed to coordinate repeated or unauthorized actions across sessions.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The skill's workflow performs clipboard manipulation, GUI keystroke injection into Trae, and file creation for signaling, but the user-facing description does not prominently warn that it will control another application and alter local state. This is dangerous because users may invoke it expecting a passive helper, while it can actively execute instructions in an IDE context with whatever privileges that IDE/session has.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
The script silently deletes and recreates a file in the user's home directory as part of its control flow, without clear consent or integrity checks. This can overwrite expected state, enable spoofed completion signals via a predictable path, and create unsafe behavior if another local process manipulates the feedback file or path.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The script silently overwrites the clipboard and uses AppleScript/System Events to inject keystrokes into Trae, causing arbitrary instruction text plus appended hook code to be pasted and executed. In this skill's context, that is especially dangerous because the entire purpose is bi-directional remote control of an IDE, so unreviewed or attacker-supplied instructions could trigger code execution, file modification, or destructive actions on the host.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
)

    # 3. Inject Signal (Send to Clipboard)
    p = subprocess.Popen(['pbcopy'], stdin=subprocess.PIPE)
    p.communicate(input=full_payload.encode('utf-8'))

    # 4. Fire Neural Pulse (AppleScript)
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
' key code 36\n'  # Enter
        'end tell'
    )
    subprocess.run(['osascript', '-e', script])

    print("➡️ [Send] Instruction sent. Waiting for Trae signal...")
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Static analysis

No suspicious patterns detected.