Back to skill

Security audit

Trakt Read-only

Security checks for vulnerabilities and agentic risk

Overview

This Trakt skill mostly matches its purpose, but its OAuth helper can print account tokens into normal output, so it should be reviewed before installation.

Install only after reviewing the OAuth path. Basic read-only commands using TRAKT_CLIENT_ID and TRAKT_USERNAME are low impact, but avoid the device-token command unless token output is redacted or stored through a secure secret mechanism; rotate any Trakt tokens that may have been printed into logs or transcripts.

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/trakt-api.sh:313
Finding
OAuth Access and Refresh Tokens Exposed Through Standard Output<![CDATA[ ## Vulnerability Details **File Location**: `scripts/trakt-api.sh`, lines 313–314 **Vulnerability Type**: Sensitive credential exposure through standard output **Risk Level**: Medium ### Vulnerable Code ```bash body=$(jq -nr --arg cid "$TRAKT_CLIENT_ID" --arg cs "$TRAKT_CLIENT_SECRET" --arg code "$device_code" '{code:$code, client_id:$cid, client_secret:$cs}') oauth_post "/oauth/device/token" "$body" | jq ``` ### Technical Analysis The device OAuth token exchange sends the complete response from `/oauth/device/token` through `jq` directly to standard output. A successful Trakt token response can contain sensitive OAuth credentials, including an access token and refresh token. Standard output from an agent Skill may be recorded in conversation transcripts, orchestration logs, command histories, debugging systems, or other output-capture infrastructure. Consequently, printing the complete response can disclose credentials outside the intended secret-storage boundary. This behavior also conflicts with the explicit guardrail in `SKILL.md` stating that API keys and access tokens must never be logged or exposed. ### Attack Path 1. A user initiates the device OAuth flow with the `device-code` command. 2. The user authorizes the device code through Trakt. 3. The Skill invokes `device-token` with the authorized device code. 4. Trakt returns a response containing OAuth credentials. 5. The script prints the entire response to standard output. 6. An actor with access to the agent transcript, execution logs, or captured output retrieves the exposed token. 7. The actor uses the token against Trakt API endpoints permitted by its granted OAuth authorization. No local command execution is required to exploit the disclosure; access to captured Skill output is sufficient. ### Impact Assessment An exposed access token may allow unauthorized access to the associated user's Trakt data within the permissions granted to the OAuth application. If a refresh token is ...[truncated 426 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Do not print the complete token response through normal Skill output. 2. Parse the response internally and store credentials directly in a secure secret store or permission-restricted configuration mechanism. 3. Return only a non-sensitive status message, such as confirmation that authorization succeeded. 4. If credentials must be written to a local file, create it with restrictive permissions such as mode `0600`, avoid predictable temporary paths, and prevent the contents from entering logs. 5. Redact sensitive response fields before displaying diagnostic output, including: - `access_token` - `refresh_token` - `client_secret` 6. Disable shell tracing around credential-handling operations and ensure the agent or orchestration environment does not capture secret-bearing responses. 7. If manual token display is an unavoidable workflow requirement, require explicit user confirmation, clearly warn that the value is sensitive, and use a secure out-of-band secret-delivery mechanism rather than the ordinary transcript. 8. Revoke and rotate any OAuth credentials that may already have appeared in retained transcripts or logs. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (15)

Chaining Abuse

High
Category
Tool Misuse
Content
Install on Ubuntu/Debian:

```
sudo apt-get update && sudo apt-get install -y jq curl
```

## Setup
Confidence
75% confidence
Finding
Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The metadata and description present the skill as a simple read-only Trakt lookup requiring only client ID and username, but the documented behavior also includes OAuth device authorization and token exchange using a client secret. This mismatch can cause users or higher-level agents to supply more sensitive credentials than expected and approve flows with broader security consequences than the advertised purpose.

Credential Access

High
Category
Privilege Escalation
Content
## Guardrails

- Never log or expose API keys or access tokens.
- Only call `https://api.trakt.tv`.
- Read-only endpoints only; playback uses OAuth token read access.
- Device OAuth flow is read-only; do not request write scopes.
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
profile                  User profile info
    playback <type> <start_at> <end_at>   Playback progress (requires token)
    device-code             Start device OAuth (gives user_code)
    device-token <device_code>  Exchange device code for access token

Environment Variables Required:
    TRAKT_CLIENT_ID          Your Trakt API client id
Confidence
86% confidence
Finding
The script advertises the ability to exchange a device code for an access token, which is credential acquisition behavior. In the context of a skill marketed primarily for read-only activity checks, this is more dangerous because it introduces auth-token procurement capability that could be repurposed for broader account access.

Credential Access

High
Category
Privilege Escalation
Content
TRAKT_USERNAME           Your Trakt username or user slug

Optional (for playback):
    TRAKT_ACCESS_TOKEN       OAuth access token (Bearer)
    TRAKT_CLIENT_SECRET      OAuth client secret (required for device token exchange)

Examples:
Confidence
90% confidence
Finding
Declaring and consuming `TRAKT_ACCESS_TOKEN` and `TRAKT_CLIENT_SECRET` means the script is designed to handle sensitive credentials. That is a meaningful security concern in this context because the stated skill purpose does not clearly justify secret processing, increasing the risk of over-privileged deployment and accidental exposure of bearer tokens or client secrets.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
Install on Ubuntu/Debian:

```
sudo apt-get update && sudo apt-get install -y jq curl
```

## Setup
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The README expands the skill from simple read-only querying into OAuth device-flow initiation and token exchange, which materially changes the trust and secret-handling model. Even if the resulting token is intended for read access, documenting credential acquisition workflows in a supposedly read-only skill increases the chance of over-privileged use, user confusion, and unsafe handling of OAuth secrets.

Intent-Code Divergence

Medium
Confidence
92% confidence
Finding
The README states 'read-only endpoints only' while also including device-token exchange operations, which is a misleading security claim. This inconsistency can cause operators to trust the skill more than warranted and provide client secrets or tokens under false assumptions about capability and risk.

Lp3

Medium
Category
MCP Least Privilege
Confidence
84% confidence
Finding
The skill exposes shell execution capability through an external script but does not declare any explicit tool scope or allowed-tools boundary. This weakens policy enforcement and reviewability, making it easier for a consuming agent to invoke shell-based behavior without clear restriction, especially in a skill that handles API credentials and OAuth-related flows.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The front matter says the skill requires only a client ID and username, yet the command set includes OAuth device-flow token acquisition. That discrepancy is dangerous because it understates the sensitivity of the skill and can mislead users, reviewers, or orchestrators into exposing secrets or enabling auth flows they did not intend to allow.

Context-Inappropriate Capability

Medium
Confidence
88% confidence
Finding
Including device authorization and token exchange in a skill whose stated purpose is checking user activity unnecessarily expands the attack surface. Even if the resulting scope is read-only, token acquisition functionality introduces credential-handling paths and phishing-like approval flows that are more sensitive than passive API reads.

Description-Behavior Mismatch

Medium
Confidence
96% confidence
Finding
The script’s manifest describes a read-only Trakt activity/status skill, but the implementation includes OAuth device-code initiation and token exchange flows. Expanding a supposedly read-only skill to mint access tokens increases privilege and broadens the attack surface, enabling future authenticated API use beyond simple public profile/history reads.

Context-Inappropriate Capability

Medium
Confidence
96% confidence
Finding
Handling `TRAKT_CLIENT_SECRET` and performing OAuth token exchange gives this script the ability to process sensitive credentials despite being presented as a read-only status checker. In an agent-skill context, hidden secret-handling is dangerous because it can normalize exposing high-value secrets to code that users and reviewers may assume only performs harmless reads.

External Transmission

Medium
Category
Data Exfiltration
Content
url+="?${params}"
    fi

    curl -s \
      -H "Content-Type: application/json" \
      -H "trakt-api-version: 2" \
      -H "trakt-api-key: ${TRAKT_CLIENT_ID}" \
Confidence
70% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Intent-Code Divergence

Low
Confidence
86% confidence
Finding
The documentation tells the agent not to implement OAuth support unless explicitly requested, but the skill already ships built-in OAuth device-flow commands. This inconsistency can confuse safety logic and make an agent more likely to invoke auth-related actions despite the apparent guardrail.

Static analysis

No suspicious patterns detected.