Back to skill

Security audit

Alibaba Cloud Security Id Verification Cloudauth

Security checks for vulnerabilities and agentic risk

Overview

This skill is a disclosed Alibaba Cloud Cloudauth helper with expected credential, API, network, and local artifact behavior, though users should handle saved identity-related evidence carefully.

Install only for Alibaba Cloud Cloudauth work, use least-privilege credentials, confirm any Create/Update/Modify/Set actions before running them, and avoid saving raw identity-verification records or secrets in output files. If using the helper script, keep outputs under the documented skill output directory unless you intentionally choose another trusted path.

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:30
Finding
Unrestricted Output Path Allows Writes Outside the Designated Skill Directory## Vulnerability Details **File Location**: `scripts/list_openapi_meta_apis.py`, lines 30-73 **Vulnerability Type**: Unrestricted file output path and insufficient path validation **Risk Level**: Medium **Vulnerable Code**: ```python 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)}", "", ] 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 script accepts `--output-dir`, `--product-code`, and `--version` without validating or constraining them. The output directory is u ...[truncated 3006 chars]
Remediation
## Remediation Suggestions 1. Resolve all output paths against an approved output root: ```python APPROVED_ROOT = pathlib.Path( "output/alicloud-security-id-verification-cloudauth" ).resolve() output_dir = pathlib.Path(args.output_dir).resolve() if output_dir != APPROVED_ROOT and APPROVED_ROOT not in output_dir.parents: raise ValueError("Output directory must remain under the approved output root") ``` 2. If custom output locations are unnecessary, remove `--output-dir` and always use the documented output directory. 3. Validate product and version arguments using strict allowlists. For example, permit only letters, digits, periods, underscores, and hyphens: ```python import re SAFE_IDENTIFIER = re.compile(r"^[A-Za-z0-9._-]+$") for label, value in ( ("product-code", args.product_code), ("version", args.version), ): if not SAFE_IDENTIFIER.fullmatch(value): raise ValueError(f"Invalid {label}") if value in {".", ".."}: raise ValueError(f"Invalid {label}") ``` 4. Resolve each final destination and verify that it remains beneath the approved root before writing. 5. Consider refusing to overwrite existing files or requiring an explicit `--force` option. 6. If external output directories are a required feature, require explicit trusted-user authorization and clearly document that the option can write outside the skill 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 (10)

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 declared purpose says the skill manages Cloudauth operations, configuration updates, and status checks, but the documented behavior centers on metadata discovery and local artifact generation instead of clearly bounded operational workflows. This mismatch can mislead users or orchestration systems about what the skill actually does, causing unintended execution paths, unnecessary credential use, or collection of data not expected from the description.

Lp3

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding
The skill invokes capabilities that can access environment credentials, write files, and perform network operations, but it does not declare any explicit tool scope or permission boundaries. In a credentialed cloud-management context, this increases the chance of overbroad execution, accidental secret exposure, and misuse of networked actions without clear operator awareness or policy enforcement.

Vague Triggers

Medium
Confidence
89% confidence
Finding
The activation text is broad enough to match many generic Cloudauth-related requests without clearly defining when the skill should or should not be used. In a cloud credential context, overbroad invocation increases the chance that the skill runs in situations where a narrower, safer workflow would be more appropriate, leading to unnecessary access to credentials, files, or network resources.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The skill instructs saving API responses and generated artifacts to disk without warning that Cloudauth outputs may contain sensitive identity-verification, account, or operational data. Persisting such responses locally can create a secondary data-exposure surface through logs, artifacts, backups, or shared workspaces, especially because identity-related APIs often return regulated or highly sensitive information.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The evidence-collection instructions tell users to save API response summaries and key parameters for reproducibility, but they do not warn against including sensitive identifiers, account details, or identity-verification records. In this context, even summaries and parameter sets can expose account IDs, resource identifiers, regions, time ranges, or personal verification references that facilitate data leakage or operational reconnaissance.

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.