Back to skill

Security audit

huawei-cloud-codearts-list

Security checks for vulnerabilities and agentic risk

Overview

This skill coherently lists Huawei Cloud resources, with credential and command-configuration caveats.

Use a read-only Huawei identity and select the intended region/project. Leave the command-override variables unset unless you trust their configuration; the list guard is not a sandbox for replacement programs. The SDK fallback reads cloud keys into memory despite conflicting wording. Verify installer downloads using Huawei's published checksums. All eight artifact files were reviewed and 78 mocked tests passed; live cloud behavior and downloaded dependencies remain unverified.

Vulnerability Patterns
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Output HandlingUnvalidated Output Injection, Cross-Context Output, Unbounded Output
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (14)

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
70% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · scripts/list_codearts.py (reported line 605)May include surrounding context.

python
def _env_credential(markers):
    for key, value in os.environ.items():
        upper = key.upper()
        if not upper.startswith(("HUAWEI", "HW_", "HWC")):
            continue

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
70% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · tests/test_list_codearts.py (reported line 428)May include surrounding context.

python
list_resource_via_sdk(resource, "cn-north-4", project_id="p-1")

    def test_sdk_missing_credentials_surfaces_aksk_hint(self):
        clean_env = {k: v for k, v in os.environ.items()
                     if not k.upper().startswith(("HUAWEI", "HW_", "HWC"))}
        with mock.patch.dict(os.environ, clean_env, clear=True), \
                mock.patch("list_codearts.subprocess.run",

Skill declares no tool scope ('permissions' or 'allowed-tools') but code capabilities were detected: env, shell.

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
85% confidence
Finding

Although subprocess.run uses an argument list without a shell, its executable and prefixed arguments can be replaced through CODEARTS_LIST_HCLOUD_BIN and CODEARTS_LIST_HCLOUD_ARGS. If an untrusted caller or launcher can influence those variables, it can execute a different program with the agent's privileges and inherited cloud credentials, bypassing the list-operation guard.

Content

Scanner excerpt · scripts/list_codearts.py (reported line 394)May include surrounding context.

python
cmd.extend(extra)
    cmd.extend(argv)
    try:
        proc = subprocess.run(
            cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
            timeout=120, universal_newlines=True,
        )

Tainted flow: 'cmd' from os.environ.get (line 388, credential/environment) → subprocess.run (code execution)

Medium
Category
Data Flow
Confidence
85% confidence
Finding

The environment-to-process flow permits unrestricted executable replacement and argument prefixing, rather than merely supplying read-only API parameters. Exploitation requires influence over the inherited environment, but under that condition the replacement process receives the agent's execution privileges and credentials; shell=False does not prevent this form of executable substitution.

Content

Scanner excerpt · scripts/list_codearts.py (reported line 394)May include surrounding context.

python
cmd.extend(extra)
    cmd.extend(argv)
    try:
        proc = subprocess.run(
            cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
            timeout=120, universal_newlines=True,
        )

Acceptance criteria require Chinese output labels and diagnostic messages without offering a language choice.

Low
Category
Output Handling
Confidence
92% confidence
Finding

The criteria specify Chinese table labels and require the Chinese messages 「无 CodeArts 资源」 and 「请检查 IAM 权限」 for empty results and permission errors. No user language opt-in or justification for restricting these outputs to Chinese is documented.

Content

No source excerpt is available for this finding.

The module claims the script never reads secrets itself, but the SDK fallback explicitly reads AK/SK credentials from the environment.

Low
Category
Excessive Agency
Confidence
99% confidence
Finding

The module documentation at L015–L016 states that the script never reads secrets itself. However, _env_credential reads environment values at L604–L610, and L653–L654 invokes it to retrieve the access key and secret key directly into the script. This credential handling is appropriate for the declared SDK fallback, but contradicts the documented secret-handling guarantee.

Content

No source excerpt is available for this finding.

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · scripts/list_codearts.py (reported line 648)May include surrounding context.

python
% (spec["modules"][0].split(".")[0], exc)
        )

    client_cls = getattr(root_mod, spec["client"])
    region_cls = getattr(region_mod, spec["region"])
    request_cls = getattr(root_mod, spec["request"])
    query_cls = getattr(root_mod, spec["query"]) if spec.get("query") else None

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · scripts/list_codearts.py (reported line 649)May include surrounding context.

python
)

    client_cls = getattr(root_mod, spec["client"])
    region_cls = getattr(region_mod, spec["region"])
    request_cls = getattr(root_mod, spec["request"])
    query_cls = getattr(root_mod, spec["query"]) if spec.get("query") else None

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · scripts/list_codearts.py (reported line 650)May include surrounding context.

python
client_cls = getattr(root_mod, spec["client"])
    region_cls = getattr(region_mod, spec["region"])
    request_cls = getattr(root_mod, spec["request"])
    query_cls = getattr(root_mod, spec["query"]) if spec.get("query") else None

    ak = _env_credential(("ACCESS_KEY", "_AK"))

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · scripts/list_codearts.py (reported line 651)May include surrounding context.

python
client_cls = getattr(root_mod, spec["client"])
    region_cls = getattr(region_mod, spec["region"])
    request_cls = getattr(root_mod, spec["request"])
    query_cls = getattr(root_mod, spec["query"]) if spec.get("query") else None

    ak = _env_credential(("ACCESS_KEY", "_AK"))
    sk = _env_credential(("SECRET_KEY", "_SK"))

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · scripts/list_codearts.py (reported line 679)May include surrounding context.

python
"安装与区域配置。" % (resource, region, exc)
        )

    call = getattr(client, _sdk_method(resource))
    items = []
    offset = 0
    for _ in range(max_pages):

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · scripts/list_codearts.py (reported line 695)May include surrounding context.

python
% str(exc)[:300]
                )
            raise ApiError("SDK 调用失败:%s" % str(exc)[:300])
        batch = list(getattr(response, spec["list_attr"], None) or [])
        items.extend(_sdk_item_to_dict(item) for item in batch)
        total = getattr(response, spec["total_attr"], None) \
            if spec["total_attr"] else None

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · scripts/list_codearts.py (reported line 697)May include surrounding context.

python
raise ApiError("SDK 调用失败:%s" % str(exc)[:300])
        batch = list(getattr(response, spec["list_attr"], None) or [])
        items.extend(_sdk_item_to_dict(item) for item in batch)
        total = getattr(response, spec["total_attr"], None) \
            if spec["total_attr"] else None
        if total is not None and len(items) >= total:
            break