Back to skill

Security audit

抖音流量分配大盘

Security checks for vulnerabilities and agentic risk

Overview

This appears to be a coherent Douyin traffic analytics skill that calls a disclosed external API, with some configuration and language-use cautions.

Install this only if you intend to use the AI Skills API for Douyin traffic analysis. Provide AISKILLS_API_KEY carefully, leave AISKILLS_BASE_URL at the default unless you control the endpoint, and do not use plaintext or untrusted API URLs. Expect a Chinese-language experience.

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/run.py:26
Finding

Authentication Credentials Can Be Sent to an Arbitrary API Endpoint

Content
View full analysis

Vulnerability Details

File Location: scripts/run.py:26-39 and scripts/run.py:75-81
Vulnerability Type: Unvalidated destination for authenticated outbound requests
Risk Level: Medium

Vulnerable Code

python
def build_base_url():
    return os.getenv("AISKILLS_BASE_URL", DEFAULT_BASE_URL).rstrip("/")

def build_headers():
    api_key = os.getenv("AISKILLS_API_KEY", "").strip()
    tenant_id = os.getenv("AISKILLS_TENANT_ID", "default").strip() or "default"
    if not api_key:
        fail("AISKILLS_API_KEY is required")
    return {
        "Content-Type": "application/json",
        # Cloudflare blocks urllib's default Python user agent for this endpoint.
        "User-Agent": "ai-skills-runner/1.0 (+https://ai-skills.ai)",
        "Accept": "application/json",
        "X-API-Key": api_key,
        "X-Tenant-Id": tenant_id,
    }
python
def request_json(method, path, payload):
    body = json.dumps(payload).encode("utf-8")
    req = urllib.request.Request(
        f"{build_base_url()}{path}",
        data=body,
        method=method,
        headers=build_headers(),
    )

Technical Analysis

The request destination is derived directly from the AISKILLS_BASE_URL environment variable without validating its scheme, hostname, port, or trust relationship. The same request is automatically populated with the X-API-Key and X-Tenant-Id authentication headers.

Consequently, a deployment mistake or an attacker capable of influencing the process environment can redirect authenticated requests to an arbitrary server. The implementation also accepts an http:// URL, allowing the credentials and request data to be transmitted without transport encryption.

TLS certificate verification is enabled for HTTPS requests, but it does not address this issue because an attacker-controlled HTTPS server can possess a valid certificate for its own hostname.

Attac

...[truncated 1654 chars]

Remediation
View remediation

Remediation Suggestions

  1. Require the base URL to use HTTPS and reject all other schemes.
  2. Parse the URL with urllib.parse.urlsplit() and reject embedded credentials, fragments, unexpected ports, malformed hostnames, and ambiguous URL forms.
  3. Maintain an explicit allowlist of trusted API hostnames, preferably allowing only ai-skills.ai in production.
  4. Validate the final request destination before adding X-API-Key or X-Tenant-Id.
  5. Do not forward authentication headers across redirects to a different origin. Consider disabling redirects or implementing a redirect handler that enforces same-origin redirects.
  6. If custom endpoints are a legitimate requirement, require an explicit opt-in setting and use separately scoped credentials that cannot authenticate to the production service.
  7. Document that AISKILLS_BASE_URL is security-sensitive and must not be populated from untrusted user input.
  8. Add tests confirming rejection of plaintext HTTP, unapproved hosts, embedded credentials, unexpected ports, and cross-origin redirects.
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (7)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill requires environment-based credentials and explicitly calls a remote API, but it does not declare any tool scope or allowed-tools boundary. This creates an authorization and review gap: hosts or users cannot easily tell that the skill needs env and network access, increasing the chance of over-permissioned execution or unintended secret exposure to external services.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
83% confidence
Finding

The natural-language content in the description and usage guidance is exclusively Chinese, and the file does not indicate that the skill is region-specific or provide an opt-in or alternative language. This can violate language/locale policy when users are not explicitly given a choice.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The manifest enables implicit invocation with no visible trigger constraints, allowing the platform to auto-select this skill in broader contexts than the user may expect. That increases the chance of unrequested execution, unintended data exposure to the skill context, and prompt-scope expansion, especially because the skill influences analytical outputs about traffic allocation and strategy.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill description says it helps users understand where Douyin traffic is flowing and generate traffic distribution and category hierarchy signals. However, the concrete API endpoint is fetch_hot_rise_list, which semantically points to retrieving a rising-hot-list/billboard feed rather than a traffic-distribution dashboard; this suggests the implemented behavior may surface trending items instead of the promised traffic allocation analysis.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This code returns a billing error message in Chinese regardless of the user's preferred language or locale. That is a natural-language policy issue because the skill imposes a specific language in a general-purpose code path without offering choice or documenting a justified locale restriction.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

The user-facing display name, description, and prompt context are entirely in Chinese, which implies a fixed language/locale experience. There is no indication that users can opt into this language or that the skill is restricted to a Chinese-speaking context.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The manifest uses Chinese-only natural-language fields for the user-facing question and skill name. Per the policy, forcing a specific language without user opt-in can be a locale-policy violation when no alternative language choice or region-specific justification is documented in the file.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.