Back to skill

Security audit

Alibabacloud Network Mtr Diagnosis

Security checks for vulnerabilities and agentic risk

Overview

This appears to be a real network-diagnosis skill, but it includes overbroad ECS remote shell execution and weak approval controls that users should review before installing.

Install only if you are comfortable granting Alibaba Cloud credentials that can run Cloud Assistant commands on the relevant ECS instances. Use a least-privilege RAM policy restricted to specific instances, avoid Resource:*, do not pass untrusted targets or script text, and treat ipinfo.io enrichment as sharing route-hop IP metadata with a third party.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/mtr_ecs.py:369
Finding

Remote Shell Command Injection Through the Diagnostic Target

Content
View full analysis
str: """Build the MTR diagnostic script for remote execution.""" lines = [ "#!/bin/bash", "set -e", "", "# Check mtr availability (installation is handled by the install-mtr subcommand separately)", "if ! which mtr >/dev/null 2>&1; then", ' echo "ERROR: mtr is not installed. Please use the install-mtr subcommand first."', " exit 1", "fi", "", "# ICMP MTR", 'echo "===ICMP_MTR_START==="', f"mtr -r -c {count} -n {target}", 'echo "===ICMP_MTR_END==="', "", ] if tcp_port: lines.extend([ "# TCP MTR", 'echo "===TCP_MTR_START==="', f"mtr --tcp -P {tcp_port} -r -c {count} {target}", 'echo "===TCP_MTR_END==="', "", ]) lines.extend([ "# Ping test", 'echo "===PING_START==="', f"ping -c 20 {target} 2>&1 || true", 'echo "===PING_END==="', "", ]) if tcp_port: lines.extend([ "# Curl test (HTTP)", 'echo "===CURL_START==="', f"curl -o /dev/null -s -w 'HTTP_CODE=%{{http_code}} TIME=%{{time_total}}s CONNECT=%{{time_connect}}s' " f"--connect-timeout 10 --max-time 30 http://{target}:{tcp_port}/ 2>&1 || true", 'echo "===CURL_END==="', ]) return "\n".join(lines) ``` ### Technical Analysis The `target` argument is inserted directly into multiple shell command strings without strict validation or shell escaping. The generated script is submitted to Alibaba Cloud Cloud Assistant and executed by a shell on the selected ECS instance. ...[truncated 1768 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/mtr_ecs.py:532
Finding

Public Interface Allows Unrestricted Arbitrary ECS Script Execution

Content
View full analysis
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/check-write-operation.sh:27
Finding

Fail-Open Confirmation Hook Does Not Reliably Gate Cloud Assistant Execution

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/mtr_analyze.py:247
Finding

TLS Certificate Validation Is Disabled After a Verification Failure

Content
View full analysis
/json`. 2. An attacker or misconfigured interception device causes certificate verification to fail. 3. The code retries with `check_hostname = ...[truncated 687 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:233
Finding

Predictable and Permissive Temporary Diagnostic Directory

Content
View full analysis
" > "$DIAG_DIR/input.json" ``` The workflow later writes additional files to the same directory: ```bash $PYTHON "$SKILL_DIR/scripts/mtr_ecs.py" run-mtr --instance-id --region --target --count 100 > "$DIAG_DIR/forward_mtr.json" ``` ```bash $PYTHON "$SKILL_DIR/scripts/mtr_ecs.py" run-mtr --instance-id --region --target --count 100 > "$DIAG_DIR/reverse_mtr.json" ``` ### Technical Analysis The temporary directory name is based only on the current timestamp in seconds and is therefore predictable. `mkdir -p` accepts an already existing path rather than failing when a collision occurs. The workflow does not set a restrictive `umask`, verify directory ownership, reject symbolic links, or remove the directory after use. The generated files can contain raw user input, ECS identifiers, diagnostic targets, client addresses, route topology, and command output. ### Attack Path 1. A local attacker predicts the likely timestamp used by the workflow. 2. The attacker pre-creates `/tmp/mtr_diag_` or places malicious symbolic links at expected output paths. 3. `mkdir -p` succeeds because the path already exists. 4. Shell redirection writes diagnostic content into attacker-controlled locations or follows attacker-created links where filesystem permissions allow it. 5. The attacker reads, alters, or redirects the generated results. ### Impact Assessment On a shared local system, exploitation may permit: - Disclosure of raw user-provided i ...[truncated 390 chars]
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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
Findings (27)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

This skill goes beyond passive diagnosis and includes undeclared generic remote shell execution on ECS through Cloud Assistant, plus software installation capability. Even if framed as diagnostics, these are materially sensitive actions that can alter remote systems and should be prominently declared and constrained.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

This skill goes beyond passive diagnosis and includes undeclared generic remote shell execution on ECS through Cloud Assistant, plus software installation capability. Even if framed as diagnostics, these are materially sensitive actions that can alter remote systems and should be prominently declared and constrained.

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
98% confidence
Finding

The skill wraps a cloud CLI and passes dynamically assembled parameters into a shell command. In the context of a diagnostic automation skill, this is more dangerous because user-derived instance IDs, regions, and API parameters may flow into privileged cloud operations, so shell execution could enable local command execution in addition to abuse of cloud credentials.

Content

Scanner excerpt · scripts/mtr_common.py (reported line 96)May include surrounding context.

python
shell_cmd = " ".join(shlex.quote(c) for c in cmd)
    try:
        result = subprocess.run(
            shell_cmd, shell=True, capture_output=True, text=True, timeout=timeout,
        )
    except subprocess.TimeoutExpired:

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
98% confidence
Finding

The retry implementation preserves the same unsafe shell-based invocation in a privileged diagnostic path. Because this skill may run with Alibaba Cloud credentials present, any parameter-abuse pathway can be retried automatically, compounding abuse and making exploitation more reliable.

Content

Scanner excerpt · scripts/mtr_common.py (reported line 112)May include surrounding context.

python
print(f"[WARNING] Transient error for {product} {api}, retrying...",
                  file=sys.stderr)
            try:
                retry_result = subprocess.run(
                    shell_cmd, shell=True, capture_output=True, text=True, timeout=timeout)
                if retry_result.returncode == 0:
                    try:

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

Scanner excerpt · scripts/mtr_common.py (reported line 285)May include surrounding context.

python
TOOL_INSTALL_GUIDES = {
    "aliyun": {
        "darwin": "brew install aliyun-cli\nor visit: https://help.aliyun.com/document_detail/139508.html",
        "linux": "curl -fsSL https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-amd64.tgz | tar xz && sudo mv aliyun /usr/local/bin/",
        "win32": "Visit: https://help.aliyun.com/document_detail/139508.html",
    },
}

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

run_remote_command is a reusable primitive for executing arbitrary shell scripts on ECS instances through Cloud Assistant, taking raw script_content with no restriction on permitted commands. Even if intended as an internal helper, it establishes a dangerous capability boundary for a diagnosis tool because any caller can convert it into full remote shell execution rather than limited network diagnostics.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The CLI exposes a generic run-command action that accepts arbitrary shell script content and forwards it to Alibaba Cloud Cloud Assistant for execution on ECS instances. This goes well beyond the skill’s stated MTR/network-diagnosis purpose and creates a direct remote code execution capability on managed instances, which could be abused for destructive actions, credential theft, persistence, or lateral movement if an operator or upstream agent passes untrusted input.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The run-command code path exposes raw remote shell execution via command-line arguments and immediately executes the provided script on the target instance, but there is no in-band confirmation, warning, or authorization check in that path. In a skill intended for diagnosis, this makes dangerous operations easy to trigger accidentally or through prompt/parameter abuse, increasing the risk of unauthorized changes to production systems.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill declares significant operational capabilities (shell, network, environment access, file reads) but does not define an explicit permission or allowed-tools scope. That increases the risk of overbroad execution by the agent framework, especially because the skill also instructs remote command execution and installation actions on ECS instances.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The description says to use the skill whenever users encounter network connectivity issues or need troubleshooting, but it does not define specific trigger phrases, boundaries, or exclusion conditions. This broad wording could cause unintended invocation for generic network-help requests that are not specifically about MTR-based diagnosis or Alibaba Cloud ECS scenarios.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The instructions require the agent to explicitly tell the user a fixed Chinese message, which imposes a specific language regardless of user preference. This is a natural-language policy issue because the skill does not offer opt-in, fallback translation, or any justification that the skill is only for Chinese-language users.

Content

No source excerpt is available for this finding.

Unrestricted Tool Access

Medium
Category
Excessive Agency
Confidence
84% confidence
Finding

The skill operationally enables command execution in automated mode on remote ECS instances, but the governing scope and guardrails are defined only in prose. Without hard technical restrictions, an agent could be induced to execute broader commands than intended, making the remote-diagnostics context more dangerous than ordinary local troubleshooting guidance.

Content

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

md
| User's Situation | Mode | Action |
|-----------------|------|--------|
| User provides an ECS instance ID (e.g., `i-bp1xxx`) | **Automated Mode** | Use Cloud Assistant scripts to diagnose remotely on the ECS |
| User says "no ECS", "no cloud server", "local machine", "home computer", "Mac/Windows/Linux desktop" | **Manual Mode** | ⛔ STOP. Do NOT run any commands. Only provide text guidance for the user to run MTR on THEIR machine. |
| User has an ECS but Cloud Assistant is unavailable | **Manual Mode (fallback)** | Guide user to SSH into ECS and run MTR manually |

> **CRITICAL for Manual Mode**: When the user does NOT have an ECS, you MUST NOT:

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

bash
brew install mtr
sudo mtr -r -c 100 -n <target_IP_or_domain>
# TCP mode
sudo mtr --tcp -P 443 -r -c 100 <target_IP>

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

bash
brew install mtr
sudo mtr -r -c 100 -n <target_IP_or_domain>
# TCP mode
sudo mtr --tcp -P 443 -r -c 100 <target_IP>

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

bash
brew install mtr
sudo mtr -r -c 100 -n <target_IP_or_domain>
# TCP mode
sudo mtr --tcp -P 443 -r -c 100 <target_IP>

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

bash
brew install mtr
sudo mtr -r -c 100 -n <target_IP_or_domain>
# TCP mode
sudo mtr --tcp -P 443 -r -c 100 <target_IP>

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
75% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

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

md
> Every step in this workflow (environment check, tool detection, package installation, MTR execution, result analysis) must be performed on the **remote ECS instance** through Cloud Assistant. **Never** run `which mtr`, `mtr --version`, `ping`, `mtr`, or any diagnostic command locally — the local environment is irrelevant to the ECS network diagnosis.

> **CRITICAL — Never install software without user consent:**
> When `check-mtr` reports that mtr is not installed, you MUST STOP and explicitly ask the user: "mtr 工具尚未安装在 ECS 上,是否允许我安装?" **Do NOT proceed** with installation until the user explicitly agrees. Auto-installing without consent is strictly prohibited.

> **IMPORTANT**: All scripts in this Skill reside in the skill's `scripts/` directory. Before running any command, set the `SKILL_DIR` variable to the absolute path of this skill's root directory (provided in the task's Skill path), and use it as prefix for all script paths:
> ```bash

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The automated workflow instructs the agent to ask the user a specific Chinese question before installing mtr. Because this is mandatory user-facing language and no alternative locale handling is provided, it forces a language choice without user opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This line gives a required quoted consent message in Chinese as the exact wording to use with the user. That creates a language policy violation because it fixes the user interaction language without opt-in or a documented locale-specific limitation.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The hook is documented and intended to require confirmation for write or remote-execution operations, but if JSON parsing fails or the command is placed in an unexpected field, the script returns "allow" by default. An attacker or malformed caller can exploit this fail-open behavior to bypass the confirmation gate and execute state-changing or remote commands without user approval.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The code sends each non-private hop IP to ipinfo.io to identify the ISP, which discloses network-path metadata for the user's diagnostics to a third-party service. In this skill's context, MTR output can reveal internal infrastructure relationships, customer destinations, and troubleshooting targets; transmitting that data off-platform without explicit user notice and consent creates a real privacy and data-handling risk even if the purpose is diagnostic enrichment.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/mtr_common.py (reported line 14)May include surrounding context.

python
_alternatives = []
    for _cmd in ("python3.13", "python3.12", "python3.11", "python3.10", "python3.9", "python3.8"):
        try:
            _r = _sp.Popen([_cmd, "--version"], stdout=_sp.PIPE, stderr=_sp.PIPE)
            _out, _ = _r.communicate(timeout=5)
            if _r.returncode == 0:
                _alternatives.append("%s (%s)" % (_cmd, _out.decode().strip()))

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
97% confidence
Finding

The code constructs a shell command string and executes it with shell=True. Although arguments are shell-quoted, product/api/params may still be influenced by upstream input and invoking a shell unnecessarily expands the attack surface, creating command-injection risk if quoting assumptions break or future changes add unsafe inputs.

Content

Scanner excerpt · scripts/mtr_common.py (reported line 96)May include surrounding context.

python
shell_cmd = " ".join(shlex.quote(c) for c in cmd)
    try:
        result = subprocess.run(
            shell_cmd, shell=True, capture_output=True, text=True, timeout=timeout,
        )
    except subprocess.TimeoutExpired:

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
97% confidence
Finding

This retry path repeats the same shell-based execution pattern as the initial CLI call. Any command-injection or shell-abuse issue in the first call is duplicated here, so transient-error retry also re-executes potentially unsafe shell text.

Content

Scanner excerpt · scripts/mtr_common.py (reported line 112)May include surrounding context.

python
print(f"[WARNING] Transient error for {product} {api}, retrying...",
                  file=sys.stderr)
            try:
                retry_result = subprocess.run(
                    shell_cmd, shell=True, capture_output=True, text=True, timeout=timeout)
                if retry_result.returncode == 0:
                    try:

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · scripts/mtr_common.py (reported line 285)May include surrounding context.

python
TOOL_INSTALL_GUIDES = {
    "aliyun": {
        "darwin": "brew install aliyun-cli\nor visit: https://help.aliyun.com/document_detail/139508.html",
        "linux": "curl -fsSL https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-amd64.tgz | tar xz && sudo mv aliyun /usr/local/bin/",
        "win32": "Visit: https://help.aliyun.com/document_detail/139508.html",
    },
}