Back to skill

Security audit

X Analytics CLI

Security checks for vulnerabilities and agentic risk

Overview

The skill is coherent for X/Twitter analytics, but it asks users to globally install an unpinned third-party CLI that will handle OAuth credentials.

Install only if you trust the `x-analytics-cli` npm package and are comfortable giving it X OAuth credentials. Prefer a pinned, reviewed version, least-privilege X tokens, owner-only credential-file permissions, and a local or sandboxed install instead of a global install.

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
SKILL.md:27
Finding
Unpinned Global Installation of a Third-Party CLI## Vulnerability Details **File Location**: `SKILL.md`, lines 27-31 **Vulnerability Type**: Unpinned third-party dependency installed globally **Risk Level**: Medium ### Vulnerable Code ```markdown If the CLI is not installed, install it: ```bash npm install -g x-analytics-cli ``` ``` ### Technical Analysis The Skill instructs the agent to install the latest available version of `x-analytics-cli` globally from the npm registry. It does not pin a reviewed version, verify an integrity hash or package provenance, use a lockfile, or isolate the dependency within the project. Consequently, the code executed by this instruction may differ from the code that existed when the Skill was reviewed. npm installation can also execute package lifecycle scripts. Global installation increases exposure because those scripts and the resulting executable run with the installing user's privileges and become available outside the current project. This risk is especially relevant because the installed CLI is subsequently entrusted with four OAuth credentials and is expected to read them from environment variables, an explicit path, or `~/.config/x-analytics-cli/credentials.json`. The actual CLI implementation is not included in the audited project, so its network destinations and secret-handling behavior cannot be verified here. ### Attack Path 1. An attacker compromises the npm publisher account, package release process, or another component of the package's dependency chain. 2. The attacker publishes a malicious release under the existing `x-analytics-cli` package name. 3. A user or agent follows the Skill instruction and runs `npm install -g x-analytics-cli`. 4. npm downloads the mutable latest release and may execute attacker-controlled lifecycle scripts during installation. 5. The installed executable is then invoked through commands such as `x-analytics-cli me`. 6. The malicious package reads the OAuth credentials supplied thro ...[truncated 1234 chars]
Remediation
## Remediation Suggestions 1. Pin `x-analytics-cli` to an exact version that has been reviewed instead of installing the latest release. 2. Verify the package with an expected registry integrity hash and package provenance or signed release metadata. 3. Confirm that the npm artifact corresponds to the reviewed source repository and expected publisher. 4. Prefer a project-local dependency with a committed lockfile over a global installation. 5. Avoid executing dependency lifecycle scripts where compatible, such as by using npm's script-disabling controls. 6. Run the CLI with a minimally privileged operating-system account and restrict filesystem access where sandboxing is available. 7. Store `credentials.json` with owner-only filesystem permissions and grant the X credentials only the scopes required for read-only analytics. 8. Avoid passing credential values directly on command lines, where they could be exposed through shell history or process listings. 9. Document the CLI's permitted network destination and restrict outbound traffic to the official X API endpoints when practical. 10. Re-review the dependency before changing the pinned version.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (5)

Credential Access

High
Category
Privilege Escalation
Content
## Authentication

The CLI requires four OAuth 1.0a credentials: API Key, API Secret, Access Token, and Access Token Secret. Credentials are resolved in this order:

1. `--credentials <path>` flag (per-command)
2. Environment variables: `X_API_KEY`, `X_API_SECRET`, `X_ACCESS_TOKEN`, `X_ACCESS_TOKEN_SECRET`
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
1. `--credentials <path>` flag (per-command)
2. Environment variables: `X_API_KEY`, `X_API_SECRET`, `X_ACCESS_TOKEN`, `X_ACCESS_TOKEN_SECRET`
3. Auto-detected file: `~/.config/x-analytics-cli/credentials.json`

The credentials JSON file must contain these four fields:
Confidence
80% confidence
Finding
The skill documents automatic use of a local credentials file and a `--credentials` path, which normalizes direct credential access by the tool. In an agent setting, this is dangerous because the model may be induced to interact with or rely on sensitive credential locations without a strict boundary between using credentials for API calls and exposing, mishandling, or over-requesting secrets.

Credential Access

High
Category
Privilege Escalation
Content
## Error handling

- **"No credentials found"** -- ask the user to set up authentication via credentials file, environment variables, or `--credentials` flag
- **"Unauthorized"** -- the access token is invalid or expired; ask the user to regenerate tokens in the X Developer Portal
- **"Forbidden" / 403** -- the API access tier may not support the endpoint (e.g., search requires Basic tier)
- **Empty data** -- the query returned no results; check the search query syntax, date range, or whether the user/tweet exists
- **Rate limit errors** -- the X API has per-endpoint rate limits; wait and retry, or reduce request frequency
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Vague Triggers

Medium
Confidence
91% confidence
Finding
The manifest-style description lists triggers such as "Twitter user," "X API," "Twitter API," "X data," and "Twitter data" without clear scope boundaries or exclusion conditions. These phrases are broad enough to match many ordinary requests about Twitter/X, increasing the risk of unintended invocation.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The skill encourages sending user-supplied queries and potentially account-linked requests to the external X API, but it does not prominently warn that external network calls will be made using the user's OAuth credentials. This can lead to uninformed disclosure of user queries, account context, and authenticated metadata to a third-party service when the user may not realize the action leaves the local environment.

Static analysis

No suspicious patterns detected.