Back to skill

Security audit

scraping-tweets-from-account

Security checks for vulnerabilities and agentic risk

Overview

This skill has a legitimate tweet-scraping purpose, but it teaches unsafe Apify token handling and its documented scraping scope is broader than its account-only framing.

Review before installing or using. The skill is not clearly malicious, but users should avoid the REST curl examples as written, prefer header-based or official Apify client authentication, use a limited and rotatable Apify token, and understand that requested handles, search filters, and scraped results are sent to Apify.

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:108
Finding

Apify API Token Exposed in URL Query Strings

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 108–120
Vulnerability Type: API credential exposure through URL query parameters
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 '{"twitterHandles": ["<handle>"], "maxItems": 200, "sort": "Latest"}'
bash
curl "https://api.apify.com/v2/actor-runs/$RUN_ID?token=$APIFY_TOKEN" | grep '"status"'
bash
curl "https://api.apify.com/v2/actor-runs/$RUN_ID/dataset/items?token=$APIFY_TOKEN&format=json"

Technical Analysis

The documented REST workflow expands APIFY_TOKEN directly into three request URLs. Although the requests use HTTPS and target the expected Apify API, URL-based credentials can be recorded in shell history, process-command listings, API gateway or proxy logs, server access logs, monitoring platforms, debugging output, and copied error reports.

This exposure is unnecessary because authentication can be carried in an HTTP authorization header. Therefore, the implementation does not follow least-privilege credential-handling practices even though the underlying network access is required for the Skill's declared tweet-scraping functionality.

No evidence was found that the token is deliberately transmitted to an unrelated endpoint or that the Skill performs malicious credential exfiltration.

Attack Path

  1. A user or Agent follows the documented REST fallback and executes one of the curl commands.
  2. The shell expands $APIFY_TOKEN into the URL passed as a command-line argument.
  3. The resulting URL may be captured in shell history, process telemetry, proxy logs, server logs, diagnostics, or command output.
  4. A local user, telemetry operator, log reader, or other party with access to one of those records retrieves the token.
  5. The party reuses the token against Apify APIs.
  6. The attacker can perform ope ...[truncated 397 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove token=$APIFY_TOKEN from every request URL.
  2. Use Apify's supported authorization-header mechanism, such as:
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 '{"twitterHandles": ["<handle>"], "maxItems": 200, "sort": "Latest"}'
  1. Apply the same header-based authentication to polling and dataset-retrieval requests.
  2. Use narrowly scoped, short-lived, and readily rotatable credentials where supported.
  3. Ensure commands, errors, and debug output redact authorization values.
  4. Review shell history, proxy logs, monitoring data, and CI logs for previously exposed tokens; rotate any token that may have been recorded.
  5. Inform users that account handles, search terms, and retrieved data are processed by the third-party Apify service.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • 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)

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The title and description frame the skill as scraping tweets from an account and exporting a public account's timeline. However, the inputs include searchTerms, keyword-style advanced queries, geolocation filters, reply/mention filters, verification filters, and media-type filters, which describe a broader search capability than just account timeline scraping.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill instructs use of an APIFY_TOKEN and sends user-supplied targets and query parameters to a third-party service without a clear user-facing disclosure about external transmission and credential handling. This is dangerous because users may unknowingly cause data to be sent off-platform, and the examples also normalize passing sensitive tokens in ways that can leak via logs, shell history, or process inspection.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
97% confidence
Finding

This command transmits data to an external service and includes the APIFY_TOKEN directly in the URL query string. Putting secrets in URLs is dangerous because URLs are commonly captured in shell history, proxy logs, browser history, observability tools, and server-side request logs, increasing the chance of credential leakage.

Content

Scanner excerpt · SKILL.md (reported line 107)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 '{"twitterHandles": ["<handle>"], "maxItems": 200, "sort": "Latest"}'

External Transmission

Medium
Category
Data Exfiltration
Confidence
89% confidence
Finding

The referenced api.apify.com endpoint confirms that the skill sends requests to a third-party external service. In this skill context that is expected functionality, but it is still security-relevant because user queries and scraping targets leave the local environment and may be subject to third-party storage, logging, or policy controls.

Content

Scanner excerpt · SKILL.md (reported line 108)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 '{"twitterHandles": ["<handle>"], "maxItems": 200, "sort": "Latest"}'

External Transmission

Medium
Category
Data Exfiltration
Confidence
97% confidence
Finding

This polling request again places APIFY_TOKEN in the URL while contacting an external service. Repeated use of query-string secrets broadens exposure across logs and monitoring systems and can allow unauthorized use of the Apify account if the token is recovered.

Content

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

Save id as RUN_ID. Poll until status = SUCCEEDED:

bash
curl "https://api.apify.com/v2/actor-runs/$RUN_ID?token=$APIFY_TOKEN" | grep '"status"'

Fetch results:

External Transmission

Medium
Category
Data Exfiltration
Confidence
97% confidence
Finding

The dataset fetch request retrieves scraped results from a third-party service while embedding APIFY_TOKEN in the URL. This creates the same credential leakage risk and additionally exposes fetched dataset access through any system that records request URLs.

Content

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

Fetch results:

bash
curl "https://api.apify.com/v2/actor-runs/$RUN_ID/dataset/items?token=$APIFY_TOKEN&format=json"

Step 3: Handle Edge Cases

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The progress checklist lists 'Step 1: Confirm account is public', suggesting a real validation action before running the actor. The subsequent 'Validate Input' section only strips @ from the username and notes that private accounts return 0 results, which contradicts the claimed confirmation step.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.