Back to skill

Security audit

抖音评论分析

Security checks for vulnerabilities and agentic risk

Overview

This appears to be a real Douyin analysis helper, but it needs Review because it can send the API key and submitted content link to an arbitrary configured service endpoint.

Install only if you intend to use the AI Skills service for Douyin analysis. Keep AISKILLS_BASE_URL at the trusted default or a verified HTTPS host, protect the API key, and avoid submitting private or sensitive links unless you are comfortable with external processing.

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:27
Finding

Configurable Unvalidated API Endpoint Can Expose Credentials

Content
View full analysis

Vulnerability Details

File Location: scripts/run.py:27-42 and scripts/run.py:66-72
Vulnerability Type: Unvalidated destination URL and plaintext credential transmission
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 = None if payload is None else 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 application obtains its API destination directly from the AISKILLS_BASE_URL environment variable without validating its scheme, hostname, port, or other URL components. It then attaches the AISKILLS_API_KEY and AISKILLS_TENANT_ID values to every request made to that destination.

Consequently, a value such as http://attacker.example is accepted. Requests sent to such a destination include the API key over plaintext HTTP, allowing network interception. An attacker-controlled HTTPS destination would also receive the credentials because the code does not restrict the destination to the intended ai-skills.ai service.

TLS certificate verification is enabled when HTTPS is used, but this does not prevent disclosure to an a ...[truncated 1607 chars]

Remediation
View remediation

Remediation Suggestions

  1. Parse the base URL with urllib.parse.urlsplit() and reject malformed values.
  2. Require the https scheme and explicitly reject plaintext HTTP.
  3. Restrict the hostname to ai-skills.ai or a documented allowlist of trusted API hosts.
  4. Reject embedded credentials, fragments, unexpected ports, and ambiguous hostname representations.
  5. Build request URLs using validated URL components rather than direct string concatenation.
  6. Only attach X-API-Key and X-Tenant-Id after confirming that the final request destination is trusted.
  7. Revalidate the destination after redirects, or disable cross-origin redirects, to prevent credentials from being forwarded to an untrusted host.
  8. If custom endpoints are operationally required, require explicit administrative configuration and maintain a trusted-host allowlist rather than accepting arbitrary environment values.
  9. Add automated tests confirming that HTTP URLs, unknown domains, embedded credentials, and unapproved ports are rejected.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (7)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill declares required environment variables and is documented to call an external service, but it does not declare an explicit tool scope such as network and env access. This creates a permission-transparency gap: a host may grant broader capabilities than users or reviewers expect, increasing the risk of unintended secret exposure or unauthorized outbound requests.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill processes Douyin links and comment/content data through an external API, but the description does not warn users that their supplied content and derived analysis data will be transmitted off-platform. This undermines informed consent and can lead to unintended disclosure of potentially sensitive business, user, or reputational data.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill enables implicit invocation without any visible trigger constraints, which can cause it to activate in contexts the user did not clearly intend. Because this skill performs sentiment, profiling, and recommendation functions on Douyin content, unexpected invocation could lead to unnecessary processing of user-provided links and broader prompt-surface exposure to adversarial content.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The natural-language fields for title, description, and placeholder are all hardcoded in Chinese, which imposes a specific language on users. There is no indication that the skill is region-specific or that users can opt into another language, so this appears to violate the language/locale policy criterion.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

This manifest uses Chinese-only user-facing text for the question, skill name, tags, professions, industries, and form labels, but does not indicate that the skill is intentionally limited to Chinese-speaking users or the Douyin market. Under the policy, forcing a specific language without user opt-in or documented justification is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill description and operating instructions are presented in Chinese throughout, with no indication that users may choose another language or that the Chinese-only constraint is intentional and justified. Per the policy, forcing a specific language without opt-in can be a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

The visible skill name, description, and prompt are written only in Chinese, which may impose a specific language context without any opt-in or documented locale justification. This can conflict with language-choice expectations if the broader environment is multilingual or user language is unspecified.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.