Back to skill

Security audit

Android Remote Browser Debug

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent Android browser debugging guide, but it gives broad access to sensitive live browser state and JavaScript execution without enough consent, privacy, or containment guidance.

Install only if you intend to debug your own or authorized Android browser sessions. Treat console logs, DOM dumps, network data, screenshots, and evaluated JavaScript as sensitive; avoid running state-changing JavaScript unless explicitly requested, store temporary outputs in a private per-run directory, and review cleanup commands before running them.

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

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:175
Finding
Predictable Temporary Files Enable Symlink-Based File Overwrite and Data Exposure<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 175 and 196–203 **Vulnerability Type**: Predictable temporary-file creation **Risk Level**: Medium ### Vulnerable Code ```javascript // const buf = Buffer.from(r.result.data, 'base64'); // require('fs').writeFileSync('/tmp/phone_screenshot.png', buf); ``` ```bash node tmp_phone_debug.js > /tmp/phone_out.txt 2>&1 cat /tmp/phone_out.txt ``` ```bash node tmp_phone_debug.js 1>/tmp/dbg.txt 2>/tmp/dbg_err.txt; echo "---stdout---"; cat /tmp/dbg.txt; echo "---stderr---"; cat /tmp/dbg_err.txt ``` ### Technical Analysis The instructions use fixed, predictable filenames in the shared `/tmp` directory. Both shell redirection and Node.js `writeFileSync()` normally follow symbolic links. A local attacker who can write to `/tmp` may therefore create one of these paths as a symbolic link before the instructions are run. When the invoking user subsequently writes debugging output or a screenshot, the operation can overwrite the symlink target with that user's permissions. The fixed filenames also create confidentiality risks: screenshots, console output, page data, URLs, error messages, or evaluated JavaScript results may remain accessible after debugging. Permissions for newly created shell output files depend on the user's `umask`, while a pre-existing file retains its existing ownership and permission characteristics. The behavior is not required for Android remote debugging. Secure, per-run temporary storage would provide the same functionality with less risk. ### Attack Path 1. An attacker with local access monitors or anticipates use of the documented debugging procedure. 2. The attacker creates a predictable path as a symbolic link, for example: ```bash ln -s /path/writable/by/victim /tmp/phone_out.txt ``` 3. The victim runs the documented command. 4. Shell redirection or `writeFileSync()` follows the symbolic link. 5. The target is truncated or overwritten using the victim's file ...[truncated 1024 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Create a private, unpredictable temporary directory for every debugging session and ensure it is accessible only to the current user: ```bash umask 077 debug_dir="$(mktemp -d "${TMPDIR:-/tmp}/phone-debug.XXXXXX")" || exit 1 trap 'rm -rf -- "$debug_dir"' EXIT HUP INT TERM node tmp_phone_debug.js >"$debug_dir/output.txt" 2>"$debug_dir/error.txt" cat -- "$debug_dir/output.txt" cat -- "$debug_dir/error.txt" ``` Pass the generated directory to Node.js rather than hardcoding `/tmp/phone_screenshot.png`. For files that must not already exist, open them with exclusive creation semantics, such as the Node.js `wx` flag: ```javascript const fs = require('fs'); const path = require('path'); const outputPath = path.join(process.env.DEBUG_DIR, 'phone_screenshot.png'); fs.writeFileSync(outputPath, buf, { flag: 'wx', mode: 0o600 }); ``` Additional hardening measures: - Do not run these debugging commands as root or another privileged account. - Avoid retaining browser data longer than necessary. - Validate that the temporary directory is owned by the current user. - Avoid following attacker-controlled symbolic links. - Document cleanup behavior and securely remove all generated artifacts after use. ]]>

T09 · Insecure Skill Coding Practices

Note
Location
SKILL.md:253
Finding
Overbroad Wildcard Cleanup Can Delete Unrelated JavaScript Files<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, line 253 **Vulnerability Type**: Unsafe wildcard-based file deletion **Risk Level**: Low ### Vulnerable Code ```bash # 删除临时脚本 rm -f tmp_phone_debug.js tmp_debug*.js ``` ### Technical Analysis The cleanup command expands `tmp_debug*.js` relative to the current working directory. It does not verify that matching files were created by the Skill or belong to the current debugging session. Consequently, unrelated JavaScript files whose names match the pattern may be deleted. The command does not use elevated privileges itself, and the shell does not recursively traverse directories for this pattern. Its scope is limited to matching entries in the current directory that the invoking user can remove. Nevertheless, wildcard deletion is unnecessary because the Skill can track the exact files it creates. ### Attack Path 1. A legitimate project already contains a file matching `tmp_debug*.js`, or an attacker places such a file in the directory. 2. The user follows the cleanup instructions from that directory. 3. The shell expands `tmp_debug*.js` to every matching pathname. 4. `rm -f` deletes all removable matches without confirmation. 5. Unrelated source files or debugging scripts are lost. An attacker could use this behavior primarily to cause data loss or disrupt a workflow. It does not directly allow the attacker to execute code or read protected data. ### Impact Assessment Impact is constrained to files matching the pattern in the current directory and removable with the invoking user's permissions. Potential consequences include: - Accidental deletion of unrelated JavaScript files. - Loss of uncommitted work. - Disruption of builds or debugging workflows. - Broader damage if the command is run from an unintended directory or by an unnecessarily privileged user. No persistence, remote execution, credential theft, or direct privilege escalation is established by this command. ]]>
Remediation
<![CDATA[ ## Remediation Suggestions Store all generated scripts inside a dedicated per-run temporary directory and remove only that directory: ```bash umask 077 debug_dir="$(mktemp -d "${TMPDIR:-/tmp}/phone-debug.XXXXXX")" || exit 1 trap 'rm -rf -- "$debug_dir"' EXIT HUP INT TERM ``` If a dedicated directory cannot be used, record exact generated paths and delete only those paths: ```bash rm -f -- "$generated_script" ``` Do not use a broad wildcard for cleanup. Before removal, ensure that generated paths are non-empty, expected, and located beneath the designated temporary directory. The instructions should also advise users to run cleanup with ordinary user privileges. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (7)

External Script Fetching

High
Category
Supply Chain
Content
```bash
# 列出可调试的页面
curl -s http://localhost:9222/json/list | python3 -m json.tool

# 查看浏览器版本信息
curl -s http://localhost:9222/json/version | python3 -m json.tool
Confidence
90% confidence
Finding
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

External Script Fetching

High
Category
Supply Chain
Content
```bash
# 列出可调试的页面
curl -s http://localhost:9222/json/list | python3 -m json.tool

# 查看浏览器版本信息
curl -s http://localhost:9222/json/version | python3 -m json.tool
Confidence
90% confidence
Finding
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

External Script Fetching

High
Category
Supply Chain
Content
curl -s http://localhost:9222/json/list | python3 -m json.tool

# 查看浏览器版本信息
curl -s http://localhost:9222/json/version | python3 -m json.tool
```

## 调试操作
Confidence
90% confidence
Finding
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The description advertises capabilities to inspect console logs, network requests, DOM snapshots, and screenshots from a mobile browser but does not warn that these actions may expose credentials, personal data, tokens, or private browsing content. In this context, the omission is security-relevant because the skill directly facilitates access to sensitive data from a physically connected device.

Vague Triggers

Medium
Confidence
93% confidence
Finding
The trigger text is broad enough to activate on general 'phone debugging' or 'mobile console' requests without clearly requiring explicit user intent to inspect a connected Android device. Because this skill enables deep inspection of browser state, network traffic, DOM content, screenshots, and JavaScript execution on a mobile device, overbroad activation raises the chance of unintended privacy-sensitive use.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The skill includes a ready-made Runtime.evaluate template for arbitrary JavaScript execution against the connected mobile page without warning about side effects. Executing JS in a live authenticated session can alter page state, submit forms, exfiltrate accessible page data, or interfere with the user's account/session, making this more dangerous than passive inspection.

Natural-Language Policy Violations

Low
Confidence
97% confidence
Finding
The entire skill description and operating instructions are presented only in Chinese, with no indication that the skill is region-specific or that users may choose another language. This creates a locale policy concern because it imposes a language constraint without opt-in or justification.

Static analysis

No suspicious patterns detected.