Back to skill

Security audit

huawei-cloud-storage-query

Security checks for vulnerabilities and agentic risk

Overview

The skill is read-only in intent, but its required setup and cloud API clients use unsafe TLS and dependency-installation patterns that could expose credentials or run untrusted code.

Install only after reviewing the setup path. Use least-privilege read-only Huawei Cloud credentials, avoid running it on untrusted networks, and require fixes for TLS verification, dependency pinning or hashes, removal of --trusted-host, and explicit confirmation before setup or credential validation.

Vulnerability Patterns
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • 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
Findings (3)

T03 · Remote Payload Retrieval and Execution

Error
Location
scripts/ensure_env.py:278
Finding

Unverified Remote Python Bootstrap Is Downloaded and Executed

Content
View full analysis

Vulnerability Details

File Location: scripts/ensure_env.py:26, 278-294
Vulnerability Type: Unauthenticated remote code retrieval and execution
Risk Level: High

The Skill documentation makes the environment check a prerequisite in SKILL.md:71-78 and SKILL.md:101-107. If both pip and ensurepip are unavailable, that check downloads a Python program from the network and executes it.

Relevant code:

python
ssl._create_default_https_context = ssl._create_unverified_context
python
get_pip_path = os.path.join(tempfile.gettempdir(), "get-pip.py")
urls = [
    "https://mirrors.huaweicloud.com/repository/pypi/simple/get-pip.py",
    "https://bootstrap.pypa.io/get-pip.py",
]

ctx = ssl._create_unverified_context()

for url in urls:
    info(f"尝试下载 get-pip.py: {url}")
    try:
        urllib.request.urlretrieve(url, get_pip_path, context=ctx)
    except Exception as e:
        print(f"    下载失败: {e}")
        continue

    rc, out, err = run_cmd([sys.executable, get_pip_path], timeout=120)
    if rc == 0:
        ok("get-pip.py 安装 pip 成功")
        return True

Technical Analysis

The code explicitly creates an SSL context that does not verify certificates and also replaces Python's default HTTPS context with an unverified context. The downloaded file is not checked against a pinned hash or trusted signature before being passed to the Python interpreter.

This turns a network response into an executable code channel. HTTPS encryption alone does not provide server authenticity when certificate validation is disabled. A network-positioned attacker, malicious proxy, or DNS/network intermediary can therefore substitute arbitrary Python content.

The behavior is reachable through the documented setup flow when:

  1. The Skill's required environment check is invoked.
  2. The virtual environment does not have a working pip installation.
  3. `python -m ensurepip --upgrade ...[truncated 1281 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove both uses of unverified SSL contexts:
    python
    ssl._create_default_https_context = ssl._create_unverified_context
    ctx = ssl._create_unverified_context()
    
  2. Use Python's verified default TLS context and system trust store.
  3. Prefer failing safely with manual installation instructions if ensurepip is unavailable.
  4. If remote bootstrap remains necessary, pin an expected SHA-256 digest or verify a trusted cryptographic signature before execution.
  5. Download to a securely created file with restrictive permissions and delete it after verification and use.
  6. Do not execute a fallback response merely because the download completed successfully.

T09 · Insecure Skill Coding Practices

Error
Location
scripts/config.py:46
Finding

TLS Certificate Verification Is Disabled for Authenticated Cloud API Traffic

Content
View full analysis

Vulnerability Details

File Location: scripts/config.py:8-9, 46-64
Vulnerability Type: Improper certificate validation for credential-bearing API requests
Risk Level: High

All service clients use the shared build_http_config() function. That function disables TLS certificate verification and suppresses the corresponding warning.

Relevant code:

python
# 抑制因 ignore_ssl_verification 产生的 InsecureRequestWarning
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
python
def build_http_config():
    """构建 HTTP 配置,代理支持环境变量

    代理 URL 来源(优先级从高到低):
      1. HTTPS_PROXY
      2. HTTP_PROXY

    代理 URL 格式:
      - http://host:port
      - http://user:pass@host:port
    """
    http_config = HttpConfig.get_default_config()
    http_config.ignore_ssl_verification = True
    http_config.timeout = (30, 60)
    http_config.retry_times = 3

    proxy_url = _get_proxy_url()
    if proxy_url:
        parsed = urlparse(proxy_url)
        http_config.proxy_protocol = parsed.scheme or "http"
        http_config.proxy_host = parsed.hostname or ""
        http_config.proxy_port = parsed.port or 8080
        http_config.proxy_user = parsed.username or ""
        http_config.proxy_password = parsed.password or ""

    return http_config

A representative authenticated call appears in scripts/obs/get_object.py:29-37:

python
http_config = build_http_config()
client = ObsClient.new_builder().with_http_config(http_config).with_credentials(
    ObsCredentials(AK, SK) if not SecurityToken else ObsCredentials(AK, SK, SecurityToken)).with_region(ObsRegion.value_of(Region)).build()
if not client:
    print("无法获取 OBS 客户端")
    exit(-1)

response = client.get_object(request)

Technical Analysis

Setting ignore_ssl_verification prevents the SDK from authenticating the remote server's certificate. Warning suppression further hides the insecu ...[truncated 1981 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove:
    python
    http_config.ignore_ssl_verification = True
    
  2. Remove global suppression of InsecureRequestWarning.
  3. Use the platform CA trust store and preserve hostname verification.
  4. If an enterprise proxy or private CA is required, support an explicit CA bundle rather than disabling verification.
  5. Reject malformed or unauthenticated proxy configurations.
  6. Add tests confirming that invalid, expired, self-signed, and hostname-mismatched certificates are rejected.
  7. Rotate temporary credentials if they were used through an untrusted network while this configuration was active.

T08 · Insecure Dependencies

Error
Location
scripts/ensure_env.py:305
Finding

Dependency Installation Disables Package-Index TLS Authentication

Content
View full analysis

Vulnerability Details

File Location: scripts/ensure_env.py:305-370
Vulnerability Type: Unauthenticated third-party dependency installation
Risk Level: High

The environment setup probes multiple package mirrors and installs dependencies from the first reachable mirror. It passes the mirror hostname to pip using --trusted-host.

Relevant code:

python
def _find_fastest_mirror():
    """轻量探测可用镜像源,返回第一个可达的 URL"""
    mirrors = [
        "https://repo.huaweicloud.com/repository/pypi/simple",
        "https://pypi.tuna.tsinghua.edu.cn/simple",
        "https://mirrors.aliyun.com/pypi/simple",
    ]
    for url in mirrors:
        try:
            req = urllib.request.Request(url, method="HEAD")
            resp = urllib.request.urlopen(req, timeout=5)
            if resp.status == 200:
                print(f" 可用镜像:{url}")
                return url
        except Exception:
            continue
    print(" 无可用镜像源,将尝试官方源")
    return None
python
pip_cmd = [sys.executable, "-m", "pip", "install", "-r", req_file]

if UPGRADE:
    pip_cmd.append("--upgrade")

if mirror_url:
    host = mirror_url.split("//")[1].split("/")[0]
    rc, out, err = run_cmd(
        pip_cmd + ["-i", mirror_url, "--trusted-host", host,
                   "--timeout", pip_timeout, "--retries", "2"],
        timeout=120,
    )

requirements.txt:1-6 also permits any package release at or above version 3.1.0:

text
huaweicloudsdkcore>=3.1.0
huaweicloudsdkiam>=3.1.0
huaweicloudsdkevs>=3.1.0
huaweicloudsdksfsturbo>=3.1.0
huaweicloudsdkobs>=3.1.0
huaweicloudsdkcbr>=3.1.0

Technical Analysis

Pip's --trusted-host option treats the specified package host as trusted even when secure HTTPS authentication cannot be established. In this execution path, a network attacker can impersonate the selected mirror and provide substituted package archives.

The setup ...[truncated 1652 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove the --trusted-host argument and require valid HTTPS certificate and hostname verification.
  2. Do not globally replace Python's default HTTPS context with an unverified context.
  3. Use one explicitly configured and authenticated package index rather than automatically selecting among mirrors.
  4. Pin exact dependency versions.
  5. Generate and enforce cryptographic package hashes, for example through a lock file and pip's --require-hashes.
  6. Separate dependency installation from credential validation so cloud credentials do not need to be present while third-party packages are installed.
  7. Recreate the virtual environment from verified dependencies after applying the fix.
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 (61)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

Querying IAM for project resolution may be operationally useful, but it expands access beyond the declared storage-only scope and can expose identity/account metadata not implied by the skill description. Scope expansion matters because users may provide cloud credentials assuming only EVS/OBS/SFS/CBR reads, not broader IAM interactions.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

Querying IAM for project resolution may be operationally useful, but it expands access beyond the declared storage-only scope and can expose identity/account metadata not implied by the skill description. Scope expansion matters because users may provide cloud credentials assuming only EVS/OBS/SFS/CBR reads, not broader IAM interactions.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

Querying IAM for project resolution may be operationally useful, but it expands access beyond the declared storage-only scope and can expose identity/account metadata not implied by the skill description. Scope expansion matters because users may provide cloud credentials assuming only EVS/OBS/SFS/CBR reads, not broader IAM interactions.

Content

No source excerpt is available for this finding.

Hidden Instructions

High
Category
Prompt Injection
Confidence
60% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · scripts/check_env.ps1 (reported line 1)May include surrounding context.

text
<#
华为云资源查询 - 环境检查前置脚本 (Windows PowerShell)
#>

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/check_env.sh (reported line 39)May include surrounding context.

sh
echo ""
    echo "请先安装 Python 3.6+,根据当前系统参考:"
    echo "  macOS   : brew install python"
    echo "  Ubuntu  : sudo apt update && sudo apt install -y python3 python3-pip"
    echo "  CentOS  : sudo yum install -y python3"
    exit 1
fi

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/ensure_env.py (reported line 186)May include surrounding context.

python
echo ""
    echo "请先安装 Python 3.6+,根据当前系统参考:"
    echo "  macOS   : brew install python"
    echo "  Ubuntu  : sudo apt update && sudo apt install -y python3 python3-pip"
    echo "  CentOS  : sudo yum install -y python3"
    exit 1
fi

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

This helper script goes beyond a query-only storage skill by creating virtual environments, reinstalling itself, and later enabling package/system installation flows. In an agent-skill context, environment bootstrap logic that can alter the host and chain into package execution materially expands the attack surface and violates least privilege for a read-only cloud query capability.

Content

No source excerpt is available for this finding.

os.system() or os exec-family call

High
Category
Dangerous Code Execution
Confidence
85% confidence
Finding

os.system() and os exec-family calls run shell commands with the process's full privileges, enabling arbitrary command execution.

Content

Scanner excerpt · scripts/ensure_env.py (reported line 69)May include surrounding context.

python
# 用 venv Python 重新执行当前脚本
    print(f"  使用虚拟环境 Python: {venv_python}")
    os.execv(venv_python, [venv_python] + sys.argv)

def info(msg):
    print(f"  {msg}")

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill declares no explicit tool scope while instructing execution of local scripts, use of environment variables, and network-backed SDK/API activity. Without an allowlist such as permissions or allowed-tools, an agent may grant the skill broader shell, env, and network access than users expect, increasing the risk of unintended command execution and credential exposure paths.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The trigger list contains broad generic terms like bucket, backup, vault, and volume that can match ordinary conversation, causing accidental invocation of a skill that runs local scripts and performs network/cloud operations. Unintended activation increases the chance of surprise command execution, environment inspection, and use of sensitive credentials in contexts where the user did not intend to engage this capability.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill instructs automatic environment validation and dependency installation as a prerequisite, including local execution and likely package installation, without a prominent user-impact warning. Auto-running setup steps can modify the host, consume network access, and introduce supply-chain risk before the user understands that the skill is doing more than querying cloud resources.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill mandates subprocess execution as part of normal invocation, including running helper scripts and Python commands, but does not foreground the safety implications of local code execution. Any design that normalizes immediate command execution without an explicit warning and confirmation increases the likelihood of unsafe or unintended actions on the host system.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The command-line interface explicitly accepts --domain_name and --project_id, creating a discovery workflow for tenant/domain projects that is not justified by the stated storage-query purpose. In the context of a storage skill, this mismatch increases risk because it broadens the accessible cloud metadata surface to organizational information unrelated to storage assets.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The script performs tenant domain project enumeration by calling list_domain_projects using a user-supplied domain_name, which goes beyond the skill’s declared scope of querying storage resources like EVS/OBS/SFS/CBR objects. Even though it is read-only, this enables identity and account-structure discovery that can aid reconnaissance, tenant mapping, and follow-on abuse in a broader cloud environment.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

This script enumerates CBR projects via client.list_projects(request), which exposes account/project inventory beyond the manifest’s stated CBR scope of vaults, policies, backups, tasks, agents, and protectables. Even though it is read-only, undisclosed project enumeration expands the skill’s data access surface and can leak sensitive tenancy structure useful for reconnaissance or later targeting.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The script prints detailed endpoint and filesystem information including host name, host IP, OS details, and protected directory/exclusion paths directly to stdout without masking or access-layer warnings. In operational environments, stdout is commonly captured by agent logs, chat transcripts, CI systems, or shared terminals, so this can expose infrastructure inventory and backup scope data that materially aids reconnaissance or leaks sensitive path names.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script invokes client.show_domain(request) and prints tenant/domain identifiers and names, which expands the skill beyond the declared CBR read-only scope in the manifest. Even though this is not a write operation, tenant/domain metadata is sensitive cloud inventory information and creates an undeclared data-access path that could expose cross-project or account-structure details to users who only expected backup-related queries.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

This code prints detailed backup metadata fields such as servers, ports, volumes, and floating IPs directly to standard output. There is no confirmation prompt or disclosure in the script that the command will expose potentially sensitive environment and infrastructure information in the terminal or logs.

Content

No source excerpt is available for this finding.

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/check_env.sh (reported line 39)May include surrounding context.

sh
echo ""
    echo "请先安装 Python 3.6+,根据当前系统参考:"
    echo "  macOS   : brew install python"
    echo "  Ubuntu  : sudo apt update && sudo apt install -y python3 python3-pip"
    echo "  CentOS  : sudo yum install -y python3"
    exit 1
fi

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/check_env.sh (reported line 40)May include surrounding context.

sh
echo ""
    echo "请先安装 Python 3.6+,根据当前系统参考:"
    echo "  macOS   : brew install python"
    echo "  Ubuntu  : sudo apt update && sudo apt install -y python3 python3-pip"
    echo "  CentOS  : sudo yum install -y python3"
    exit 1
fi

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/ensure_env.py (reported line 186)May include surrounding context.

python
echo ""
    echo "请先安装 Python 3.6+,根据当前系统参考:"
    echo "  macOS   : brew install python"
    echo "  Ubuntu  : sudo apt update && sudo apt install -y python3 python3-pip"
    echo "  CentOS  : sudo yum install -y python3"
    exit 1
fi

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/ensure_env.py (reported line 187)May include surrounding context.

python
echo ""
    echo "请先安装 Python 3.6+,根据当前系统参考:"
    echo "  macOS   : brew install python"
    echo "  Ubuntu  : sudo apt update && sudo apt install -y python3 python3-pip"
    echo "  CentOS  : sudo yum install -y python3"
    exit 1
fi

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/ensure_env.py (reported line 188)May include surrounding context.

python
echo ""
    echo "请先安装 Python 3.6+,根据当前系统参考:"
    echo "  macOS   : brew install python"
    echo "  Ubuntu  : sudo apt update && sudo apt install -y python3 python3-pip"
    echo "  CentOS  : sudo yum install -y python3"
    exit 1
fi

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

At L20, the code sets the default region to "cn-north-4", which implicitly forces a China-specific locale/region when the user does not provide one. This is a natural-language policy concern because the file does not offer a user-facing opt-in or explain why this locale default is required.

Content

No source excerpt is available for this finding.

Unbounded Resource Access

Medium
Category
Excessive Agency
Confidence
76% confidence
Finding

The command runner defaults to timeout=None, allowing subprocesses to run indefinitely when callers omit a timeout. In an automation or agent environment, this can lead to hangs, resource exhaustion, and denial-of-service, especially because the script performs network/package-management operations.

Content

Scanner excerpt · scripts/ensure_env.py (reported line 129)May include surrounding context.

python
# ── 工具函数 ──────────────────────────────────────────────────────────

def run_cmd(cmd, timeout=None, **kwargs):
    """运行命令,返回 (returncode, stdout, stderr)

    Args: