Back to skill

Security audit

Alibaba Cloud Backup BDRC

Security checks for vulnerabilities and agentic risk

Overview

This skill is a disclosed Alibaba Cloud BDRC management helper, but users should handle cloud credentials and mutating operations carefully.

Install only with least-privilege Alibaba Cloud credentials. Review planned BDRC mutations before execution, avoid saving secrets in logs or evidence files, and use safe product/version values or the defaults for the metadata script until filename 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:28
Finding
Path Traversal Through Unvalidated Output Filename Components<![CDATA[ ## Vulnerability Details **File Location**: `scripts/list_openapi_meta_apis.py:28-30, 42-59` **Vulnerability Type**: Path traversal and unintended file overwrite **Risk Level**: Medium ### Vulnerable Code ```python parser = argparse.ArgumentParser() parser.add_argument("--product-code", default=DEFAULT_PRODUCT_CODE) parser.add_argument("--version", default=DEFAULT_VERSION) parser.add_argument("--output-dir", default=str(OUTPUT_DIR)) args = parser.parse_args() timeout = int(os.getenv("OPENAPI_META_TIMEOUT", "20")) output_dir = pathlib.Path(args.output_dir) 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) raw_apis = payload.get("apis", {}) if isinstance(raw_apis, dict): api_names = sorted(raw_apis.keys()) elif isinstance(raw_apis, list): names = [] for item in raw_apis: if isinstance(item, dict): name = item.get("name") or item.get("apiName") if name: names.append(name) elif isinstance(item, str): names.append(item) api_names = sorted(set(names)) else: api_names = [] 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)}", "", ] ``` ### Technical Analysis The command-line values `args.product_code` and `args.version` are inserted directly into local filenames. Neither value is validated to ensure that it is a single safe filename component. If either value contains path separators and traversal components such as `../`, the `/` operator used by `pathlib.Path` resolves those components as ...[truncated 2157 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Validate each argument before using it in either a URL or filename: - Restrict product codes to a conservative allowlist pattern such as `[A-Za-z0-9_-]+`. - Restrict versions to the expected format, such as `YYYY-MM-DD`. - Reject values containing `/`, `\`, `..`, null bytes, or platform-specific path separators. 2. URL-encode validated product and version values as individual URL path segments rather than interpolating raw input. 3. Construct and resolve each destination path, then enforce output-directory containment before writing: ```python import re from urllib.parse import quote PRODUCT_RE = re.compile(r"^[A-Za-z0-9_-]+$") VERSION_RE = re.compile(r"^\d{4}-\d{2}-\d{2}$") if not PRODUCT_RE.fullmatch(args.product_code): parser.error("Invalid product code") if not VERSION_RE.fullmatch(args.version): parser.error("Invalid version") output_dir = pathlib.Path(args.output_dir).resolve() output_dir.mkdir(parents=True, exist_ok=True) product_segment = quote(args.product_code, safe="") version_segment = quote(args.version, safe="") url = ( f"https://api.aliyun.com/meta/v1/products/{product_segment}" f"/versions/{version_segment}/api-docs.json" ) json_file = (output_dir / f"{args.product_code}_{args.version}_api_docs.json").resolve() md_file = (output_dir / f"{args.product_code}_{args.version}_api_list.md").resolve() for destination in (json_file, md_file): if output_dir not in destination.parents: raise ValueError("Output path escapes the configured output directory") ``` 4. If arbitrary product or version text must be supported, derive filenames from a safe encoding or stable hash instead of embedding raw values. 5. Where overwriting is unnecessary, use exclusive file creation or explicitly require confirmation before replacing an existing artifact. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
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 is presented as a manager for Backup and Disaster Recovery Center operations, but the documented quickstart and behavior focus on OpenAPI metadata discovery and writing local artifacts rather than direct BDRC resource management. This mismatch can mislead operators and policy systems about what the skill actually does, which is dangerous because hidden or undocumented behavior can bypass expected review boundaries and lead to unanticipated network access or data collection.

Lp3

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding
The skill advertises executable workflows that rely on environment access, filesystem writes, and network/API calls, but it does not declare any explicit tool scope such as permissions or allowed-tools. This increases the risk of overbroad execution because an agent may invoke capabilities beyond what a reviewer or user expects, especially when cloud credentials and remote API access are involved.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The skill instructs the agent to source Alibaba Cloud credentials from environment variables and shared credential files, but it does not include a clear warning against exposing, logging, copying, or persisting those secrets. In a skill that performs networked cloud operations and writes artifacts to disk, missing secret-handling guidance raises the chance of accidental credential disclosure through logs, evidence files, or debugging output.

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.