Back to skill

Security audit

X Api

Security checks for vulnerabilities and agentic risk

Overview

This is a straightforward X posting skill, but users should understand it uses write-capable X credentials and a live posting command.

Install only if you are comfortable giving this skill write access to an X account. Use a dedicated or low-risk X app/token, review posts before running the command, avoid global npm installation, and prefer pinned dependencies with a lockfile.

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
scripts/package.json:5
Finding

Unpinned Third-Party Dependency Without Lockfile Integrity Controls

Content
View full analysis

Vulnerability Details

File Location: scripts/package.json:5-7
Vulnerability Type: T08: Insecure Dependencies
Risk Level: Medium

Vulnerable Code

json
"dependencies": {
  "twitter-api-v2": "^1.19.0"
}

Related installation instructions appear in README.md:33-36:

bash
cd ~/.clawdbot/skills/x-api/scripts
npm install

SKILL.md:47-51 also recommends a global installation:

bash
npm install -g twitter-api-v2

Technical Analysis

The dependency uses the mutable semantic-version range ^1.19.0, which permits npm to install later compatible releases. The project does not include a package lockfile or other integrity metadata. Therefore, dependency resolution and installed code can change after the skill has been reviewed.

An npm installation may also execute dependency lifecycle scripts with the privileges of the user running npm. The documented global installation increases the affected scope by installing the package outside the project-local dependency tree.

This is a supply-chain weakness rather than evidence that the currently declared package is malicious. Exploitation requires compromise or malicious replacement of a dependency version accepted by the range, registry resolution, or the package maintainer's publishing credentials.

Attack Path

  1. An attacker compromises the dependency's publishing account, registry delivery path, or another package in the resolved dependency tree.
  2. The attacker publishes or serves a malicious release compatible with ^1.19.0.
  3. A user follows the documentation and runs npm install or npm install -g twitter-api-v2.
  4. Because no lockfile and integrity-pinned dependency graph are present, npm resolves and downloads the changed package.
  5. Malicious code can execute through an npm lifecycle script during installation or when x-post.mjs imports and uses the dependency.
  6. At runtime, the malicious dependency m ...[truncated 918 chars]
Remediation
View remediation

Remediation Suggestions

  1. Replace the caret range with an exact, reviewed dependency version:
    json
    "twitter-api-v2": "1.19.0"
    
  2. Generate, review, and commit package-lock.json so that the complete dependency graph and package integrity hashes are recorded.
  3. Update the installation documentation to require reproducible local installation with npm ci rather than npm install.
  4. Remove the recommendation to install twitter-api-v2 globally. Keep the dependency scoped to the skill directory.
  5. Where package compatibility permits, install with lifecycle scripts disabled:
    bash
    npm ci --ignore-scripts
    
    If lifecycle scripts are required, review them before installation.
  6. Regularly audit direct and transitive dependencies, review lockfile changes during upgrades, and use automated vulnerability and provenance checks.
  7. Run installation and execution as an unprivileged user with access limited to the credential file and resources required by the skill.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
Findings (13)

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 27)May include surrounding context.

md
4. Get your keys from "Keys and tokens" tab:
   - API Key (Consumer Key)
   - API Key Secret (Consumer Secret)
   - Access Token
   - Access Token Secret

### 2. Configure Credentials

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 28)May include surrounding context.

md
4. Get your keys from "Keys and tokens" tab:
   - API Key (Consumer Key)
   - API Key Secret (Consumer Secret)
   - Access Token
   - Access Token Secret

### 2. Configure Credentials

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SKILL.md (reported line 99)May include surrounding context.

md
4. Get your keys from "Keys and tokens" tab:
   - API Key (Consumer Key)
   - API Key Secret (Consumer Secret)
   - Access Token
   - Access Token Secret

### 2. Configure Credentials

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/x-post.mjs (reported line 79)May include surrounding context.

js
try {
  const { data } = await client.v2.tweet(text);
  // Get username from the access token (first part before the dash is user ID)
  const userId = credentials.accessToken.split('-')[0];
  console.log(`✅ Posted: https://x.com/i/status/${data.id}`);
} catch (err) {

Session Persistence

Medium
Category
Rogue Agent
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.

Content

Scanner excerpt · README.md (reported line 21)May include surrounding context.

md
The X API isn't free:
- **Free tier**: 1,500 posts/month, but requires credits (pay-as-you-go)
- **Basic tier**: $100/month for higher limits
- You need to create a Developer account and app at [developer.x.com](https://developer.x.com)

## Installation

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The README tells users how to invoke a script that posts to X but does not clearly warn that executing the command will publish content publicly from the user's own account. In an agent-skill context, this can lead to unintended real-world actions, reputational harm, or accidental posting of sensitive or unreviewed content if a user or agent runs the command without explicit confirmation.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill documents use of environment variables and local secret files to access X API credentials, but it does not declare an explicit permission or allowed-tools scope for environment access. That creates an authorization ambiguity where an agent may access sensitive credentials without a clearly declared boundary, increasing the chance of unintended secret use.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
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.

Content

Scanner excerpt · SKILL.md (reported line 22)May include surrounding context.

md
### 1. Get API Credentials

1. Go to https://developer.x.com/en/portal/dashboard
2. Create a Project and App
3. Set App permissions to **Read and Write**
4. Get your keys from "Keys and tokens" tab:
   - API Key (Consumer Key)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill provides a posting command and examples but does not clearly warn that invoking it will publish content to a real X account. In an agent setting, this can lead to accidental live posting, reputational harm, spam, or policy violations because the action is irreversible and externally visible.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
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.

Content

Scanner excerpt · scripts/x-post.mjs (reported line 52)May include surrounding context.

js
export X_ACCESS_TOKEN="..."
  export X_ACCESS_SECRET="..."

Or create ~/.clawdbot/secrets/x-api.json:
  {
    "consumerKey": "...",
    "consumerSecret": "...",

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

This code performs an external API call that publishes user-supplied text to a third-party service, which is a safety-relevant network operation. Although success and failure are logged afterward, there is no prior confirmation prompt or explicit pre-action disclosure in the file before the post is sent.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
91% confidence
Finding

The dependency uses a caret range (^1.19.0), which permits automatic installation of newer 1.x releases rather than a single vetted version. This creates supply-chain risk because future upstream releases could introduce vulnerable or malicious code without a corresponding review or lockstep update in this skill.

Content

Scanner excerpt · scripts/package.json (reported line 6)May include surrounding context.

json
"version": "1.0.0",
  "type": "module",
  "dependencies": {
    "twitter-api-v2": "^1.19.0"
  }
}

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The manifest describes a skill for posting to X via the official API, but does not mention reading secrets from the filesystem. Accessing ~/.clawdbot/secrets/x-api.json and ./.x-api.json adds local file-reading capability beyond the core posting action, even though it is used only for credential discovery.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.