Back to skill

Security audit

ClawSpotify

Security checks for vulnerabilities and agentic risk

Overview

This Spotify control skill appears purpose-built rather than malicious, but it asks users to handle raw Spotify browser session cookies in risky ways and installs an unpinned external dependency that receives those credentials.

Review this before installing. Use a dedicated or low-risk Spotify account if possible, avoid pasting real cookies into shell history, clear any history or logs containing sp_dc or sp_key, inspect the SpotAPI dependency, and prefer a pinned reviewed commit or safer OAuth-based authentication. Delete or rotate the stored session if you no longer need the skill or suspect exposure.

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

T08 · Insecure Dependencies

Warning
Location
README.md:34
Finding
Unpinned Third-Party Dependency Installed from a Mutable Git Repository## Vulnerability Details **File Location**: `README.md:34-38` **Vulnerability Type**: Supply-chain exposure through an unpinned executable dependency **Risk Level**: Medium **Vulnerable Code**: ```bash # Install SpotAPI dependency git clone https://github.com/ejatapibeda/SpotAPI.git pip install -e ./SpotAPI # alternative pip install git+https://github.com/ejatapibeda/SpotAPI.git ``` The same unsafe installation approach is also documented in `SKILL.md`, where users are instructed to clone SpotAPI and install it in editable mode without selecting a verified immutable revision. ### Technical Analysis The documented installation process retrieves and installs the current default branch of an external Git repository. It does not pin SpotAPI to a reviewed commit, verify a release signature, enforce a package hash, or use a locked dependency manifest. A Git branch is mutable. Consequently, the code installed by future users can differ from the code that existed when this Skill was audited. Python package installation may execute dependency-controlled build or installation logic. SpotAPI is particularly sensitive because the Skill passes reusable Spotify authentication cookies to its `SpotifySession.setup()` and `SpotifySession.load()` interfaces. There is no evidence in the audited project that the current SpotAPI source is malicious. The vulnerability is the lack of supply-chain integrity controls, which would allow a compromised or maliciously modified upstream dependency to execute within the user's environment. ### Attack Path 1. An attacker compromises the SpotAPI repository, its maintainer account, or the repository's default branch. 2. The attacker adds malicious runtime, build, or installation logic to SpotAPI. 3. A user follows the documented `git clone` and `pip install -e` instructions, or installs directly from the mutable Git URL. 4. The attacker's code executes with the privileges of the user running `pip ...[truncated 886 chars]
Remediation
## Remediation Suggestions 1. Pin SpotAPI to a reviewed immutable commit rather than a branch: ```bash pip install "git+https://github.com/ejatapibeda/SpotAPI.git@REVIEWED_COMMIT_HASH" ``` 2. Prefer a versioned release artifact with cryptographic hashes and enforce hashes through a lock file or `requirements.txt`. 3. Avoid editable installations such as `pip install -e` for normal production use. 4. Record the exact reviewed SpotAPI version or commit in both `README.md` and `SKILL.md`. 5. Install the dependency in an isolated virtual environment with only the permissions needed for Spotify control. 6. Review dependency changes before updating the pinned revision. 7. Where available, verify signed tags or release attestations and use automated dependency integrity scanning.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/spotify.py:524
Finding
Spotify Session Cookies Accepted Through Process Command-Line Arguments## Vulnerability Details **File Location**: `scripts/spotify.py:524-525` **Vulnerability Type**: Sensitive credential exposure through command-line arguments **Risk Level**: Medium **Vulnerable Code**: ```python p_setup.add_argument("--sp-dc", required=True, metavar="VALUE", help="sp_dc cookie value from browser") p_setup.add_argument("--sp-key", required=True, metavar="VALUE", help="sp_key cookie value from browser") ``` The documented invocation in `SKILL.md:71-73` and `README.md:62-65` places both secrets directly on the command line: ```bash clawspotify setup --sp-dc "AQC..." --sp-key "07c9..." ``` ### Technical Analysis The `sp_dc` and `sp_key` values are reusable Spotify session credentials. Passing them as command-line options places the secrets in the process argument vector. Depending on the operating system and environment, process arguments may be visible to local process-monitoring tools, diagnostic systems, audit collectors, or other users while the command is running. The documented shell command may also be retained in shell history, terminal logs, orchestration logs, support bundles, or command telemetry. Quoting the values prevents shell token splitting but does not protect their confidentiality. The audited code does not deliberately print these cookie values or transmit them to an unrelated service. The vulnerability arises from the credential-input mechanism and the documentation encouraging its use. ### Attack Path 1. A user obtains valid `sp_dc` and `sp_key` cookies from a logged-in Spotify browser session. 2. The user runs the documented setup command with both values as command-line arguments. 3. The shell stores the complete command in history, or a local monitoring process captures the process argument vector. 4. An attacker with access to that history, monitoring data, diagnostic output, or local process information extracts the cookies. 5. The attacker reuses the cookies through com ...[truncated 793 chars]
Remediation
## Remediation Suggestions 1. Replace command-line secret options with interactive hidden prompts using `getpass.getpass()`: ```python from getpass import getpass sp_dc = getpass("Spotify sp_dc cookie: ") sp_key = getpass("Spotify sp_key cookie: ") ``` 2. Alternatively, accept credentials from standard input or an explicitly selected owner-readable file, rather than from the process argument vector. 3. If a credential file is supported, reject permissive file modes and require owner-only access such as `0600`. 4. Update `README.md` and `SKILL.md` so examples never include secrets in command-line arguments. 5. Warn existing users that previous setup commands may remain in shell history and should be removed securely. 6. Verify that the SpotAPI session file and its parent directory use restrictive permissions. 7. Avoid printing credentials or including them in exception messages, debug logs, telemetry, or crash reports. 8. Recommend revoking and replacing cookies if accidental command history or log exposure is suspected.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Rogue AgentSelf-Modification, Session Persistence
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (10)

YARA rule 'agent_skill_remote_bootstrap_execution': Remote script or code download followed by execution/bootstrap installation [agent_skills]

High
Category
YARA Match
Content
he command line (or via your OpenClaw agent): play songs by name, skip tracks, manage volume, shuffle, repeat, search playlists, and check what's playing — all without touching the Spotify app.

---

## Requirements

| Requirement | Notes |
|-------------|-------|
| Python 3.10+ | `python3 --version` |
| [SpotAPI](https://github.com/ejatapibeda/SpotAPI) | `pip install -e ./SpotAPI` or `pip install git+https://github.com/ejatapibeda/SpotAPI.git`|
| Active Spotify account | Free or Premium |
| Spotify open on any device | Desktop, mobile, or web player |

> **Windows users:** Running the `clawspotify` bash script natively on Windows requires WSL, Git Bash, or Cygwin. Alternatively, you can run `python scripts/spotify.py` directly.

---

## Installation

### Via ClawHub
```bash
clawhub install clawspotify
```

### Manual
```bash
git clone https://github.com/ejatapibeda/ClawSpotify.git
cd ClawSpotify

# Install SpotAPI dependency
git clone https://github.com
Confidence
85% confidence
Finding
YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

YARA rule 'backdoor_persistence': Backdoor persistence with malicious payloads (shell commands, SSH key injection, hidden root users) [malware]

High
Category
YARA Match
Content
://github.com/ejatapibeda/SpotAPI.git
pip install -e ./SpotAPI
```

### `$'\r': command not found` / CRLF errors

```bash
sed -i 's/\r$//' ClawSpotify/clawspotify
```

> To prevent this permanently, the repo includes a [`.gitattributes`](./.gitattributes) file that enforces LF line endings on checkout.

### `clawspotify: command not found`

Add `~/.local/bin` to your PATH:
```bash
echo 'export PATH="${HOME}/.local/bin:${PATH}"' >> ~/.bashrc
source ~/.bashrc
```

### Cookies expired / authentication errors

Spotify session cookies expire periodically. Re-run setup with fresh cookies:
```bash
clawspotify setup --sp-dc "new_value" --sp-key "new_value"
```

---

## Project Structure

```
ClawSpotify/
├── SKILL.md              # OpenClaw skill definition
├── README.md             # This file
├── clawspotify           # CLI wrapper script (bash)
└── scripts/
    └── spotify.py        # CLI implementation (Python)
```

---
Confidence
75% confidence
Finding
YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
The declared description understates the skill's actual behavior by omitting credential capture/setup, session persistence, and multi-account handling. That mismatch can mislead users and higher-level tooling into granting trust or permissions without understanding that the skill processes authentication material, which increases the chance of unsafe use.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The README instructs users to extract `sp_dc` and `sp_key` browser session cookies and store them locally, but it does not clearly warn that these are highly sensitive authentication artifacts equivalent to account session tokens. If exposed through shell history, screenshots, backups, logs, or insecure file permissions, an attacker could reuse them to control or access the user's Spotify session until the cookies expire or are revoked.

Session Persistence

Medium
Category
Rogue Agent
Content
# Clone main skill
git clone https://github.com/ejatapibeda/ClawSpotify.git ~/.openclaw/workspace/skills/ClawSpotify

# Create virtual environment
python3 -m venv ~/.venv-clawspotify

# Install SpotAPI (modified version with session support)
Confidence
83% confidence
Finding
The skill explicitly supports session-based authentication and states that session data is saved to ~/.config/spotapi/session.json for reuse. Persisting authentication material locally increases the blast radius of local compromise or accidental disclosure, especially when the credentials originate from browser session cookies rather than a scoped OAuth token.

Missing User Warnings

Medium
Confidence
97% confidence
Finding
The setup instructs users to manually extract browser session cookies (sp_dc and sp_key) and pass them on the command line, which exposes highly sensitive account credentials. These values may appear in shell history, process listings, logs, or screenshots, and possession of them can enable account access equivalent to an authenticated web session.

Description-Behavior Mismatch

Medium
Confidence
96% confidence
Finding
The skill includes first-time setup and storage of Spotify session cookies (sp_dc and sp_key), which is a materially sensitive capability beyond simple playback control. Undisclosed credential capture/storage increases the chance that users or orchestrating systems will invoke it without understanding that account-authentication secrets are being handled and persisted locally.

Session Persistence

Medium
Category
Rogue Agent
Content
_active_ws_objects = []

def _get_player(login, require_device: bool = True):
    """Create a Player instance, with friendly error for no active device."""
    try:
        from spotapi import Player
        from spotapi.exceptions import LoginError
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.

Missing User Warnings

Medium
Confidence
97% confidence
Finding
Accepting sp_dc and sp_key as command-line arguments exposes sensitive session credentials to shell history, process listings, audit logs, and telemetry captured by wrappers or agent runtimes. Because these cookies authenticate the Spotify account, leakage can enable account takeover or unauthorized playback/account actions until the session expires or is revoked.

Description-Behavior Mismatch

Low
Confidence
94% confidence
Finding
The manifest description limits scope to controlling playback and searching generally, but specifically enumerates track-oriented controls such as play, queue, and now-playing status without mentioning playlist discovery or playlist playback. The file docstring and parser add `search-playlist` and `play-playlist`, expanding behavior beyond the declared feature set.

Static analysis

No suspicious patterns detected.