Back to skill

Security audit

Tiktok Ads CLI

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly coherent for TikTok Ads reporting, but it asks users to install an unpinned global third-party CLI and handle OAuth credentials without enough safeguards.

Review before installing. Prefer a pinned, verified, project-local CLI install; use least-privilege and short-lived TikTok tokens; store credentials privately; do not paste tokens into chat or logs; and confirm whether the audience commands are read-only before granting permissions.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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)

T08 · Insecure Dependencies

Warning
Location
SKILL.md:26
Finding
Unpinned Global Installation of a Credential-Handling Third-Party CLI<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 26–30 **Vulnerability Type**: `T08: Insecure Dependencies` **Risk Level**: Medium ### Vulnerable Code ```markdown If the CLI is not installed, install it: ```bash npm install -g tiktok-ads-cli ``` ``` ### Technical Analysis The Skill instructs users to install the latest available version of `tiktok-ads-cli` globally from npm. The dependency is not pinned to a reviewed version, and the installation instruction supplies no integrity hash, lockfile, provenance verification, or publisher-validation procedure. This CLI is subsequently entrusted with a TikTok OAuth access token and access to advertising account information. npm installation may also execute package lifecycle scripts with the invoking user's local privileges. Consequently, compromise of the package, publisher account, or a future package release could introduce arbitrary code after the Skill itself has been audited. Global installation expands the exposure because the executable is placed in a system-wide or user-wide command path and may remain available across later sessions. ### Attack Path 1. An attacker compromises the npm package, its publisher account, or its release pipeline. 2. The attacker publishes a malicious version of `tiktok-ads-cli`. 3. A user follows the Skill instruction and runs `npm install -g tiktok-ads-cli`. 4. npm retrieves the current malicious release and may execute its lifecycle scripts during installation. 5. The malicious package executes with the installing user's privileges. 6. When invoked, the CLI can access the configured TikTok OAuth token through the environment, the `--credentials` argument, or `~/.config/tiktok-ads-cli/credentials.json`. 7. The package can exfiltrate credentials or advertising data, modify local user files, or perform other actions permitted to the user. ### Impact Assessment Successful exploitation could result in: - Theft of TikTok OAuth access tokens and option ...[truncated 618 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Pin the CLI to an explicitly reviewed version, for example: ```bash npm install --global tiktok-ads-cli@<reviewed-version> ``` 2. Document the expected npm publisher, source repository, package version, and integrity checksum so users can verify package provenance before installation. 3. Prefer a project-local installation governed by a committed lockfile instead of a global installation: ```bash npm install --save-exact tiktok-ads-cli@<reviewed-version> ``` 4. Use npm provenance and integrity verification where supported, and periodically audit the pinned package and its transitive dependencies. 5. Disable lifecycle scripts during installation where compatible: ```bash npm install --ignore-scripts --save-exact tiktok-ads-cli@<reviewed-version> ``` 6. Run the CLI in a restricted environment with minimal filesystem and network access. 7. Use short-lived, least-privilege TikTok tokens restricted to only the advertiser accounts and read operations required for the task. 8. Protect credential files with restrictive permissions and avoid passing secrets through command-line arguments where they may be exposed through process listings or shell history. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (9)

Credential Access

High
Category
Privilege Escalation
Content
## Authentication

The CLI requires a TikTok **OAuth access token**. Credentials are resolved in this order:

1. `--credentials <path>` flag (per-command)
2. Environment variable: `TIKTOK_ADS_ACCESS_TOKEN` (also reads `TIKTOK_ADS_APP_ID` and `TIKTOK_ADS_SECRET` if set)
Confidence
88% confidence
Finding
The authentication section centers the workflow around access tokens and optional app credentials without constraining how the agent should handle them. In practice, such instructions can lead to secret collection, reuse, or leakage through command examples, error messages, or conversational prompts.

Credential Access

High
Category
Privilege Escalation
Content
1. `--credentials <path>` flag (per-command)
2. Environment variable: `TIKTOK_ADS_ACCESS_TOKEN` (also reads `TIKTOK_ADS_APP_ID` and `TIKTOK_ADS_SECRET` if set)
3. Auto-detected file: `~/.config/tiktok-ads-cli/credentials.json`

The credentials JSON file requires only `access_token`. The `app_id` and `secret` fields are optional:
Confidence
91% confidence
Finding
The skill explicitly directs the agent to look for credentials via a file path, environment variables, or a --credentials flag. In an agent environment, this materially increases the chance of credential discovery, access, or accidental disclosure beyond what is necessary for normal user interaction.

Credential Access

High
Category
Privilege Escalation
Content
## Error handling

- **Authentication errors** -- ask the user to verify their access token; run `tiktok-ads-cli advertiser <id>` to test
- **"No credentials found"** -- ask the user to set up one of: `--credentials` flag, `TIKTOK_ADS_ACCESS_TOKEN` env var, or `~/.config/tiktok-ads-cli/credentials.json`
- **Empty report results** -- check the date range, data level, and whether the account had active ads in the period
- **API error codes** -- the CLI surfaces the TikTok API error message; common issues include invalid advertiser IDs, expired tokens, or insufficient permissions
Confidence
87% confidence
Finding
Telling the agent to ask the user to verify their access token during authentication troubleshooting can easily turn into requesting or exposing the token itself. In a conversational or tool-using agent context, that creates a realistic path to credential disclosure.

Credential Access

High
Category
Privilege Escalation
Content
## Error handling

- **Authentication errors** -- ask the user to verify their access token; run `tiktok-ads-cli advertiser <id>` to test
- **"No credentials found"** -- ask the user to set up one of: `--credentials` flag, `TIKTOK_ADS_ACCESS_TOKEN` env var, or `~/.config/tiktok-ads-cli/credentials.json`
- **Empty report results** -- check the date range, data level, and whether the account had active ads in the period
- **API error codes** -- the CLI surfaces the TikTok API error message; common issues include invalid advertiser IDs, expired tokens, or insufficient permissions
- **Page out of range** -- check `page_info.total_page` in the response to avoid requesting pages beyond the total
Confidence
89% confidence
Finding
The error-handling section tells the operator to set up credentials using a secret-bearing file, flag, or environment variable, normalizing workflows that may prompt the agent to access or expose secrets during remediation. This is especially risky because troubleshooting steps are often echoed back to the user or logged by automation.

Session Persistence

Medium
Category
Rogue Agent
Content
description: >
  TikTok Ads data analysis and reporting via tiktok-ads-cli.
  Use when the user wants to check TikTok ad performance, pull campaign/ad group/ad stats,
  manage audiences, inspect creatives, check pixel tracking, or create async reports.
  Triggers: "TikTok Ads", "TikTok ad performance", "TikTok campaign stats",
  "TikTok ad spend", "TikTok report", "TikTok pixel", "TikTok audience",
  "TikTok creatives", "TikTok ad account", "TikTok ad groups", "TikTok async report".
Confidence
60% confidence
Finding
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Intent-Code Divergence

Medium
Confidence
96% confidence
Finding
The skill describes the CLI as 'read-only' while also stating it can 'manage custom and lookalike audiences,' which are operationally mutable resources. This can mislead an agent or user into approving commands under a false assumption of non-destructive behavior, increasing the risk of unintended state changes in an ad account.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The skill instructs use of OAuth access tokens, app IDs, secrets, and a credentials file without any explicit warning not to paste secrets into chat, logs, or shared command history. In an agent setting, this increases the chance that sensitive credentials are exposed, persisted, or mishandled during troubleshooting and execution.

Session Persistence

Medium
Category
Rogue Agent
Content
### When the user asks for large date-range reports

1. Use `async-report` to create an async task (avoids timeout for large datasets)
2. Use `report-status` to poll for completion
3. The completed task response will include a download URL
Confidence
60% confidence
Finding
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Intent-Code Divergence

Low
Confidence
78% confidence
Finding
The workflow guidance says to check reports with the 'conversions' metric, but the documented common metrics list uses 'conversion' and 'cost_per_conversion' instead. This is a direct documentation inconsistency about what the code/CLI expects, which can mislead users about the actual command behavior.

Static analysis

No suspicious patterns detected.