Back to skill

Security audit

analyzing-twitter-sentiment-for-topic

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent Twitter/X sentiment workflow, but its REST fallback exposes an Apify API token in a URL, which is risky enough to require review before installation.

Review before installing if you will use the REST fallback. Prefer Apify MCP or a request method that sends APIFY_TOKEN in an Authorization header, keep the token out of command histories and logs, use the least-privileged token available, and be aware that saved CSV or JSON outputs may persist collected tweet data locally.

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

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:116
Finding

API Token Exposed Through a Command-Line URL

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 116–122
Vulnerability Type: API credential exposure through a URL and process arguments
Risk Level: Medium

Vulnerable Code

bash
curl -X POST \
  "https://api.apify.com/v2/acts/apidojo~tweet-scraper/runs?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "searchTerms": ["[TOPIC_KEYWORD]"],
    "maxItems": 500,
    "tweetLanguage": "en",
    "since": "[YYYY-MM-DD]"
  }'

Technical Analysis

The documented REST fallback interpolates APIFY_TOKEN into the request URL. When the shell expands this variable, the secret becomes part of curl's command-line arguments and the complete request URL.

Command-line arguments may be visible to other local users or monitoring software through process-inspection facilities. Credential-bearing URLs may also be retained in application, reverse-proxy, API gateway, observability, or server access logs. TLS protects the URL while it is transmitted over the network, but it does not prevent exposure through local process inspection or endpoint-side logging.

Attack Path

  1. A user follows the documented REST fallback with a valid APIFY_TOKEN.
  2. The shell expands the token into curl's URL argument.
  3. A local process observer, monitoring agent, or user with access to relevant URL logs records the credential-bearing URL.
  4. The observer extracts the token from the token query parameter.
  5. The exposed token is replayed against the Apify API within the permissions and lifetime assigned to that token.

Impact Assessment

Successful exploitation discloses the Apify API token. An attacker could authenticate to Apify with the token's effective privileges, potentially start actor runs, consume paid platform resources, access resources available to that credential, and cause financial or operational impact. The exact scope is limited by the token's permissions, associated ...[truncated 59 chars]

Remediation
View remediation

Remediation Suggestions

Remove the token from the URL and transmit it in an authorization header:

bash
curl -X POST \
  "https://api.apify.com/v2/acts/apidojo~tweet-scraper/runs" \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "searchTerms": ["[TOPIC_KEYWORD]"],
    "maxItems": 500,
    "tweetLanguage": "en",
    "since": "[YYYY-MM-DD]"
  }'

Additionally:

  • Use a least-privilege token restricted to only the resources required by this Skill.
  • Store the token in a protected secret manager or environment variable rather than source-controlled files.
  • Ensure scripts and diagnostic output do not print authorization headers or environment variables.
  • Redact credentials in application, proxy, API gateway, and observability logs.
  • Rotate any token previously used in a query string if relevant process or request logs may have been accessible.
  • Configure expiration and periodic rotation where supported.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (7)

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The manifest says the skill triggers when a user asks to 'measure public opinion on Twitter,' 'research how Twitter reacts,' or similar broad phrasings. These are common-language requests without clear activation boundaries or exclusion conditions, which could cause unintended invocation outside a narrowly defined sentiment-analysis workflow.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill requires an APIFY_TOKEN and instructs transmission of it to an external service without any privacy or secret-handling guidance. While using an API token is expected for this workflow, omission of warnings increases the chance of accidental credential exposure in logs, shell history, screenshots, or unsafe execution environments.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The markdown explicitly recommends commands that save results as CSV or JSON files, but it does not warn that running them will create local output files containing collected tweet data. Under the markdown criteria, data-affecting behavior should be disclosed so users understand the persistence impact before using the skill.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
95% confidence
Finding

The skill explicitly instructs sending user-supplied search terms and an APIFY_TOKEN to a third-party endpoint. External transmission is inherent to the skill's purpose, but exposing the token in the URL query string is riskier because query parameters are commonly logged by shells, proxies, monitoring systems, and server access logs.

Content

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

REST API fallback:

bash
curl -X POST \
  "https://api.apify.com/v2/acts/apidojo~tweet-scraper/runs?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% 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 · SKILL.md (reported line 117)May include surrounding context.

REST API fallback:

bash
curl -X POST \
  "https://api.apify.com/v2/acts/apidojo~tweet-scraper/runs?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "searchTerms": ["[TOPIC_KEYWORD]"],

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

The instructions set 'Language (default: English)' as the default operating language for analysis, which imposes a locale choice rather than presenting a neutral default or explicit opt-in. The file does not justify this as a region-specific tool or clearly frame English-only behavior as optional.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

Both the MCP and REST examples set 'tweetLanguage' to 'en', reinforcing an English-only default in the skill's operational examples. Because the skill is described for 'any topic, brand, or event,' this can constitute a language/locale policy issue unless users are explicitly offered a choice or the limitation is justified.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.