Back to skill

Security audit

twitter-dance

Security checks for vulnerabilities and agentic risk

Overview

This Twitter automation skill needs Review because it combines powerful account actions with unsafe credential handling, including exposed keys, browser-token extraction guidance, and secret-printing scripts.

Install only after removing and rotating the exposed credentials, replacing browser-token scraping with a scoped official auth flow, redacting all logs and examples, removing the wildcard node -e permission, and disabling scheduled posting until you explicitly approve the account actions and limits.

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

T09 · Insecure Skill Coding Practices

Error
Location
USAGE_GUIDE.md:206
Finding
Live API credentials committed in project documentation<![CDATA[ ## Vulnerability Details **File Location**: `USAGE_GUIDE.md:206-208`; duplicate Kimi credential exposures also occur at `QUICK_START.md:28` and `README.md:39` **Vulnerability Type**: Hardcoded credentials and plaintext secret exposure **Risk Level**: Critical ### Vulnerable Code The exposed values are redacted below to avoid further disclosure: ```bash export APIDANCE_API_KEY="[REDACTED EXPOSED APIDANCE API KEY]" export TWITTER_AUTH_TOKEN="[REDACTED EXPOSED TWITTER AUTH TOKEN]" export KIMI_API_KEY="[REDACTED EXPOSED KIMI API KEY]" ``` The Kimi credential is also embedded in these instructions: ```bash # QUICK_START.md:28 export KIMI_API_KEY="[REDACTED EXPOSED KIMI API KEY]" ``` ```bash # README.md:39 export KIMI_API_KEY="[REDACTED EXPOSED KIMI API KEY]" ``` ### Technical Analysis The documentation contains credential-shaped values presented as active environment-variable configuration rather than placeholders. The same Kimi API key is repeated across three tracked files. Secrets committed to a project are exposed to every person or system that can read the project, including source-control mirrors, build systems, artifact archives, code-indexing services, backups, and AI tooling. Removing the values only from the current version is insufficient if they have entered source-control history or previously generated artifacts. The Twitter authentication token is particularly sensitive because the implementation uses it to authorize state-changing account operations, including posting, replying, liking, retweeting, following, unfollowing, and deleting tweets. The API keys can also be abused to consume paid service quotas. ### Attack Path 1. An attacker obtains read access to the project, an archive, a source-control clone, or indexed documentation. 2. The attacker searches for common secret prefixes or environment-variable names such as `APIDANCE_API_KEY`, `TWITTER_AUTH_TOKEN`, and `KIMI_API_KEY`. 3. The attacker extracts the plaintext values fro ...[truncated 1117 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Immediately revoke and rotate all three exposed credentials. 2. Treat rotation as mandatory even if the values are believed to be expired. 3. Replace every embedded value with unmistakable placeholders: ```bash export APIDANCE_API_KEY="your-apidance-api-key" export TWITTER_AUTH_TOKEN="your-twitter-auth-token" export KIMI_API_KEY="your-kimi-api-key" ``` 4. Remove the secrets from source-control history using an appropriate history-rewriting tool. 5. Invalidate cached artifacts, release packages, backups, and CI logs containing the original values where feasible. 6. Store runtime credentials in environment variables or a dedicated secret manager. 7. Ensure `.env`, `.env.local`, logs, and generated credential files are excluded from source control. 8. Add pre-commit and CI secret scanning to reject credential-shaped values. 9. Restrict each replacement credential to the minimum required privileges and quotas. 10. Review service audit logs for unauthorized activity beginning from the earliest possible exposure date. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/test-tweet-graphql.js:90
Finding
GraphQL test script prints authentication secrets to standard output<![CDATA[ ## Vulnerability Details **File Location**: `scripts/test-tweet-graphql.js:90-94` **Vulnerability Type**: Plaintext credential disclosure through application logs **Risk Level**: High ### Vulnerable Code ```javascript console.log(`POST /graphql/CreateTweet 请求头: Authtoken: ${process.env.TWITTER_AUTH_TOKEN || '<your-token>'} apikey: ${process.env.APIDANCE_API_KEY || '<your-api-key>'} User-Agent: Apidog/1.0.0 (https://apidog.com) Content-Type: application/json Accept: */* ``` The script initializes the client with live environment credentials and later interpolates those same values directly into console output: ```javascript const client = new TwitterDanceAPIClient({ apiKey: process.env.APIDANCE_API_KEY, authToken: process.env.TWITTER_AUTH_TOKEN, verbose: 2 }); ``` ### Technical Analysis The test script prints the complete Twitter authentication token and apidance.pro API key whenever the corresponding environment variables are configured. Standard output is frequently retained outside the process boundary by CI systems, shell session recorders, terminal-sharing tools, Agent transcripts, monitoring platforms, container logs, or support bundles. Checking whether a credential is configured does not require exposing its value. Printing the complete authentication headers creates a secondary secret-distribution channel and defeats the protection gained from storing credentials in environment variables. The script also enables verbose request and response logging. Although the reviewed core client does not print authentication headers itself, verbose diagnostic behavior should be designed around explicit redaction to prevent future changes from exposing additional sensitive values. ### Attack Path 1. A user or CI job configures `TWITTER_AUTH_TOKEN` and `APIDANCE_API_KEY`. 2. The documented GraphQL test script is executed. 3. The script writes both complete credentials to standard output. 4. A terminal logger, CI system, Agent transc ...[truncated 916 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove all interpolation of credential values from console output. 2. Replace the vulnerable output with presence-only status: ```javascript console.log(`Authtoken: ${process.env.TWITTER_AUTH_TOKEN ? '[configured]' : '[missing]'}`); console.log(`apikey: ${process.env.APIDANCE_API_KEY ? '[configured]' : '[missing]'}`); ``` 3. If identification is operationally necessary, reveal only a short suffix: ```javascript function maskSecret(value) { if (!value) return '[missing]'; return `***${value.slice(-4)}`; } ``` 4. Introduce a centralized log-sanitization function that redacts authorization headers, cookies, tokens, API keys, and known secret environment variables. 5. Review historical CI logs, Agent transcripts, and support bundles for prior disclosures. 6. Rotate credentials if this script has ever been run with real values in a logged environment. 7. Add automated tests asserting that command output never contains configured test-secret values. 8. Keep verbose diagnostics disabled by default and document that sensitive request headers must never be logged. ]]>

T05 · Unauthorized Access and Privilege Escalation

Error
Location
.claude/settings.local.json:3
Finding
Wildcard node execution permission violates least privilege<![CDATA[ ## Vulnerability Details **File Location**: `.claude/settings.local.json:3-7` **Vulnerability Type**: Overly broad pre-approved command execution **Risk Level**: High ### Vulnerable Code ```json "allow": [ "Bash(node scripts/get-my-info.js)", "Bash(node -e \":*)", "Bash(node scripts/test-notifications.js)" ] ``` ### Technical Analysis The permission entry for `node -e` permits inline JavaScript execution with a wildcard suffix. Unlike the two exact script permissions, inline JavaScript is not constrained to reviewed project code or to Twitter-related behavior. Node.js inline code can access the full standard library available to the process. It can read and write files, inspect environment variables, initiate outbound network requests, and invoke child processes. Consequently, pre-approving arbitrary `node -e` execution grants capabilities far beyond the Skill's declared social-media automation purpose. This does not itself prove that arbitrary code is executed by the project. The vulnerability is the missing approval boundary: if an Agent workflow, injected instruction, or other untrusted input can influence the command following `node -e`, the command may execute without a new user authorization decision. ### Attack Path 1. The project is loaded in an Agent environment that honors `.claude/settings.local.json`. 2. The Agent encounters attacker-controlled or compromised instructions, such as content from an untrusted prompt, issue, document, or API response. 3. Those instructions induce the Agent to invoke `node -e` with attacker-selected JavaScript. 4. The wildcard permission matches the command and bypasses a fresh approval prompt. 5. The inline JavaScript reads local files or environment variables, makes network requests, alters files, or launches child processes. 6. The attacker obtains data or effects using the operating-system privileges of the Agent process. ### Impact Assessment Successful exploitation could provide the effecti ...[truncated 624 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove the wildcard inline-execution permission: ```json "Bash(node -e \":*)" ``` 2. Permit only exact, reviewed scripts required by the Skill. 3. Avoid wildcard arguments for interpreters, shells, package managers, and other general-purpose execution tools. 4. If dynamic behavior is required, implement it in a reviewed script with strict argument parsing and an explicit allowlist of operations. 5. Require fresh user approval for any command capable of arbitrary code execution. 6. Run the Agent in a sandbox with: - A restricted filesystem view. - Minimal environment variables. - Outbound network allowlisting. - No access to SSH keys or unrelated credential stores. - A non-privileged operating-system account. 7. Add configuration review checks that reject broad patterns such as `node -e`, shell `-c`, `eval`, or wildcard interpreter permissions. 8. Keep each allowed command narrowly scoped to fixed paths and validated arguments. ]]>
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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (135)

Context-Inappropriate Capability

High
Confidence
97% confidence
Finding
The guide explicitly instructs users to extract the Twitter/X `auth_token` cookie from browser developer tools and place it into `.env` for automation. That cookie is a live session credential; encouraging manual extraction and reuse outside the browser materially increases risk of account compromise, session hijacking, accidental leakage in logs/files, and use of unofficial automation against the platform account.

Ssd 3

High
Confidence
96% confidence
Finding
These lines directly instruct the user to locate the browser `auth_token` cookie and reuse it for scripted automation. Reusing browser session material outside its intended context is dangerous because anyone who obtains that token can often act as the account holder until the session is revoked, and the skill context—automated replying at scale—makes abuse more consequential.

Credential Access

High
Category
Privilege Escalation
Content
│   └── COMPLETION_SUMMARY.md          ← 项目总结(本文件)
│
├── 🔧 配置文件
│   ├── .env                           ← 环境变量(已配置)
│   ├── .env.example                   ← 示例配置
│   └── package.json                   ← 依赖配置(已更新)
│
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
│   └── COMPLETION_SUMMARY.md          ← 项目总结(本文件)
│
├── 🔧 配置文件
│   ├── .env                           ← 环境变量(已配置)
│   ├── .env.example                   ← 示例配置
│   └── package.json                   ← 依赖配置(已更新)
│
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
│   └── COMPLETION_SUMMARY.md          ← 项目总结(本文件)
│
├── 🔧 配置文件
│   ├── .env                           ← 环境变量(已配置)
│   ├── .env.example                   ← 示例配置
│   └── package.json                   ← 依赖配置(已更新)
│
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
│   └── COMPLETION_SUMMARY.md          ← 项目总结(本文件)
│
├── 🔧 配置文件
│   ├── .env                           ← 环境变量(已配置)
│   ├── .env.example                   ← 示例配置
│   └── package.json                   ← 依赖配置(已更新)
│
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
│   └── COMPLETION_SUMMARY.md          ← 项目总结(本文件)
│
├── 🔧 配置文件
│   ├── .env                           ← 环境变量(已配置)
│   ├── .env.example                   ← 示例配置
│   └── package.json                   ← 依赖配置(已更新)
│
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
│   └── COMPLETION_SUMMARY.md          ← 项目总结(本文件)
│
├── 🔧 配置文件
│   ├── .env                           ← 环境变量(已配置)
│   ├── .env.example                   ← 示例配置
│   └── package.json                   ← 依赖配置(已更新)
│
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
│   └── COMPLETION_SUMMARY.md          ← 项目总结(本文件)
│
├── 🔧 配置文件
│   ├── .env                           ← 环境变量(已配置)
│   ├── .env.example                   ← 示例配置
│   └── package.json                   ← 依赖配置(已更新)
│
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Missing User Warnings

High
Confidence
99% confidence
Finding
The documentation explicitly tells the user to run `cat` on the full `.env` file, which will print API keys and auth tokens in plaintext. In an agent or shared-terminal context, this can expose credentials to logs, transcripts, screenshots, or downstream tools, enabling account takeover or API abuse.

Ssd 3

High
Confidence
99% confidence
Finding
This finding is a direct secret-disclosure issue: instructing users to read and display the full `.env` file can leak configured credentials in plaintext. Because the same document states that API keys and Twitter auth tokens are already configured, the risk is elevated from hypothetical to likely real credential exposure.

Credential Access

High
Category
Privilege Escalation
Content
### 第 1 步:配置已完成 ✅
```bash
# .env 文件已存在
cat /Users/chao/.openclaw/workspace/skills/twitter-dance/.env
```
Confidence
99% confidence
Finding
This line contains an explicit command to print the contents of a real `.env` path. In a skill or agent environment, that can expose live API keys and tokens to console history, orchestration logs, transcripts, and any observer with access to the session.

Credential Access

High
Category
Privilege Escalation
Content
### 第 1 步:配置已完成 ✅
```bash
# .env 文件已存在
cat /Users/chao/.openclaw/workspace/skills/twitter-dance/.env
```

### 第 2 步:验证配置
Confidence
98% confidence
Finding
This finding is part of the same secret-exposure instruction sequence and reinforces the unsafe guidance to reveal `.env` contents. Given the document claims the environment already contains configured API credentials, executing this advice would likely disclose usable secrets rather than dummy placeholders.

Credential Access

High
Category
Privilege Escalation
Content
### 2. 配置环境变量

```bash
# .env 文件
APIDANCE_API_KEY=your-api-key
TWITTER_AUTH_TOKEN=your-auth-token
KIMI_API_KEY=sk-xxx  # 可选
Confidence
94% confidence
Finding
The guide instructs users to store a Twitter auth token, API key, and optional KIMI API key in a local .env file without discussing sensitivity, scoping, rotation, or leakage risks. In a skill/workspace environment, .env files are commonly exposed through commits, backups, logs, support bundles, or permissive file access, making these credentials attractive targets for credential theft and abuse.

Missing User Warnings

High
Confidence
99% confidence
Finding
The document contains what appears to be a real Kimi API key embedded directly in the quick-start instructions. Publishing a live secret in documentation is a severe credential exposure issue: anyone reading the file can reuse the key, incur charges, access associated services, or pivot into related systems depending on account permissions.

Missing User Warnings

High
Confidence
99% confidence
Finding
The README includes what appears to be a concrete Kimi API key, which is a direct secret exposure. Embedded secrets can be harvested by anyone reading the repository and abused for unauthorized API usage, cost incurrence, and potential access to associated account data.

Ssd 3

High
Confidence
98% confidence
Finding
Instructing users to recover an authorization token from browser requests and reuse it programmatically is an unsafe credential acquisition pattern. It bypasses normal trust boundaries and can lead to account takeover, long-lived unauthorized access, and violations of platform security controls if the token is exfiltrated or reused elsewhere.

Ae1

High
Category
analysis-evasion
Content
node scripts/auto-tweet.js --draft-only
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node scripts/auto-tweet.js --draft-only
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node scripts/auto-tweet.js --draft-only
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node scripts/auto-tweet.js --draft-only
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node scripts/auto-tweet.js --draft-only
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node scripts/auto-tweet.js --draft-only
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node scripts/test-tweet-graphql.js "你的推文内容"
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node scripts/test-advanced-features.js stats
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Static analysis

No suspicious patterns detected.