Back to skill

Security audit

Apitweet CLI

Security checks for vulnerabilities and agentic risk

Overview

This is a real Twitter/X CLI skill, but it needs review because it handles persistent account credentials, performs live social-account actions, and can forward credentials to broad or arbitrary request destinations.

Install only if you are comfortable giving this CLI access to ApiTweet and Twitter/X credentials and using it for live account actions. Prefer isolated config directories, avoid shared machines and CI runners, use dry-run before every write, do not use custom base URLs or full URLs with saved credentials, and avoid the unpinned npx install paths unless you have verified the package provenance.

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 (4)

T09 · Insecure Skill Coding Practices

Error
Location
src/request.js:16
Finding

Credentials Can Be Transmitted to Arbitrary or Plaintext HTTP Destinations

Content
View full analysis
"); await performRequest(state, config, { method: state.method, path: requestPath, body: state.data, }); } export async function runCommand(state, config) { const [command] = state.commandArgs; if (!command) { return false; } if (command.startsWith("/") || /^https?:\/\//i.test(command)) { await handleGenericRequest(state, config, state.commandArgs); return true; } ``` ### Technical Analysis The request destination can be controlled through `--base-url`, `APITWEET_BASE_URL`, a saved application profile, or an absolute URL passed to the generic request interface. The implementation accepts both HTTP and HTTPS destinations and performs no origin allowlisting or destination validation. `performRequest` then adds the config ...[truncated 1916 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
src/config.js:29
Finding

High-Value Credentials Are Persisted Without Restrictive File Permissions

Content
View full analysis
--api-key [--base-url ]"); } const baseUrl = (findOption(args, "--base-url") || DEFAULT_BASE_URL).replace(/\/+$/, ""); config.apps[name] = { apiKey, baseUrl }; if (!config.currentApp || hasFlag(args, "--use")) { config.currentApp = name; } await saveConfig(state.configDir, config); ``` ```js // src/config.js:225-245 export async function handleAuthProfilesCommand(state, config, args) { const action = args[2]; if (action === "add") { const name = findOption(args, "--name"); const cookie = findOption(args, "--cookie"); const authToken = findOption(args, "--auth-token"); const ct0 = findOption(args, "--ct0"); if (!name || (!cookie && !authToken)) { exitWithError("Usage: apitweet auth profiles add --name [--cookie | --auth-token ] [--ct0 ]"); } config.profiles[name] = { ...(cookie ? { cookie } : {}), ...(authToken ? { authToken } : {}), ...(ct0 ? { ct0 } : {}), }; if (!config.currentProfile || hasFlag(args, "--use")) { config.currentProfile = name; } await saveConfig(state.configDir, config); ``` ### Technical Analysis The ...[truncated 1879 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
src/commands.js:58
Finding

Twitter/X Authentication Token Is Embedded in a Request URL

Content
View full analysis
[--save-as ] [--ct0 ]"); const saveAs = findOption(args, "--save-as"); const response = await performRequest(state, config, { method: "GET", path: `/twitter/${encodeURIComponent(authToken)}/cookie`, silent: Boolean(saveAs), }); if (state.dryRun || !saveAs) { return; } ``` ### Technical Analysis The `auth_token` is interpolated directly into the URL path. `encodeURIComponent` prevents path-delimiter injection but does not protect confidentiality: the encoded token remains recoverable from the URL. URLs are routinely captured by reverse-proxy access logs, API gateways, web-server logs, tracing systems, monitoring platforms, browser or client diagnostics, and error telemetry. GET requests may also receive broader caching and observability treatment than credential-bearing POST requests. The documentation recognizes that the token appears in the path, but this workflow still exposes a reusable account credential to infrastructure that does not need it. ### Attack Path 1. A user runs `apitweet auth cookie --auth-token `. 2. The CLI constructs a GET path containing the complete encoded token. 3. The request traverses proxies, gateways, load balancers, or observability systems. 4. One or more systems record the URL path. 5. An attacker or unauthorized operator with log access extracts and decodes the token. 6. The attacker attempts to reuse the token directly or combines it with other session data to perform account operations. ### Impact Assessment A leaked token may permit: - Twitter/X session impersonation or ...[truncated 424 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
README.md:116
Finding

Documentation Recommends Unpinned Remote Installer Execution

Content
View full analysis
Remediation
View remediation
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 (19)

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

Direct message sending is a sensitive outbound communication action, yet the command sends messages immediately with no explicit warning, approval checkpoint, or recipient verification. In agent use, this creates a strong risk of data leakage, harassment, spam, or impersonation through unintended messages sent from the user's account.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The generic request path accepts any raw path or full URL and forwards it through performRequest, which can bypass the intended command-level safety boundaries. In an agent setting, this enables arbitrary outbound requests or access to undeclared endpoints, greatly expanding the blast radius beyond the stated Twitter/X CLI functionality.

Content

No source excerpt is available for this finding.

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 · src/help.js (reported line 83)May include surrounding context.

js
Global options should be placed before the command.
  Saved apps store API keys and base URLs.
  Saved profiles store cookies or auth_token values for write actions.
  Get API keys from https://apitweet.com/dashboard.
  Copy the API key from the dashboard and save it with auth apps add.
`);
}

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 3)May include surrounding context.

md
# apitweet-cli

> apitweet-cli is a Node.js command-line client for ApiTweet Twitter/X endpoints. It helps developers and AI agents fetch Twitter/X data, manage API credentials, preview write actions, publish X Articles from Markdown, and automate common X workflows from the terminal.

## Quick facts

Rp1

Medium
Category
MCP Rug Pull
Confidence
92% confidence
Finding

The README instructs users to execute a remote package via npx skills add aliraza948/apitweet without pinning an exact package version or immutable source. Because npx resolves and runs code at install time, a compromised upstream package, renamed package, or malicious update could lead to arbitrary code execution on the user's machine or agent environment.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
92% confidence
Finding

The command npx clawhub@latest install apitweet-cli explicitly tracks the latest version, which is mutable and causes execution of whatever code is currently published. In a skill context, this is especially risky because users or agents may copy-paste the command into trusted environments, enabling supply-chain compromise and arbitrary code execution if the package or distribution channel is hijacked.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
84% confidence
Finding

The skill describes use of networked CLI operations and handling of environment/config-based credentials, but it does not declare any explicit tool scope such as allowed tools or permissions. In an agent setting, this weakens containment by making it less clear which external actions and secret-bearing channels are intended, increasing the risk of unintended network access or credential exposure during execution.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
88% confidence
Finding

The skill explicitly instructs the agent to rely on saved profiles, persistent config in ~/.apitweet/config.json, and stored cookies/auth tokens in plain JSON for write actions. This creates session persistence across runs and users, which can lead to credential reuse, cross-task contamination, or unauthorized actions if the environment is shared or later compromised.

Content

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

md
1. Confirm the CLI is available.
2. Make sure an app config or API key is available for read requests.
3. Make sure a saved profile or explicit cookie is available for write requests.
4. Prefer convenience commands first.
5. Fall back to `apitweet <path>` only when no convenience command fits.
6. Use `--dry-run` before real write actions unless the user explicitly asks to execute them.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The skill metadata is broad enough that it could be implicitly invoked for generic CLI or Twitter/X-related requests, especially because the display name, description, and default prompt all overlap with common installation, configuration, and command-execution workflows. In combination with allow_implicit_invocation: true, this increases the chance of unintended activation in contexts involving credentials, local config, or outbound API actions, which can lead to overreach or unsafe handling of sensitive operations.

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 · claude-plugin/apitweet-cli/skills/apitweet-cli/SKILL.md (reported line 24)May include surrounding context.

md
1. Confirm the CLI is available.
2. Make sure an app config or API key is available for read requests.
3. Make sure a saved profile or explicit cookie is available for write requests.
4. Prefer convenience commands first.
5. Fall back to `apitweet <path>` only when no convenience command fits.
6. Use `--dry-run` before real write actions unless the user explicitly asks to execute them.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The article publishing workflow reads a local file and then performs a multistep live publish sequence without an explicit user confirmation before publication. In an agent setting, this combines local file access with public posting, increasing the risk of accidental disclosure or unauthorized publication of sensitive content.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The profile update command can change public account identity fields and images without any confirmation, allowing accidental or manipulated modifications to the user's visible profile. Because profile data affects identity and trust, silent changes can cause reputational harm and account confusion.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill metadata frames this as a CLI for calling apitweet endpoints, but the implementation includes high-impact account-mutating operations such as tweet creation, DMs, follows, profile updates, list creation, and article publishing. This scope expansion is dangerous because an agent or user may invoke the skill expecting low-risk API access while actually being granted direct authority to act on a Twitter/X account.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Tweet like/bookmark/retweet and related actions execute immediately with account credentials and no user-facing confirmation, making accidental or prompt-induced account activity easy. In an agent workflow, silent execution of social actions can cause reputation harm, unintended endorsements, or automation abuse.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

Follow and unfollow modify account relationships immediately using stored credentials without any warning or confirmation step. This is risky in an agent environment because a misunderstood instruction or malicious prompt could silently alter the user's network and public account behavior.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The code persists API keys, cookies, auth tokens, and ct0 values directly to a JSON config file on disk with no permission hardening, encryption, or user-facing warning. In a CLI whose purpose is to manage authentication for Twitter/X, these values are highly sensitive and local disclosure through shared accounts, backups, or lax filesystem permissions could enable account or API misuse.

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 · src/help.js (reported line 17)May include surrounding context.

js
# Twitter/X Lists
  apitweet [global options] list search --query <text> [--count <n>]       # Search for lists
  apitweet [global options] list create --name <n> --desc <t> [--private]  # Create a new list
  apitweet [global options] list members <list_id> [--count <n>]           # List members in a list
  apitweet [global options] list subscribers <list_id> [--count <n>]       # List list subscribers

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The help text explicitly instructs users to save API keys, cookies, and auth_token values, but provides no warning that these are highly sensitive credentials or that shell history, process lists, screenshots, and shared terminals can expose them. In a CLI focused on Twitter/X account actions, encouraging direct credential entry and persistence increases the risk of credential theft and unauthorized account access.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

The function reads APITWEET_KEY and APITWEET_BASE_URL from process.env, including a credential-like environment variable, without any nearby warning, comment, or user-facing notice. For safety review purposes, access to sensitive environment variables should be disclosed so users understand that local credentials may be consumed automatically.

Content

No source excerpt is available for this finding.