Back to skill

Security audit

twitter-autopilot-zh

Security checks for vulnerabilities and agentic risk

Overview

This Twitter/X automation skill is not clearly malicious, but it needs review because it can perform live account actions and exposes its AISA API key in normal outputs and relay requests.

Install only if you trust the AISA relay and are comfortable with an agent performing live Twitter/X actions. Avoid using the status or posting tools with a real key until the skill stops printing AISA_API_KEY, restricts relay destinations to trusted HTTPS hosts, and requires clear confirmation before post, like, follow, or unfollow actions.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/twitter_oauth_client.py:337
Finding

API Key Disclosed in Command Output and Structured Results

Content
View full analysis
None: config = load_config(args) response = { "ok": True, "relay_base_url": config["base_url"], "aisa_api_key": config["aisa_api_key"], "timeout": config["timeout"], "supported_commands": ["authorize", "post", "status"], "supported_endpoints": ["/auth_twitter", "/post_twitter"], "media_upload": { "field_name": "media_files", "transport": "multipart/form-data", "supported_media_types": ["image/*", "video/*"], }, } print(json.dumps(response, indent=2, ensure_ascii=False)) ``` The engagement client contains the same issue: ```python def command_status(args: argparse.Namespace) -> None: config = load_config(args) response = { "ok": True, "relay_base_url": config["base_url"], "aisa_api_key": config["aisa_api_key"], "timeout": config["timeout"], "supported_commands": [ ...[truncated 2403 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/twitter_oauth_client.py:43
Finding

Configurable Relay Allows API Key Transmission to Arbitrary Hosts over Plaintext HTTP

Content
View full analysis
str: value = base_url.strip().rstrip("/") if not value: raise RelayConfigError("TWITTER_RELAY_BASE_URL is required.") parsed = urllib.parse.urlparse(value) if parsed.scheme not in {"http", "https"} or not parsed.netloc: raise RelayConfigError("TWITTER_RELAY_BASE_URL must be a valid http(s) URL.") return value ``` ```python def load_config(args: argparse.Namespace) -> Dict[str, Any]: base_url = normalize_base_url( get_env("TWITTER_RELAY_BASE_URL", DEFAULT_BASE_URL) ) aisa_api_key = getattr(args, "aisa_api_key", None) or get_env("AISA_API_KEY") timeout = getattr(args, "timeout", None) or int( get_env("TWITTER_RELAY_TIMEOUT", str(DEFAULT_TIMEOUT)) ) if not aisa_api_key: raise RelayConfigError("AISA_API_KEY is required.") return { "base_url": base_url, "aisa_api_key": aisa_api_key, "timeout": timeout, } ``` ```python def build_auth_headers( aisa_api_key: str, extra_headers: Optional[Dict[str, str]] = None, ) -> Dict[str, str]: headers = { "Authorization": f"Bearer {aisa_api_key}", "User-Agent": DEFAULT_CHROME_USER_AGENT, } if extra_headers: headers.update(extra_headers) return headers ``` ```python def send_json_request( url: str, payload: Dict[str, Any], timeout: int, aisa_api_key: str, ) -> Dict[str, Any]: request = urllib.request.Request( url, data=json.dumps(payload).encode("utf-8"), headers=build_auth_headers( aisa_api_key, {"Cont ...[truncated 3309 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/twitter_client.py:62
Finding

Bearer API Key Is Redundantly Embedded in Request Bodies

Content
View full analysis
Dict[str, Any]: payload: Dict[str, Any] = { "aisa_api_key": config["aisa_api_key"], } if content: payload["content"] = content if post_type: payload["type"] = post_type if media_ids: payload["media_ids"] = media_ids if parent_tweet_id: parent_key = ( "in_reply_to_tweet_id" if post_type == "reply" else "quote_tweet_id" ) payload[parent_key] = parent_tweet_id ``` Authorization duplicates the credential in the same manner: ```python def command_authorize(args: argparse.Namespace) -> None: config = load_config(args) payload = {"aisa_api_key": config["aisa_api_key"]} result = send_json_request( f"{config['base_url']}/auth_twitter", payload, timeout=co ...[truncated 2468 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (20)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

This finding shows inconsistent documentation around both missing read features and partially described write features such as OAuth publishing/media upload. In a skill that can touch external social accounts, ambiguous capability statements can cause over-privileging, unsafe invocation, or accidental account actions under false assumptions.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

This finding shows inconsistent documentation around both missing read features and partially described write features such as OAuth publishing/media upload. In a skill that can touch external social accounts, ambiguous capability statements can cause over-privileging, unsafe invocation, or accidental account actions under false assumptions.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

This finding shows inconsistent documentation around both missing read features and partially described write features such as OAuth publishing/media upload. In a skill that can touch external social accounts, ambiguous capability statements can cause over-privileging, unsafe invocation, or accidental account actions under false assumptions.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The status command returns the configured AISA API key in plaintext JSON, which exposes a live secret unrelated to the minimum functionality needed for Twitter engagement actions. Any user, agent, log collector, or downstream tool invoking status can retrieve and reuse that credential to access the relay service or impersonate the skill's authorized actions.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

This is a direct secret disclosure path because the command emits the API key to user-visible output without masking or access control. In an agent setting, this is especially dangerous because users can naturally ask for status/configuration, causing the agent to exfiltrate the secret verbatim in its response or tool output.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The authorize/post flows include the raw AISA API key in JSON output, exposing a bearer credential beyond what is required to complete Twitter authorization or posting. Because command output is frequently logged, returned to higher-level orchestrators, or shown to end users, this directly increases the chance of credential theft and relay-account abuse.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The README explicitly advertises account-affecting actions such as posting, liking, following, and replying, but it does not prominently warn that these operations can cause real external side effects on a user's Twitter/X account. In an agentic context, this increases the risk that an operator or downstream agent invokes the skill without realizing it can perform live social actions, leading to unintended posts, follows, or engagement under user credentials.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding

The skill declares access to an environment secret and relies on networked Python clients, but it does not explicitly constrain permissions or allowed tools. In an agent setting, missing scope boundaries can let the skill be invoked more broadly than intended and increase the chance of secret exposure or unintended network actions.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The trigger description is very broad and can match many ordinary social-media requests, causing the agent to select this skill in situations where a narrower or safer tool would be preferable. Because the skill can access network resources and potentially interact with external accounts, over-invocation increases the chance of unintended account actions or unnecessary secret use.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

Repeating a vague 'when to use' condition reinforces overly broad routing guidance without adding operational boundaries. In context, this makes the skill more dangerous because it is a social-media automation workflow tied to API credentials and possible OAuth-based actions.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The manifest sets the language to "zh", which indicates a fixed locale selection in metadata. There is no accompanying indication of user choice, opt-in, or justification for a locale restriction, so this appears to violate the language/locale policy requirement.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The top-level docstring and CLI description at startup describe the tool as 'read APIs', which communicates a read-only intent. In contrast, _request has explicit logic for POST requests and mutates outbound request bodies by attaching authentication material, contradicting that documented intent rather than merely omitting detail.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module docstring explicitly describes 'Twitter/X read APIs' and documents only read usage, implying a read-only client. However, the core _request method contains POST support and injects aisa_api_key into POST bodies, which is write-capable plumbing inconsistent with the stated read-only scope even though this file's CLI currently exposes only GET operations.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The plaintext JSON status response creates an easy data-leak path through normal conversational use: an agent can call the command and summarize or quote the secret back to the user. Because this skill is explicitly designed for agent-driven social-media automation, the context increases exposure by making tool outputs likely to be surfaced in natural language, logs, traces, or debugging transcripts.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/twitter_client.py (reported line 36)May include surrounding context.

python
DEFAULT_TIMEOUT = 30
DEFAULT_BASE_URL = "https://api.aisa.one/apis/v1/twitter"
DEFAULT_CHROME_USER_AGENT = (
    "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
    "AppleWebKit/537.36 (KHTML, like Gecko) "

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/twitter_oauth_client.py (reported line 27)May include surrounding context.

python
DEFAULT_TIMEOUT = 30
DEFAULT_BASE_URL = "https://api.aisa.one/apis/v1/twitter"
DEFAULT_CHROME_USER_AGENT = (
    "Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
    "AppleWebKit/537.36 (KHTML, like Gecko) "

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

Echoing a sensitive API key in normal command output without masking or warning is a concrete secret-handling flaw, not just a UX issue. In this skill's context, the tool is designed for automation and relay-based posting, which makes captured output especially likely to transit through logs, traces, or agent memory where the credential can be reused.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
99% confidence
Finding

The status command prints the live AISA API key back to stdout, which creates an unnecessary secret disclosure channel. In agent, CI, terminal-sharing, or logging contexts, stdout is often captured or exposed, so this can leak the credential to downstream tools or observers and enable unauthorized use of the relay service.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

This code sends usernames, tweet IDs, search queries, and similar inputs to https://api.aisa.one via network requests, which is a privacy-relevant operation under the warning criteria for code files. Although the module docstring mentions read APIs and bearer auth, there is no runtime disclosure, prompt, or comment near the request path warning that user-provided data is sent to a third-party service.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

The script launches the system browser when --open-browser is used, but there is no runtime notice beyond the flag name that an external authorization URL will be opened. For code-file warning requirements, subprocess-like or externally acting operations should have a visible disclosure when they affect the user's system state or workflow.

Content

No source excerpt is available for this finding.