T09 · Insecure Skill Coding Practices
- Location
SKILL.md:86- Finding
Apify API Token Exposed in URL Query String
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:86
Vulnerability Type: Credential exposure through a URL query parameter
Risk Level: MediumComplete Code Snippet:
bash curl -X POST "https://api.apify.com/v2/acts/apidojo~instagram-scraper/runs?token=$APIFY_TOKEN" -H "Content-Type: application/json" -d '{"usernames": ["competitor_handle"], "maxItems": 50}'Technical Analysis
The documented REST fallback places
APIFY_TOKENin the request URL. When the shell expands this environment variable, the resulting command contains the plaintext credential in its command-line arguments.URLs may be captured by shell history, process inspection utilities, terminal session recording, HTTP client diagnostics, monitoring platforms, proxies, gateways, and server access logs. Query strings are especially likely to be logged as part of the request target. HTTPS protects the request in transit but does not prevent credential disclosure through these endpoints and local operational records.
Attack Path
- A user follows the documented fallback command with
APIFY_TOKENset. - The shell expands
$APIFY_TOKENinto the query string. - The complete URL is exposed to one or more local or remote logging and observation mechanisms.
- An attacker with access to such records extracts the token.
- The attacker submits authenticated requests to Apify using the compromised token.
- The attacker consumes resources or accesses actor runs and data within the token's granted permissions.
Exploitation depends on an attacker having access to a process view, command record, terminal capture, proxy log, server log, or similar telemetry containing the expanded URL.
Impact Assessment
Disclosure grants the attacker the same Apify API privileges assigned to the token. Depending on its scope, this may permit execution of actors, consumption of paid platform resources, access to run metadata or datasets, and ...[truncated 151 chars]
- A user follows the documented fallback command with
- 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~instagram-scraper/runs" \ -H "Authorization: Bearer $APIFY_TOKEN" \ -H "Content-Type: application/json" \ -d '{"usernames":["competitor_handle"],"maxItems":50}'In addition:
- Use a narrowly scoped token with only the permissions required for actor execution.
- Prevent command tracing and debug logs from recording authorization headers.
- Store the token in a protected secret manager or environment configuration rather than source files.
- Redact credentials from terminal recordings, CI logs, HTTP diagnostics, and monitoring telemetry.
- Rotate any token previously used with the query-string example if its disclosure cannot be ruled out.
- Review Apify usage and audit records for unauthorized actor runs or data access.
