T09 · Insecure Skill Coding Practices
- Location
SKILL.md:87- Finding
API Token Exposed in URL Query Parameters
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 87–90
Vulnerability Type: API credential exposure through command-line URL arguments
Risk Level: MediumVulnerable Code
bash # Instagram curl -X POST "https://api.apify.com/v2/acts/apidojo~instagram-scraper/runs?token=$APIFY_TOKEN" -H "Content-Type: application/json" -d '{"keywords": ["#italianrecipes", "#italianfood"], "maxItems": 100}' # TikTok curl -X POST "https://api.apify.com/v2/acts/apidojo~tiktok-scraper/runs?token=$APIFY_TOKEN" -H "Content-Type: application/json" -d '{"keywords": ["#italianrecipes", "#foodtok"], "maxItems": 200}'Technical Analysis
The documented fallback commands place
APIFY_TOKENin the request URL. When executed, the shell expands the variable into curl's command-line arguments. Although HTTPS encrypts the request in transit, it does not prevent disclosure through local process inspection, shell debugging, command telemetry, crash diagnostics, or infrastructure that records complete URLs. Apify-side access logs and intermediary proxy logs may also retain query strings.An attacker with access to exposed process arguments or relevant logs could recover the bearer credential and submit authenticated requests independently.
Attack Path
- A user exports a valid
APIFY_TOKENand runs one of the documented fallback commands. - The shell expands
$APIFY_TOKENinto the URL passed as a curl process argument. - A local user, monitoring agent, diagnostic system, proxy, or logging component captures the command line or complete request URL.
- The attacker extracts the token from the
tokenquery parameter. - The attacker reuses the token against the Apify API until it expires or is revoked.
Impact Assessment
The attacker obtains the permissions assigned to the compromised Apify token. Depending on its scope, this may permit running actors, consuming paid platform resources, accessing associated run results or datasets, and ca ...[truncated 168 chars]
- A user exports a valid
- Remediation
View remediation
Remediation Suggestions
- Remove credentials from URL query parameters.
- Pass the token through an authorization header supported by the Apify API, for example:
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 '{"keywords":["#italianrecipes","#italianfood"],"maxItems":100}'- Use narrowly scoped tokens with only the permissions required to run the specified actors.
- Ensure command, proxy, application, and HTTP access logs redact authorization headers and credentials.
- Rotate the token immediately if a query-string version may already have been logged.
- Avoid enabling shell tracing while handling credentials, and prevent secrets from being written to shell history or diagnostic output.
