Back to skill

Security audit

X tweet publisher

Security checks for vulnerabilities and agentic risk

Overview

This skill is a straightforward X/Twitter posting tool that uses user-provided API credentials for its stated purpose, with some install and caution notes but no hidden or deceptive behavior found.

Install only if you are comfortable giving the tool X API credentials with write access. Use a dedicated X app/token with the minimum permissions needed, review tweet text and media before running the command because it posts live, and prefer installing Tweepy in an isolated pinned environment rather than using the unpinned `--user` install command.

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:26
Finding
Unpinned Third-Party Tweepy Dependency## Vulnerability Details **File Location**: `SKILL.md:26`, `scripts/x_publisher.py:15-19`, and `scripts/x_publisher.py:285-288` **Vulnerability Type**: Unpinned third-party dependency **Risk Level**: Medium ### Vulnerable Code `SKILL.md:26`: ```bash pip3 install tweepy --user ``` `scripts/x_publisher.py:15-19`: ```python try: import tweepy TWEEPY_AVAILABLE = True except ImportError: TWEEPY_AVAILABLE = False print("⚠️ tweepy 库未安装,请先运行: pip3 install tweepy --user") ``` `scripts/x_publisher.py:285-288`: ```python if not TWEEPY_AVAILABLE: print("\n❌ 请先安装 tweepy:") print(" pip3 install tweepy --user") return ``` ### Technical Analysis The documented and programmatically displayed installation command installs `tweepy` without a version constraint or integrity hash. Consequently, the code that executes when `tweepy` is imported is determined by whichever package release the package index resolves at installation time rather than by a reviewed, reproducible dependency set. This creates a supply-chain risk: a future compromised, malicious, or unexpectedly incompatible release could execute arbitrary Python code during import or API initialization. The use of `--user` also installs the package into the user's shared Python environment rather than an isolated project environment, increasing the dependency's reach and the likelihood of affecting other Python applications run by the same user. Tweepy receives the X API key, API secret, access token, access-token secret, and optional bearer token during normal client initialization. A compromised release would therefore be positioned to read these values directly, in addition to accessing other files and environment variables available to the invoking user. ### Attack Path 1. An attacker compromises the upstream Tweepy distribution channel or causes a malicious release to become the version resolved by the package installe ...[truncated 1658 chars]
Remediation
## Remediation Suggestions 1. Pin Tweepy to a specifically reviewed version in a dependency file, for example: ```text tweepy==REVIEWED_VERSION ``` 2. Generate and verify cryptographic hashes for all resolved packages. Install using a hash-locked requirements file: ```bash python3 -m pip install --require-hashes -r requirements.txt ``` 3. Include and pin all transitive dependencies through a lock-file workflow such as `pip-tools`, rather than pinning only the direct dependency. 4. Replace the instructions and error messages with installation commands that reference the reviewed dependency file: ```bash python3 -m venv .venv . .venv/bin/activate python3 -m pip install --require-hashes -r requirements.txt ``` 5. Avoid `--user` installation. Use a dedicated virtual environment to prevent the dependency from modifying or being inherited by unrelated user-level Python applications. 6. Review dependency updates before changing the lock file, and use automated vulnerability and provenance checks for each resolved artifact. 7. Run the publisher under a dedicated, least-privileged account or constrained environment, exposing only the X credentials and media files required for the publishing operation.
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (11)

Credential Access

High
Category
Privilege Escalation
Content
---
name: X-Publisher
description: Publish tweets to X (Twitter) using the official Tweepy library. Supports text-only tweets, tweets with images or videos, and returns detailed publish results including tweet ID and URL. Requires X API credentials (API Key, API Secret, Access Token, Access Token Secret).
env:
  - X_API_KEY
  - X_API_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
---
name: X-Publisher
description: Publish tweets to X (Twitter) using the official Tweepy library. Supports text-only tweets, tweets with images or videos, and returns detailed publish results including tweet ID and URL. Requires X API credentials (API Key, API Secret, Access Token, Access Token Secret).
env:
  - X_API_KEY
  - X_API_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
---
name: X-Publisher
description: Publish tweets to X (Twitter) using the official Tweepy library. Supports text-only tweets, tweets with images or videos, and returns detailed publish results including tweet ID and URL. Requires X API credentials (API Key, API Secret, Access Token, Access Token Secret).
env:
  - X_API_KEY
  - X_API_SECRET
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Lp3

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding
The skill requests sensitive environment variables but does not declare any explicit tool scope or permissions boundary. That makes the skill's capabilities less transparent to users and reviewers, increasing the chance that credentialed functionality is invoked without clear authorization expectations.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The documentation explains how to run the tweet command but does not prominently warn that execution will immediately publish content publicly to the user's X account. This can cause unintended public posting, reputational damage, or accidental disclosure if a user assumes it is a preview or draft operation.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The markdown includes a direct `client.delete_tweet("tweet_id")` example, which performs an irreversible destructive action, but the surrounding documentation does not warn users about deletion impact or recommend confirmation before use. For markdown files, destructive behaviors that may affect user data or account state should be disclosed explicitly.

Natural-Language Policy Violations

Low
Confidence
88% confidence
Finding
SQP-3 applies to natural-language policy issues across all file types, including markdown. This skill's user-facing instructions are effectively fixed to Chinese, and the file does not indicate that the user can choose another language or that the locale constraint is intentional and justified.

Natural-Language Policy Violations

Low
Confidence
89% confidence
Finding
The entire skill reference is presented in Chinese, and there is no indication that the user can choose another language or that the locale restriction is intentional and justified. This can constitute a language-policy issue when a skill forces a specific language without user opt-in.

Natural-Language Policy Violations

Low
Confidence
97% confidence
Finding
This code's title, help text, prompts, and status/error messages are presented in Chinese only, indicating a fixed language policy for all users. The audit rules treat forced language/locale behavior without user opt-in as a natural-language policy violation.

Description-Behavior Mismatch

Low
Confidence
80% confidence
Finding
The manifest describes a skill for publishing tweets and returning publish results, but the code also fetches the authenticated account's profile and metrics such as follower count, following count, and tweet count. While used for verification, this is still additional account-read behavior not reflected in the description.

Description-Behavior Mismatch

Low
Confidence
86% confidence
Finding
The manifest says the skill publishes tweets with optional media and returns publish results, but the code exposes a separate `verify` command that validates credentials independently of publishing. This is a functional capability not mentioned in the stated skill description.

Static analysis

No suspicious patterns detected.