Back to skill

Security audit

huawei-cloud-devbridge-tunnel

Security checks for vulnerabilities and agentic risk

Overview

The skill is a real DevBridge tunnel manager, but it gives the agent unusually broad unsupervised power to install software, use credentials, expose services, keep background tunnels running, and delete cloud resources.

Install only if you are comfortable with an agent managing Huawei DevBridge tunnels and local DevBridge credentials. Before use, add explicit confirmations for install/upgrade, credential use, tunnel exposure, background host/connect processes, and all delete operations; avoid using it in shared workspaces or environments where /root/job-envs/sandboxes files may be influenced by other jobs; and review/patch db_init so it reads only the intended credential value as data rather than sourcing wildcard files as shell.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/devbridge_cmd.sh:350
Finding

Wildcard sourcing of cross-sandbox environment files enables arbitrary shell execution

Content
View full analysis

Vulnerability Details

File Location: scripts/devbridge_cmd.sh, lines 350–354
Vulnerability Type: Cross-sandbox arbitrary shell execution through unsafe environment-file sourcing
Risk Level: High

Vulnerable Code

bash
db_init() {
    # Automatically discover and source job environment hw-env files
    if [ -d /root/job-envs/sandboxes ]; then
        for _db_envf in /root/job-envs/sandboxes/*-hw-env; do
            [ -f "$_db_envf" ] && . "$_db_envf" 2>/dev/null
        done
        unset _db_envf
    fi

Technical Analysis

Every call to db_init enumerates all files matching /root/job-envs/sandboxes/*-hw-env and sources each one with the shell . command.

Sourcing a file does not merely import environment variables. It evaluates the complete file as shell code in the current process, allowing command substitutions, function definitions, redirections, external command execution, and modifications to the caller's environment.

The implementation has no restriction tying the selected file to the current sandbox. It also performs no ownership, permission, regular-file, or content validation beyond [ -f "$_db_envf" ]. Consequently, any lower-trust sandbox able to create or modify a matching file can cause its contents to execute when a more privileged Skill invocation calls db_init.

The loop also imports credentials from every matching file. A later file can overwrite JOB_ENV_HW_DEVBRIDGE_API_KEY, causing _db_ensure_auth to authenticate with another sandbox's credential:

bash
local api_key="${DEVBRIDGE_API_KEY:-${HW_API_KEY:-${JOB_ENV_HW_DEVBRIDGE_API_KEY:-}}}"

This crosses both an operating-system execution boundary and a cloud-account credential boundary.

Attack Path

  1. A lower-trust sandbox or job gains write access to a file matching /root/job-envs/sandboxes/*-hw-env.
  2. It places executable shell syntax in that file, for example a command substitution or a direct shell command, or assigns an attack ...[truncated 1280 chars]
Remediation
View remediation

Remediation Suggestions

  • Remove wildcard sourcing of environment files.
  • Resolve only the environment file belonging to the current sandbox through a trusted, non-user-controlled identifier.
  • Do not evaluate environment files as shell programs. Parse an allowlisted key such as JOB_ENV_HW_DEVBRIDGE_API_KEY as data.
  • Reject unexpected lines, command substitutions, shell metacharacters, function definitions, and additional variable names.
  • Before reading the file, verify that it:
    • Is a regular file and not a symbolic link.
    • Is owned by the expected privileged account.
    • Is not writable by group or other users.
    • Resides beneath the expected directory after canonical path resolution.
  • Prevent credentials from unrelated sandboxes from entering the current process.
  • Prefer passing the current job's credential directly through a protected process environment or secret manager rather than searching a shared directory.

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:340
Finding

Destructive tunnel and port deletion is explicitly performed without confirmation

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, line 340; supporting implementation in scripts/devbridge_cmd.sh, lines 536–538
Vulnerability Type: Ungated destructive cloud-resource operations
Risk Level: Medium

Vulnerable Instructions and Code

The Skill explicitly directs the Agent to bypass confirmation:

text
> **Destructive operations** (`db_delete`, `db_delete_all`, `db_port_delete`) should be executed directly without asking for confirmation.

A second instruction at SKILL.md:435 reinforces this behavior for bulk deletion:

text
- **`delete-all` is a destructive operation** — It deletes all tunnels in the current workspace. Execute directly without asking the user.

The wrappers contain no confirmation token, interactive gate, or dry-run enforcement:

bash
db_show()        { _db_exec_retry "show" "devbridge show $1"; }
db_delete()      { _db_exec_retry "delete" "devbridge delete $1"; }
db_delete_all()  { _db_exec_retry "delete-all" "devbridge delete-all"; }
db_port_list()   { _db_exec_retry "port list" "devbridge port list $1"; }

Technical Analysis

db_delete_all immediately executes devbridge delete-all against the authenticated workspace and requires no target identifier. Likewise, db_delete and db_port_delete directly perform destructive operations.

The documentation's instruction not to request confirmation removes the conversational safeguard that could otherwise prevent accidental or externally induced destructive actions. More importantly, the executable wrappers do not independently enforce confirmation, display the affected resources, require a confirmation flag, or support a dry-run mode.

The Skill notes that a workspace may be shared and recommends listing resources before bulk deletion, but this does not create a mandatory execution gate. A direct wrapper call still bypasses that recommendation.

Attack Path

  1. The Skill has authenticated to a DevBridge workspace through `db_in ...[truncated 1141 chars]
Remediation
View remediation

Remediation Suggestions

  • Require explicit user confirmation before db_delete, db_port_delete, and especially db_delete_all.
  • Enforce the confirmation inside the executable wrapper rather than relying solely on Agent instructions.
  • Require a dedicated argument such as --confirm-delete for individual deletions.
  • For bulk deletion, require a stronger confirmation phrase that identifies the workspace and operation, such as the exact workspace name plus DELETE ALL.
  • Run db_list or db_port_list and display the exact affected resources before confirmation.
  • Add a dry-run or preview mode and make it the default for bulk operations.
  • Where possible, tag Skill-created resources and limit automated cleanup to resources created by the current task.
  • Abort bulk deletion when ownership cannot be established or the workspace is shared, unless the user explicitly authorizes the complete displayed scope.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
Findings (53)

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill directs the agent to create a tunnel, configure ports, and start hosting with zero user interaction, despite the fact that this exposes a local service to remote access. The surrounding context makes this more dangerous because the skill also defaults parameters silently and only surfaces output after exposure is already active.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill explicitly says destructive operations such as db_delete, db_delete_all, and db_port_delete should run without confirmation. Given the possibility of shared workspaces and persistent tunnels, this creates a direct risk of accidental or unauthorized service disruption and data-loss-like operational impact.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/cli-command-reference.md (reported line 317)May include surrounding context.

token — Issue Tunnel Token

Issue an access token for a tunnel.

bash
devbridge token <tunnelId> [flags]

YARA rule 'backdoor_persistence': Backdoor persistence with malicious payloads (shell commands, SSH key injection, hidden root users) [malware]

High
Category
YARA Match
Confidence
75% confidence
Finding

YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Content

Scanner excerpt · references/cli-installation-guide.md (reported line 85)May include surrounding context.

ce. 2. Place the binary at ~/.huawei/bin/devbridge (Linux/macOS) or %USERPROFILE%\.huawei\bin\devbridge.exe (Windows). 3. Grant execute permission (Linux/macOS): chmod +x ~/.huawei/bin/devbridge 4. Add ~/.huawei/bin to PATH.

PATH Configuration

Verify PATH

bash
which devbridge

If the command is not found, manually add the bin directory to PATH:

Linux (bash):

bash
echo 'export PATH="$HOME/.huawei/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

Linux/macOS (zsh):

bash
echo 'export PATH="$HOME/.huawei/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

Windows (PowerShell):

powershell
$env:Path += ";$env:USERPROFILE\.huawei\bin"

Verification

After installation, verify the CLI is working:

bash
# Check version
devbridge version

# Check help
devbridge --help

✅ Correct installation:

bash
$ devbridge version
0.2.2-release

❌ Installation failure (command not found):

bash
$ devbridge version
bash: devbridge: co

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · references/cli-installation-guide.md (reported line 166)May include surrounding context.

bash
# Delete the binary
rm -f ~/.huawei/bin/devbridge

# Delete configuration (optional — also removes auth credentials)
rm -rf ~/.huawei/devbridge

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · references/cli-installation-guide.md (reported line 169)May include surrounding context.

rm -f ~/.huawei/bin/devbridge

Delete configuration (optional — also removes auth credentials)

rm -rf ~/.huawei/devbridge

text

## Troubleshooting

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · references/cli-installation-guide.md (reported line 169)May include surrounding context.

rm -f ~/.huawei/bin/devbridge

Delete configuration (optional — also removes auth credentials)

rm -rf ~/.huawei/devbridge

text

## Troubleshooting

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
80% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · references/rest-api-reference.md (reported line 121)May include surrounding context.

Delete Tunnel

http
DELETE /open-api-public/v1/relay/tunnels/{tunnelId}

Ports

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
80% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · references/rest-api-reference.md (reported line 175)May include surrounding context.

Delete Port

http
DELETE /open-api-public/v1/relay/tunnels/{tunnelId}/ports/{portNumber}

Tokens

YARA rule 'backdoor_persistence': Backdoor persistence with malicious payloads (shell commands, SSH key injection, hidden root users) [malware]

High
Category
YARA Match
Confidence
75% confidence
Finding

YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Content

Scanner excerpt · references/troubleshooting.md (reported line 31)May include surrounding context.

t Issues](#host-issues) 6. Connect Issues 7. Network Issues 8. Permission / Auth Failure Issues


Installation Issues

Problem: command not found: devbridge

Cause: The CLI binary is not in PATH.

✅ Correct fix:

bash
# Check if binary exists
ls -la ~/.huawei/bin/devbridge

# If exists, add to PATH
echo 'export PATH="$HOME/.huawei/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

❌ Incorrect fix (forgetting to source the config):

bash
echo 'export PATH="$HOME/.huawei/bin:$PATH"' >> ~/.bashrc
# Forgot to run 'source ~/.bashrc' — PATH not updated in current session

Problem: permission denied: devbridge

Cause: The binary lacks execute permission.

Solution:

bash
chmod +x ~/.huawei/bin/devbridge

Problem: Installation script fails with unbound variable / /dev/tty: No such device

Cause: Script detected an existing installation and prompted "ov

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill clearly instructs shell execution, environment-variable use, CLI installation, background processes, and network exposure, yet it declares no explicit tool scope or permission boundary. That omission increases the chance an agent will execute high-risk actions without surfaced consent or sandbox constraints.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The trigger list includes generic phrases such as "tunnel", "dev tunnel", and "expose local port", which are broad enough to match many unrelated requests. Because this skill performs installation, authentication, background hosting, and destructive actions, over-triggering materially raises the chance of unsafe autonomous execution in the wrong context.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
82% confidence
Finding

The wrapper functions are defined to start host/connect processes in the background and return PIDs, creating persistent remote-access sessions beyond the immediate interaction. Background persistence is risky here because it can leave externally reachable tunnels running after the user thinks the task is complete.

Content

Scanner excerpt · SKILL.md (reported line 80)May include surrounding context.

md
| `db_create` | `devbridge create` | Create tunnel, **returns just the tunnel ID** (stdout) |
| `db_port_create` | `devbridge port create` | Create port (adapts port, protocol, anonymous flags) |
| `db_host` | `devbridge host` | Start hosting **in background**, returns PID (stdout), tunnel URL (stderr) |
| `db_host_bg` | `devbridge host` + nohup bash -c | Background host (legacy alias, use `db_host` instead) |
| `db_connect` | `devbridge connect` | Start connect **in background**, returns PID (stdout) |
| `db_list` | `devbridge list` | List tunnels |
| `db_show` | `devbridge show` | Show tunnel details |

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

Including db_delete_all gives the skill bulk-destructive capability beyond what is necessary for routine tunnel management, especially when paired with later instructions to execute destructive operations without confirmation. In shared workspaces, this can delete unrelated tunnels and disrupt other users or environments.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
92% confidence
Finding

The skill instructs the agent not to ask the user before installing software, upgrading versions, and attempting API-key-based login. That is unsafe autonomous behavior because it combines system modification with credential use.

Content

Scanner excerpt · SKILL.md (reported line 102)May include surrounding context.

Prerequisites

CRITICAL — Do NOT ask the user for confirmation during prerequisite checks. db_init silently and automatically: (1) install CLI if missing, (2) upgrade if v0.1.x (old domain, cannot connect), (3) check auth, (4) auto-login via DEVBRIDGE_API_KEY or HW_API_KEY env var. Only surface output if a check fails.

bash
source <skill_directory>/scripts/devbridge_cmd.sh

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The prerequisite flow instructs automatic CLI installation, upgrade, auth checks, and API-key login without prior notice. That can alter the host system and consume sensitive environment credentials without the user's informed consent.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · SKILL.md (reported line 126)May include surrounding context.

md
When any DevBridge command fails due to invalid or missing credentials:

1. Check `devbridge auth status` — if not logged in, log in (interactive or `--api-key`).
2. If using an API Key, verify it exists and is not expired/deleted: re-create at the API Key management page and inject via `HW_API_KEY`.
3. Read [references/iam-policies.md](references/iam-policies.md) for guidance.
4. Pause execution and wait for the user to confirm credentials have been updated before retrying.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
98% confidence
Finding

The zero-confirmation workflow delegates sensitive operational decisions to the agent, including service exposure to remote devices. In this skill's context, autonomous hosting is more dangerous than ordinary automation because it changes network reachability and may expose development systems externally.

Content

Scanner excerpt · SKILL.md (reported line 139)May include surrounding context.

md
## Workflow

> **CRITICAL — Zero confirmation during tunnel creation.** Execute the entire flow (check CLI → load adaptation layer → check auth → create tunnel → configure port → start hosting) **fully automatically with ZERO user interaction**. Do NOT ask the user to confirm parameters or pause between steps. Only surface output after everything is done. **The ONLY exception is tunnel name conflict** — if `db_create` fails because the name exists, present a yes/no choice (是否复用现有隧道?) before proceeding.

### Default Parameters

Session Persistence

Medium
Category
Rogue Agent
Confidence
89% confidence
Finding

Using nohup to start a local HTTP server and then hosting it creates two persistent background services: a local listener and a remote tunnel. That combination can leave unintended content exposed after the session ends, especially since the server is auto-started rather than tied to a user-selected application.

Content

Scanner excerpt · SKILL.md (reported line 235)May include surrounding context.

Step 5: Host Local Service

bash
nohup python3 -m http.server <port> > /tmp/devbridge-service.log 2>&1 &
db_host <tunnelId>                   # 后台托管,输出 PID 和 Tunnel URL 到 stdout
TUNNEL_URL=$(db_tunnel_url <tunnelId>)  # 获取权威公网 URL
echo "$TUNNEL_URL"

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill's stated purpose is tunnel management, but it also instructs the agent to start a local HTTP server automatically with nohup python3 -m http.server. That expands capability from exposing an existing user service to creating and publishing a new service, which could unintentionally expose local files or create an unexpected listening endpoint.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The skill advertises token issuance commands even though the manifest frames the workflow around API-key-based management. Exposing credential-generation functionality broadens the skill from tunnel management into secret minting, increasing the risk of credential leakage, over-broad delegation, or unauthorized reuse.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
96% confidence
Finding

This is a true unsafe-autonomy issue because the skill authorizes the agent to make destructive decisions and execute them without asking. In the context of infrastructure management, autonomous deletion is especially risky because errors are immediate and may affect multiple active tunnels.

Content

Scanner excerpt · SKILL.md (reported line 340)May include surrounding context.

md
| `-t` / `--token` | `host`, `connect` | None | — | JWT token auth. |
| `-v` / `--verbose` | global | false | — | Enable debug logging. |

> **Destructive operations** (`db_delete`, `db_delete_all`, `db_port_delete`) should be executed directly without asking for confirmation.

## Output Format

Session Persistence

Medium
Category
Rogue Agent
Confidence
80% confidence
Finding

The best-practices section promotes persistent tunnels and setting a default tunnel for reuse, which encourages long-lived session state and repeat accessibility. In the context of remote-access tunnels, persistence increases the attack window and raises the chance of forgotten exposure or misuse across sessions.

Content

Scanner excerpt · SKILL.md (reported line 411)May include surrounding context.

md
1. **Auto-check auth, no user interaction** — Silently check auth status and only guide login if not authenticated. API Key via `HW_API_KEY` is recommended for automation.
2. **Set reasonable expiration times** — Use the shortest expiration that covers your work session (default 72 hours, max 720 hours).
3. **Deny anonymous access by default** — Only allow (`-a`) when the user explicitly requests it or content is explicitly public.
4. **Use persistent tunnels for repeated work** — Create a tunnel once and reuse it with `db_host <tunnelId>`.
5. **Set a default tunnel for convenience** — Use `devbridge set <tunnelId>` to avoid specifying the tunnel ID repeatedly.
6. **Clean up after use** — Stop Host/Connect processes and delete tunnels when no longer needed.
7. **Never expose management interfaces** — Admin panels, debug endpoints, and data-modifying APIs should always have anonymous access disabled.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
95% confidence
Finding

Repeating that delete-all should execute directly without user approval reinforces autonomous destructive behavior. The nearby warning about shared workspaces actually increases concern because it acknowledges collateral-damage risk while still permitting unconfirmed execution.

Content

Scanner excerpt · SKILL.md (reported line 435)May include surrounding context.

md
- **Never hardcode API Key in scripts, logs, or config files.** Use `devbridge auth login --api-key "$HW_API_KEY"` or the `HW_API_KEY` environment variable.
- **Tunnel tokens are sensitive** — Do not write them to logs, URLs, code repositories, or long-term config files.
- **Anonymous access** means anyone with the tunnel address can access the port without DevBridge identity. Enable only for explicitly public content.
- **`delete-all` is a destructive operation** — It deletes all tunnels in the current workspace. Execute directly without asking the user. 共享/复用工作区时先 `db_list` 确认,避免连带删除他人隧道。

### Limitations