Back to skill

Security audit

scraping-tweets-by-keyword

Security checks for vulnerabilities and agentic risk

Overview

The skill’s tweet-scraping purpose is coherent, but it documents Apify API token use in URL query strings and exposes broad external scraping options that users should review before installing.

Install only if you are comfortable sending tweet search terms, filters, and resulting datasets to Apify. Use a least-privilege Apify token where possible, avoid sensitive or confidential searches, and prefer Authorization headers or MCP-based token handling instead of the documented query-string curl examples.

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

Apify API Token Exposed in URL Query Strings

Content
View full analysis
"], "maxItems": 200}' ``` 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: ```bash curl "https://api.apify.com/v2/actor-runs/$RUN_ID/dataset/items?token=$APIFY_TOKEN&format=json" ``` ### Technical Analysis The documented REST workflow interpolates `APIFY_TOKEN` directly into three request URLs. Network access to Apify is necessary for the Skill's declared tweet-scraping functionality, but exposing the credential in a URL is not necessary. When these commands are executed, the expanded URLs may be observable in process arguments, shell history, terminal logging, proxy and gateway logs, monitoring platforms, debugging traces, or HTTP access logs. HTTPS protects the request in transit but does not prevent credential disclosure at these local or infrastructure-level observation points. This is an insecure credential-handling practice rather than evidence that the Skill intentionally sends data to an unrelated service. ### Attack Path 1. A user configures a valid `APIFY_TOKEN` and executes the documented `curl` commands. 2. The shell expands `$APIFY_TOKEN` inside each command-line URL. 3. The resulting URL is captured through shell history, process inspection, terminal recording, proxy logs, monitoring data, or service-side request logs. 4. An attacker with access to one of those records extracts the token. 5. The attacker submits authenticated requests to Apify using the exposed credential. 6. The attacker accesses resources or consumes services permitted by that token ...[truncated 710 chars]
Remediation
View remediation
"], "maxItems": 200}' ``` Apply the same header pattern to polling and dataset retrieval: ```bash curl \ -H "Authorization: Bearer $APIFY_TOKEN" \ "https://api.apify.com/v2/actor-runs/$RUN_ID" ``` ```bash curl \ -H "Authorization: Bearer $APIFY_TOKEN" \ "https://api.apify.com/v2/actor-runs/$RUN_ID/dataset/items?format=json" ``` 2. **Prevent accidental logging.** Do not print authorization headers, expanded environment variables, or complete authenticated requests in verbose output. Ensure CI, proxy, and application logs redact authorization values. 3. **Apply least privilege.** Use an Apify token restricted to only the actors, runs, and datasets required by this Skill, where supported. 4. **Rotate potentially exposed credentials.** Tokens previously used with the documented query-string commands should be revoked and replaced if URLs may have been retained in logs or shell history. 5. **Harden local secret storage.** Keep the token in a protected environment or secret manager. If a `.env` file is used, restrict its permissions and exclude it from version control. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (6)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill description does not warn users that their search terms and collection requests are transmitted to Apify, a third-party external service. This is dangerous because users may submit sensitive research topics, private investigative terms, or proprietary monitoring queries without informed consent about where that data is being sent.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The documented customMapFunction allows arbitrary JavaScript to be supplied as part of the actor input, which goes beyond simple tweet scraping and enables code-like behavior on scraped data. In an agent setting, this can create a path for untrusted user input to trigger arbitrary transformation logic in the external service, increasing the risk of misuse, data exfiltration, or unexpected execution semantics.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
84% confidence
Finding

This step explicitly sends user-provided search terms and request parameters to Apify over the network, which is an external data transmission. In the context of a scraping skill this is expected behavior, but it still creates privacy and data-governance risk if users are unaware that their queries and possibly sensitive collection targets leave the local environment.

Content

Scanner excerpt · SKILL.md (reported line 112)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": ["<query>"], "maxItems": 200}'

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 113)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": ["<query>"], "maxItems": 200}'

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 120)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": ["<query>"], "maxItems": 200}'

External Transmission

Medium
Category
Data Exfiltration
Confidence
79% confidence
Finding

Fetching dataset items from Apify returns externally processed content back into the environment, which can include sensitive scraped data and creates a clear third-party data flow. While aligned with the skill's purpose, this is still security-relevant because results may contain sensitive or policy-restricted content and users are not clearly warned about the external processing lifecycle.

Content

Scanner excerpt · SKILL.md (reported line 125)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

Static analysis

No suspicious patterns detected.