Back to skill

Security audit

Alibaba Cloud AI Content Aicontent

Security checks for vulnerabilities and agentic risk

Overview

This skill is a disclosed Alibaba Cloud AIContent helper, but users should treat its cloud credentials and local output script with normal care.

Install only if you intend to let an agent help with Alibaba Cloud AIContent work. Use least-privilege Alibaba Cloud credentials, review any proposed create/update/modify/set API call before execution, and avoid passing untrusted product-code, version, or output-dir values to the bundled metadata script.

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:33
Finding
Unvalidated API Identifiers Permit Output Path Traversal## Vulnerability Details **File Location**: `scripts/list_openapi_meta_apis.py:33-34, 62-69` **Vulnerability Type**: Path traversal and unintended file overwrite **Risk Level**: Medium ```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 command-line values `product-code` and `version` are incorporated directly into output filenames without validating or removing path separators, traversal components, or platform-specific path syntax. `pathlib.Path` joins these attacker-controlled values to `output_dir`, but it does not guarantee that the resulting paths remain inside that directory. An input containing components such as `../` can therefore cause the generated JSON and Markdown paths to resolve outside `output/alicloud-ai-content-aicontent/`. The writes use `Path.write_text()`, which overwrites an existing destination rather than requiring exclusive creation. Exploitation is constrained by several factors: the remote metadata request must first return a JSON response, the target parent directory must exist, generated filenames retain fixed suffixes, and the process can write only to locations allowed by its operating-system permissions. ### Attack Path 1. An attacker or untrusted caller invokes the script with a traversal-bearing `--product-code` or `--version` value. 2. The ...[truncated 1325 chars]
Remediation
## Remediation Suggestions 1. Validate `product-code` and `version` against a strict allowlist before constructing either the URL or output filenames. For example, permit only ASCII letters, digits, underscores, and hyphens. 2. Reject empty values, `.` and `..` components, path separators, encoded separators, control characters, and absolute-path syntax. 3. Resolve each destination and verify that it remains beneath the resolved output directory before writing. 4. If overwriting is unnecessary, create output files exclusively to prevent accidental replacement of existing artifacts. 5. Consider mapping user-visible identifiers to locally generated safe filenames rather than using raw command-line values. 6. Add tests covering `../`, absolute paths, nested separators, Windows path syntax, malformed identifiers, and symlinked output paths. Example hardening approach: ```python import re SAFE_IDENTIFIER = re.compile(r"^[A-Za-z0-9_-]+$") def validate_identifier(name: str, value: str) -> str: if not SAFE_IDENTIFIER.fullmatch(value): raise ValueError(f"Invalid {name}: only letters, digits, '_' and '-' are allowed") return value product_code = validate_identifier("product code", args.product_code) version = validate_identifier("version", args.version) output_root = pathlib.Path(args.output_dir).resolve() 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 destination.parent != output_root: raise ValueError("Output path escapes the configured output directory") ```
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 (8)

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
98% confidence
Finding
The skill claims it can manage AIContent resources and perform operational actions, but the described executable path only discovers OpenAPI metadata and writes local artifacts rather than interacting with the actual AiContent service. This mismatch is dangerous because users or orchestrators may trust it with cloud credentials and invoke it for production actions it cannot safely or correctly perform, increasing the chance of mis-execution, data exposure in local outputs, or unsafe follow-on automation decisions.

Lp3

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding
The skill declares operational behavior that uses environment credentials, filesystem writes, and network access, but it does not declare any explicit tool scope or permission boundaries. In an agent setting, this weakens least-privilege controls and makes unintended or unauthorized credential use, external requests, or artifact creation more likely.

Vague Triggers

Medium
Confidence
89% confidence
Finding
The invocation text says to use the skill whenever the user needs AI content generation or content workflow operations in Alibaba Cloud, which is broad enough to match many generic content-related requests. Over-broad routing can cause the agent to invoke a networked, credential-using cloud skill in contexts where it is unnecessary, exposing secrets or causing unintended external actions.

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.