Back to skill

Security audit

tiktok-downloader

Security checks for vulnerabilities and agentic risk

Overview

This TikTok downloader is mostly purpose-aligned, but it automatically uses a persistent browser profile's cookies without tight URL scoping or explicit opt-in.

Review before installing. Use this only with a dedicated TikTok-only browser profile or cookie file, and avoid pointing it at a general browser profile with personal logins. Confirm URLs are TikTok URLs before running, and treat downloads made with cookies as actions that may use your logged-in session.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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)

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/download_tiktok.sh:20
Finding
Persistent Browser Profile Exposed to Cookie-Assisted Downloader<![CDATA[ ## Vulnerability Details **File Location**: `scripts/download_tiktok.sh`, lines 8 and 20-21; supporting instructions in `SKILL.md`, lines 19-21 and 29 **Vulnerability Type**: Excessive access to persistent browser session data **Risk Level**: Medium ### Vulnerable Code ```bash COOKIES_DIR="/home/ubuntu/.browser_data_dir" ``` ```bash # Try with cookies and custom user-agent yt-dlp --no-warnings \ --cookies-from-browser "chromium:$COOKIES_DIR" \ --user-agent "$USER_AGENT" \ --add-header "Referer:https://www.tiktok.com/" \ -o "$OUTPUT_DIR/%(uploader)s - %(title).80s.%(ext)s" \ "$URL" ``` The associated instructions explicitly recommend populating and reusing this browser profile: ```markdown 1. **Navigate to the URL** using the browser tool to establish a session and cookies. 2. **Run the script again**. It is pre-configured to extract cookies from the browser's data directory (`/home/ubuntu/.browser_data_dir`). ``` ### Technical Analysis The script grants `yt-dlp` access to the persistent Chromium profile at `/home/ubuntu/.browser_data_dir`. A general browser profile can contain authentication cookies and other session information for services beyond the public TikTok download operation. This violates least-privilege principles because the task requires, at most, narrowly scoped TikTok authentication data. The implementation does not use a dedicated TikTok-only profile, request explicit consent before accessing authenticated browser state, or validate that the supplied URL belongs to an approved TikTok hostname. Browser cookie domain restrictions normally prevent unrelated cookies from being attached to arbitrary domains, and the reviewed code contains no explicit cookie-exfiltration routine. Nevertheless, `yt-dlp` receives read access to the broader cookie database, and the arbitrary URL input expands processing beyond the Skill's declared TikTok scope. A compromised, malicious, or unexpectedly behaving downloader could inspect sessi ...[truncated 1840 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Use a dedicated browser profile** - Create a separate Chromium profile used exclusively for TikTok. - Do not point the downloader at a general-purpose or shared browser profile. 2. **Make cookie access opt-in** - Attempt an unauthenticated download first. - Require explicit user approval before reading authenticated browser cookies. - Clearly state which profile and account data will be accessed. 3. **Restrict accepted URLs** - Require HTTPS. - Parse and validate the hostname against an explicit allowlist of supported TikTok domains. - Reject malformed URLs, user-information components, unsupported schemes, and unrelated domains. - Revalidate destinations after redirects where feasible. 4. **Minimize cookie scope** - Prefer a restrictive TikTok-only cookie file instead of the full Chromium profile. - Store the file with owner-only permissions, such as mode `0600`. - Remove temporary cookie exports immediately after use. - Avoid collecting cookies for unrelated services. 5. **Constrain the downloader** - Use a trusted, pinned, and regularly patched `yt-dlp` installation. - Verify the executable path and package provenance. - Run the downloader under a dedicated low-privilege account or sandbox with access only to the output directory and narrowly scoped cookie material. 6. **Improve failure handling** - If cookie extraction is unavailable, fail safely or continue without cookies. - Do not silently broaden access to another browser profile. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (3)

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding
The code does perform TikTok video downloading from a supplied URL and uses cookies plus a custom user-agent, which partially matches the description. However, several declared capabilities are not actually implemented: there is no logic for hashtag-based downloads, no batch processing of multiple URLs, and no user-agent rotation—just one hardcoded user-agent string. The claimed 403 handling is also overstated, since the script only does a generic fallback retry without cookies rather than detecting or specifically handling HTTP 403 errors. Therefore the description materially overstates the implemented behavior.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The skill instructs use of browser-derived cookies from a local browser profile to access TikTok content, but does not warn the user that authenticated session data may be reused during downloads. This can lead to unintended use or exposure of logged-in session context, including access to account-scoped content or leakage of sensitive browser session material through logs, outputs, or downstream tooling.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The script automatically reads cookies from a local Chromium browser profile and sends them to yt-dlp for a network request, which can expose authenticated session data to an external service without explicit user consent or warning. In an agent skill context, this is more dangerous because the automation may run unattended and users may not realize their browser credentials are being leveraged to access or retrieve protected content.

Static analysis

No suspicious patterns detected.