Back to skill

Security audit

scraping-instagram-location-posts

Security checks for vulnerabilities and agentic risk

Overview

This skill is a coherent Apify-backed Instagram location scraper, with clear third-party API use but some token-handling and privacy cautions.

Install only if you are comfortable sending Instagram location targets and retrieved post metadata through Apify/apidojo. Set explicit maxItems limits, handle collected author/caption metadata responsibly, and prefer Authorization headers or a managed Apify tool over copying token-bearing URLs into shells, logs, or chats.

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

Apify API Token Exposed in URL Query Strings and Process Arguments

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 77–89
Vulnerability Type: Credential exposure through URL query parameters and command-line arguments
Risk Level: Medium

Vulnerable Code

bash
curl -X POST \
  "https://api.apify.com/v2/acts/apidojo~instagram-location-scraper/runs?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"locationIds": ["<LOCATION_ID>"], "maxItems": 100}'
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 REST fallback embeds APIFY_TOKEN directly in URL query strings. Although the requests use HTTPS and target the expected Apify API domain, the shell expands the environment variable before launching curl. Consequently, the secret may appear in process command-line arguments and can also be retained in shell tracing, terminal recordings, diagnostic output, proxy telemetry, server access logs, or copied command output.

Authentication is necessary for the Skill's declared cloud-scraping operation, but placing the credential in the URL is not the least-exposure mechanism. An authorization header can authenticate the same requests without placing the secret in the URL.

Attack Path

  1. A user or Agent follows the documented REST fallback with APIFY_TOKEN set.
  2. The shell expands $APIFY_TOKEN into each request URL.
  3. A local user, process-monitoring system, shell tracer, logging intermediary, or other telemetry component records the command line or complete URL.
  4. An attacker with access to that record extracts the token.
  5. The attacker reuses the token against Apify APIs until it is revoked or expires.

This path depends on an attacker having access to process metadata or relevant logs; the document does not itself transmit the to ...[truncated 684 chars]

Remediation
View remediation

Remediation Suggestions

  • Send the token through Apify's supported authorization header instead of a query parameter:

    bash
    curl -X POST \
      "https://api.apify.com/v2/acts/apidojo~instagram-location-scraper/runs" \
      -H "Authorization: Bearer $APIFY_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{"locationIds": ["<LOCATION_ID>"], "maxItems": 100}'
    
  • Apply the same header-based authentication to polling and dataset retrieval requests.

  • Never print, log, or echo the token or a complete authenticated request.

  • Disable shell tracing such as set -x while processing credentials.

  • Use a narrowly scoped token where Apify supports applicable permission restrictions.

  • Rotate the token immediately if commands containing it may have been captured in process telemetry or URL logs.

  • Redact credentials from application, proxy, CI/CD, and support logs.

  • Keep the token in a protected secret store or environment variable and avoid storing it in source files or command history.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (5)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill sends user-supplied Instagram location identifiers and receives scraped post data through Apify/Apidojo, but the description does not warn users that their inputs and resulting data are transmitted to a third-party service. This creates a transparency and privacy issue because users may unknowingly disclose sensitive targets, search intent, or collected content metadata to an external processor.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
88% confidence
Finding

This command explicitly posts data to Apify's API, transmitting location IDs and authentication credentials to an external service. In context, the transmission is expected functionality, but it is still security-relevant because the skill enables third-party data transfer and uses a bearer-equivalent API token that could be exposed through logs, shell history, or unsafe handling.

Content

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

REST API fallback:

bash
curl -X POST \
  "https://api.apify.com/v2/acts/apidojo~instagram-location-scraper/runs?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"locationIds": ["<LOCATION_ID>"], "maxItems": 100}'

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 85)May include surrounding context.

REST API fallback:

bash
curl -X POST \
  "https://api.apify.com/v2/acts/apidojo~instagram-location-scraper/runs?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"locationIds": ["<LOCATION_ID>"], "maxItems": 100}'

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 92)May include surrounding context.

REST API fallback:

bash
curl -X POST \
  "https://api.apify.com/v2/acts/apidojo~instagram-location-scraper/runs?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"locationIds": ["<LOCATION_ID>"], "maxItems": 100}'

External Transmission

Medium
Category
Data Exfiltration
Confidence
85% confidence
Finding

Fetching dataset items from Apify transfers scraped Instagram post metadata from a third-party platform back to the user, confirming that collected content is stored and processed externally. This is expected for the skill's purpose, but it is still a real data-handling risk because results may include personal or sensitive metadata and are retrieved through a third-party service using an API token.

Content

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