Back to skill

Security audit

Alibaba Cloud AI PAI Aiworkspace

Security checks for vulnerabilities and agentic risk

Overview

The skill appears purpose-built for Alibaba Cloud AIWorkspace administration, but it asks agents to use cloud credentials and mutating APIs without a clear confirmation or permission boundary.

Review before installing. Use only least-privilege Alibaba Cloud credentials, require the agent to show the exact region, resource IDs, and API action before any Create/Update/Modify/Set call, and avoid passing untrusted product-code, version, or output-dir values to the helper script until path validation is added.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/list_openapi_meta_apis.py:32
Finding
Path Traversal Through Unsanitized Output Filenames<![CDATA[ ## Vulnerability Details **File Location**: `scripts/list_openapi_meta_apis.py`, lines 32–33 and 57–69 **Vulnerability Type**: Path traversal and arbitrary file placement **Risk Level**: Medium ### Vulnerable Code ```python parser.add_argument("--product-code", default=DEFAULT_PRODUCT_CODE) parser.add_argument("--version", default=DEFAULT_VERSION) ``` ```python json_file = output_dir / f"{args.product_code}_{args.version}_api_docs.json" md_file = output_dir / f"{args.product_code}_{args.version}_api_list.md" json_file.write_text( json.dumps(payload, ensure_ascii=False, indent=2), encoding="utf-8", ) md_lines = [ f"# {args.product_code} {args.version} API List", "", f"- Source: {url}", f"- API count: {len(api_names)}", "", ] md_lines.extend([f"- `{name}`" for name in api_names]) md_file.write_text("\n".join(md_lines) + "\n", encoding="utf-8") ``` ### Technical Analysis The `--product-code` and `--version` arguments are controlled by the script caller. Their raw values are interpolated into output filenames without character validation, filename sanitization, or verification that the resolved destination remains beneath the configured output directory. Values containing path separators or `..` components can therefore influence path resolution. The `pathlib.Path` `/` operator does not automatically prevent traversal outside a base directory. If the metadata request succeeds and the resulting destination's parent directory exists, `write_text()` may create or overwrite a file outside `output/alicloud-ai-pai-aiworkspace/`. The fixed `_api_docs.json` and `_api_list.md` suffixes constrain the names of reachable files, but they do not enforce containment within the intended output directory. ### Attack Path 1. An attacker, untrusted automation workflow, or manipulated invocation supplies a traversal-bearing value through `--product-code` or `--version`. 2. The supplied value is included in the request path sent to the fi ...[truncated 1497 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Validate both identifiers against a strict allowlist appropriate for Alibaba Cloud product codes and API versions: ```python import re SAFE_IDENTIFIER = re.compile(r"^[A-Za-z0-9._-]+$") def validate_identifier(value: str, name: str) -> str: if not SAFE_IDENTIFIER.fullmatch(value): raise ValueError(f"Invalid {name}: only letters, digits, '.', '_', and '-' are allowed") return value ``` 2. Validate the arguments before using them in either URLs or filenames: ```python product_code = validate_identifier(args.product_code, "product code") version = validate_identifier(args.version, "version") ``` 3. Resolve each output destination and enforce containment beneath the resolved output directory: ```python output_root = pathlib.Path(args.output_dir).resolve() output_root.mkdir(parents=True, exist_ok=True) json_file = ( output_root / f"{product_code}_{version}_api_docs.json" ).resolve() md_file = ( output_root / f"{product_code}_{version}_api_list.md" ).resolve() for destination in (json_file, md_file): if output_root not in destination.parents: raise ValueError("Output path escapes the configured output directory") ``` 4. Consider rejecting path separators explicitly even when additional validation is present. 5. Add regression tests covering `../`, absolute paths, platform-specific separators, encoded separators, empty values, and unexpectedly long identifiers. 6. Run the Skill under an account with minimal filesystem permissions so that a validation failure cannot become a broader workspace overwrite. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (9)

Tainted flow: 'timeout' from os.getenv (line 34, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Content
def fetch_json(url: str, timeout: int) -> dict:
    req = urllib.request.Request(url, headers={"User-Agent": "codex-skill"})
    with urllib.request.urlopen(req, timeout=timeout) as resp:
        return json.loads(resp.read().decode("utf-8"))
Confidence
90% confidence
Finding
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The skill is presented as a manager for AIWorkspace resources, but the documented executable path centers on metadata discovery, artifact generation, and API inventory collection rather than the claimed operational workflows. This mismatch is dangerous because users and orchestrators may grant it trust or invoke it for cloud administration while it performs different network and filesystem actions than expected, weakening oversight and increasing the chance of unsafe execution.

Lp3

Medium
Category
MCP Least Privilege
Confidence
83% confidence
Finding
The skill advertises executable behavior that can access environment credentials, write files, and make network requests, but it does not declare any explicit tool scope or permission boundaries. In a cloud-management context this is risky because the skill handles sensitive Alibaba Cloud credentials and can perform externally visible actions without a clear least-privilege contract.

Vague Triggers

Medium
Confidence
92% confidence
Finding
The invocation text is broad enough to match many generic AIWorkspace-related requests, including troubleshooting, lifecycle automation, and permission issues, without clear constraints on when it should or should not run. In a cloud skill, overly broad routing increases the chance of accidental activation in sensitive contexts, potentially exposing credentials, triggering network calls, or setting up follow-on mutations under vague user intent.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The instructions include create, update, modify, and set-style API usage for cloud resources but do not require an explicit warning or confirmation before mutating operations. In the context of Alibaba Cloud administration, this makes accidental or misunderstood destructive changes materially more dangerous because users may not realize the skill can alter production workspace configuration or permissions.

External Transmission

Medium
Category
Data Exfiltration
Content
output_dir.mkdir(parents=True, exist_ok=True)

    url = (
        f"https://api.aliyun.com/meta/v1/products/{args.product_code}"
        f"/versions/{args.version}/api-docs.json"
    )
    payload = fetch_json(url, timeout)
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
output_dir.mkdir(parents=True, exist_ok=True)

    url = (
        f"https://api.aliyun.com/meta/v1/products/{args.product_code}"
        f"/versions/{args.version}/api-docs.json"
    )
    payload = fetch_json(url, timeout)
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
output_dir.mkdir(parents=True, exist_ok=True)

    url = (
        f"https://api.aliyun.com/meta/v1/products/{args.product_code}"
        f"/versions/{args.version}/api-docs.json"
    )
    payload = fetch_json(url, timeout)
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
output_dir.mkdir(parents=True, exist_ok=True)

    url = (
        f"https://api.aliyun.com/meta/v1/products/{args.product_code}"
        f"/versions/{args.version}/api-docs.json"
    )
    payload = fetch_json(url, timeout)
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Static analysis

No suspicious patterns detected.