Back to skill

Security audit

TikTok视频下载

Security checks for vulnerabilities and agentic risk

Overview

This TikTok downloader is purpose-aligned and disclosed, but users should understand that links and the API key are sent to RedFox and that URL validation is weaker than advertised.

Install only if you are comfortable sending TikTok URLs and your RedFox API key to redfox.hk. Prefer the REDFOX_API_KEY environment variable over saving the key on disk, rotate the key if exposed, and avoid submitting private or sensitive links until the hostname validation is tightened.

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/downloader.py:102
Finding

Improper TikTok Hostname Validation Allows Non-TikTok URLs

Content
View full analysis

Vulnerability Details

File Location: scripts/downloader.py, lines 102–108
Vulnerability Type: Improper hostname validation
Risk Level: Medium

Vulnerable Code

python
def is_tiktok_link(url):
    """Check if the URL is a TikTok video link (web link or short link).

    Supports:
      - https://www.tiktok.com/@user/video/xxxxx
      - https://vm.tiktok.com/xxxxx/
      - https://vt.tiktok.com/xxxxx/
    """
    try:
        parsed = urlparse(url)
        host = (parsed.hostname or "").lower()
        return host.endswith("tiktok.com")
    except Exception:
        return False

The accepted URL is subsequently transmitted to the external RedFox service at line 172:

python
resp = session.post(
    API_URL,
    json={"url": url, "source": "TikTok视频下载-GitHub"},
    timeout=30
)

Technical Analysis

The hostname allowlist uses host.endswith("tiktok.com") without enforcing a DNS-label boundary. Consequently, attacker-controlled domains such as eviltiktok.com and not-tiktok.com satisfy the check even though they are not TikTok domains.

The validation also does not enforce HTTPS, an expected TikTok video path, a permitted port, or the absence of embedded credentials. This is weaker than the documented behavior, which states that non-TikTok links are rejected.

The local script does not directly retrieve the user-supplied URL. Instead, it includes that URL in an authenticated request to RedFox. Therefore, this audit confirms a validation bypass and unintended URL disclosure to the external service, but it does not establish local server-side request forgery. Any downstream request behavior depends on RedFox's implementation.

Attack Path

  1. An attacker provides a crafted URL whose hostname merely ends with the string tiktok.com, such as https://eviltiktok.com/resource.
  2. urlparse() extracts eviltiktok.com as the hostname.
  3. host.endswith("tiktok.com") evaluates to True.
  4. The script treats the URL as an ...[truncated 830 chars]
Remediation
View remediation

Remediation Suggestions

Replace the raw suffix comparison with an exact hostname allowlist and require HTTPS:

python
ALLOWED_HOSTS = {
    "www.tiktok.com",
    "vm.tiktok.com",
    "vt.tiktok.com",
}

def is_tiktok_link(url):
    try:
        parsed = urlparse(url)
        host = (parsed.hostname or "").lower().rstrip(".")

        if parsed.scheme != "https":
            return False
        if host not in ALLOWED_HOSTS:
            return False
        if parsed.username is not None or parsed.password is not None:
            return False
        if parsed.port not in (None, 443):
            return False

        if host == "www.tiktok.com":
            return bool(re.fullmatch(r"/@[^/]+/video/\d+/?", parsed.path))
        return bool(re.fullmatch(r"/[A-Za-z0-9_-]+/?", parsed.path))
    except (ValueError, TypeError):
        return False

If all TikTok subdomains must be supported, enforce a DNS-label boundary:

python
host == "tiktok.com" or host.endswith(".tiktok.com")

Exact hostnames are preferable because the documented feature supports a limited set of hosts. In addition:

  1. Validate the expected path format for each approved hostname.
  2. Reject non-HTTPS schemes, embedded credentials, and unexpected ports.
  3. Normalize trailing dots before hostname comparison.
  4. Add regression tests covering:
    • Valid www.tiktok.com, vm.tiktok.com, and vt.tiktok.com URLs.
    • eviltiktok.com, not-tiktok.com, and tiktok.com.attacker.example.
    • HTTP URLs, malformed URLs, embedded credentials, and unexpected ports.
  5. Ensure that RedFox independently validates the supplied URL against the same strict allowlist before performing any server-side retrieval.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Output HandlingUnvalidated Output Injection, Cross-Context Output, Unbounded Output
  • 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
Findings (15)

Unbounded Output

Medium
Category
Output Handling
Confidence
60% confidence
Finding

Output size or generation rate is not bounded. Unbounded output enables denial-of-service through resource exhaustion, log flooding, or context-window stuffing.

Content

Scanner excerpt · README.en.md (reported line 33)May include surrounding context.

md
- **Video Parsing**: paste a TikTok video link to parse out the watermark-free video download URL.
- **Batch Parsing**: paste multiple TikTok video links at once (space-separated), parse them one by one and get a summary of successes and failures at the end.
- **Link Validation**: automatically detects whether the input link is a TikTok video link; non-TikTok links are flagged and the process terminates, requiring you to re-enter a valid link.
- **Complete Information**: displays resource type, duration, download link, cover image, audio link, and full description line by line without truncation.
- **Dual Link Support**: recognizes both www.tiktok.com web links and vm.tiktok.com short links.
- **Link Expiry Reminder**: the download link returned after parsing is valid for approximately 5 minutes; users are reminded to copy and use it immediately.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The README explains API key setup but does not warn users that submitted TikTok links and related metadata such as descriptions, cover URLs, and audio links are sent to an external service for parsing. This omission can mislead users about privacy boundaries and cause unintentional disclosure of browsing, research, or collection activity to a third party.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The README instructs users to invoke the skill with broad natural-language requests and states that parsing runs immediately once a valid TikTok link is present. This can cause accidental invocation from ordinary conversation or copied text containing links, leading to unintended outbound requests and processing without clear user intent.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The example phrase at this location overlaps with common everyday speech, so a user could trigger the skill while casually asking for help rather than intentionally authorizing a third-party parse request. In an agent environment, ambiguous triggers increase the chance of unintended network actions and data sharing.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill instructs users to obtain and use a third-party API key from redfox.hk, but it does not warn that TikTok URLs, and potentially associated metadata such as account handles, video identifiers, timestamps, and request metadata, will be transmitted to that external service. This creates a privacy and data-governance risk because users may unknowingly disclose browsing interests or sensitive research targets to a third party.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The usage guidance says users should interact in natural language, but the entire skill description and example utterances are presented only in Chinese, implying a fixed language expectation without any mention of alternatives. This can violate language/locale policy when no user opt-in or language choice is offered.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill routes user-supplied TikTok URLs to redfox.hk for parsing, but the user-facing description does not clearly warn that submitted links are shared with a third party. This creates a privacy and consent issue because URLs can reveal viewing interests, creator targets, campaign research, or other sensitive behavioral information.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The invocation guidance uses broad natural-language triggers like '保存这个 TikTok 视频' and '下载这条 TikTok 视频', which can match ordinary conversation and cause the skill to activate unexpectedly. In context, unexpected activation is more dangerous because it can silently exfiltrate TikTok links to a third-party service and initiate actions the user may not have intended.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The workflow tells the agent to immediately process user-supplied TikTok URLs, and the document explicitly states those URLs are sent to a third-party API endpoint along with source metadata. Without a user-facing notice or consent step, users may unknowingly transmit private or sensitive links to an external service, creating a privacy and data-handling risk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill recommends storing the API key in a local configuration file under the user's home directory but does not warn that this persists a sensitive credential on disk. If file permissions are weak, backups are exposed, or the host is shared, the credential could be recovered and abused for unauthorized API use.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The script persists the API key to a local file under the user's home directory, which increases the chance of long-term credential exposure through backups, workstation compromise, shared accounts, or accidental disclosure. Although it sets file mode 0600, the user is not clearly warned at the point of use that the secret will be stored on disk and remain available for future runs.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The tool sends both the user-supplied TikTok URL and the API key to a third-party service (redfox.hk), but does not provide a clear privacy or data-sharing notice before transmission. In a downloader skill, this matters because users may assume local processing, while URLs can reveal viewing interests or unpublished content and the API key is a sensitive credential sent off-device.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
79% confidence
Finding

Natural-language policy violations include forcing a specific language without user opt-in. This file presents all operational instructions in Chinese only, with no indication that users may choose another language or that the skill is intentionally region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file's user-facing description and many runtime messages are written in Chinese, which effectively imposes a specific language on users. There is no indication of language selection, opt-in, or documentation that this tool is intentionally limited to a Chinese-speaking audience.

Content

No source excerpt is available for this finding.