Back to skill

Security audit

Aliyun Use

Security checks for vulnerabilities and agentic risk

Overview

This Aliyun LLM skill does what it advertises, but needs Review because it can send your API key and prompt text to any configured API host.

Review before installing. Use it only if you are comfortable sending selected prompts and translation text to Aliyun Bailian, keep ALIYUN_BAILIAN_API_HOST fixed to a trusted HTTPS Alibaba Cloud endpoint, avoid passing secrets or confidential code, and do not allow untrusted workflows to set --base-url or the API host environment variable.

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

Error
Location
scripts/__main__.py:23
Finding

Unrestricted API Endpoint Allows Credential and Prompt Exfiltration

Content
View full analysis

Vulnerability Details

File Location: scripts/__main__.py:23, 34-38, 70-104, 191-209, 262, 291
Vulnerability Type: Unvalidated destination for sensitive authenticated requests
Risk Level: High

The Skill allows its API destination to be controlled through the ALIYUN_BAILIAN_API_HOST environment variable, the CLI --base-url option, or the public Python base_url parameter. It then sends the Aliyun API key and complete user-supplied prompt or translation text to that destination without validating its scheme or hostname.

Vulnerable Code

python
DEFAULT_BASE_URL = os.environ.get("ALIYUN_BAILIAN_API_HOST", "https://coding.dashscope.aliyuncs.com/apps/anthropic")
python
def _get_credentials(api_key: Optional[str] = None, base_url: str = DEFAULT_BASE_URL):
    key = api_key or os.environ.get("ALIYUN_BAILIAN_API_KEY")
    if not key:
        return None, None
    return key, base_url

The chat path places the credential in two headers and sends all chat and system-message content to the selected host:

python
headers = {
    "Content-Type": "application/json",
    "Authorization": f"Bearer {key}",
    "x-api-key": key,
    "anthropic-version": "2023-06-01"
}

# Convert messages to Anthropic format
anthropic_messages = []
system_content = None
for msg in messages:
    if msg.get("role") == "system":
        system_content = msg.get("content", "")
    else:
        anthropic_messages.append({
            "role": msg.get("role"),
            "content": msg.get("content", "")
        })

payload = {
    "model": model,
    "messages": anthropic_messages,
    "temperature": temperature,
    "max_tokens": max_tokens
}
if system_content:
    payload["system"] = system_content
if stream:
    payload["stream"] = True

api_url = f"{url}/v1/messages"

try:
    if stream:
        response = requests.post(api_url, headers=headers, json=payload, 
...[truncated 3442 chars]
Remediation
View remediation

Remediation Suggestions

  1. Parse the destination with a standard URL parser and require the https scheme.
  2. Restrict destinations to an explicit allowlist of supported Alibaba Cloud hosts, such as the documented DashScope regional domains.
  3. Compare normalized hostnames exactly or by a carefully implemented subdomain rule; do not use substring or suffix checks that accept domains such as dashscope.aliyuncs.com.attacker.example.
  4. Reject embedded credentials, fragments, unexpected ports, malformed URLs, and IP-literal destinations unless explicitly required.
  5. Disable redirects for authenticated requests or validate every redirect destination before forwarding authentication headers.
  6. Remove unrestricted --base-url and public base_url overrides from normal operation. If custom endpoints are operationally necessary, require an explicit unsafe-development mode and never attach production credentials automatically.
  7. Send only the authentication header required by the official API rather than duplicating the credential in both Authorization and x-api-key.
  8. Document that prompts and translation text leave the local environment and identify the approved external provider destinations.
  9. Add tests confirming that HTTP URLs, arbitrary domains, deceptive domain suffixes, embedded user information, unexpected ports, and cross-domain redirects are rejected before request headers are constructed or transmitted.
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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (12)

Tainted flow: 'headers' from os.environ.get (line 191, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/__main__.py (reported line 104)May include surrounding context.

python
try:
        if stream:
            response = requests.post(api_url, headers=headers, json=payload, stream=True, timeout=60)
            if not response.ok:
                return {"success": False, "error": f"{response.status_code}: {response.text}"}
            result = {"choices": [], "model": model}

Tainted flow: 'headers' from os.environ.get (line 191, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/__main__.py (reported line 121)May include surrounding context.

python
print()
            return {"success": True, "result": result}
        else:
            response = requests.post(api_url, headers=headers, json=payload, timeout=60)
            if not response.ok:
                return {"success": False, "error": f"{response.status_code}: {response.text}"}
            data = response.json()

Tainted flow: 'headers' from os.environ.get (line 191, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/__main__.py (reported line 209)May include surrounding context.

python
print()
            return {"success": True, "result": result}
        else:
            response = requests.post(api_url, headers=headers, json=payload, timeout=60)
            if not response.ok:
                return {"success": False, "error": f"{response.status_code}: {response.text}"}
            data = response.json()

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill requires environment access for an API key and performs outbound network calls, but it does not declare an explicit tool scope such as permissions or allowed-tools. This weakens least-privilege enforcement and makes it easier for the skill to be invoked with broader capabilities than users or the platform may expect.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The 'use when' description is very broad and covers general code generation, text generation, and translation requests, which increases the chance the skill will be auto-selected for many unrelated prompts. Because the skill sends content to an external provider, overbroad routing can cause unintended data disclosure or unnecessary use of external services.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill documentation does not warn that user prompts and translation text are transmitted to an external cloud API. In this context, the omission is significant because the skill is designed specifically to forward arbitrary user-provided content to a third-party LLM service, creating privacy, confidentiality, and compliance risks if selected implicitly.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
80% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/__main__.py (reported line 104)May include surrounding context.

python
try:
        if stream:
            response = requests.post(api_url, headers=headers, json=payload, stream=True, timeout=60)
            if not response.ok:
                return {"success": False, "error": f"{response.status_code}: {response.text}"}
            result = {"choices": [], "model": model}

External Transmission

Medium
Category
Data Exfiltration
Confidence
80% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/__main__.py (reported line 121)May include surrounding context.

python
try:
        if stream:
            response = requests.post(api_url, headers=headers, json=payload, stream=True, timeout=60)
            if not response.ok:
                return {"success": False, "error": f"{response.status_code}: {response.text}"}
            result = {"choices": [], "model": model}

External Transmission

Medium
Category
Data Exfiltration
Confidence
80% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/__main__.py (reported line 209)May include surrounding context.

python
try:
        if stream:
            response = requests.post(api_url, headers=headers, json=payload, stream=True, timeout=60)
            if not response.ok:
                return {"success": False, "error": f"{response.status_code}: {response.text}"}
            result = {"choices": [], "model": model}

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

User-provided chat prompts are sent to a third-party cloud LLM, but the CLI offers no explicit runtime disclosure or confirmation before transmitting potentially sensitive content. In a skill context, users may pass proprietary code, secrets, or internal text to the tool assuming local processing, creating a real privacy and data-governance risk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The translation command transmits arbitrary user text to an external LLM API without an explicit warning at invocation time. Because translation inputs often include confidential business text, personal data, or unreleased content, lack of disclosure can lead to unintended external sharing.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

This is a markdown file, so SQP-2 applies to omissions in the skill description. The document explains how to authenticate to a remote API using an environment-stored key, but it does not include any warning that requests will send prompts and credentials-related authorization data to AliYun infrastructure.

Content

No source excerpt is available for this finding.