T09 · Insecure Skill Coding Practices
- Location
SKILL.md:93- Finding
Apify API Token Exposed Through URL Query Parameter
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 93–95
Vulnerability Type: Credential exposure through a URL query parameter
Risk Level: MediumVulnerable code snippet:
bash # REST API fallback: 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}'Technical Analysis
The documented REST fallback expands
APIFY_TOKENdirectly into the request URL. Although HTTPS protects the URL while it is transmitted over the network, URL query strings are commonly recorded by local process inspection tools, shell debugging output, HTTP clients, reverse proxies, API gateways, monitoring platforms, and server access logs.Credentials should not be included in URLs because URLs are frequently retained and propagated as operational metadata. An authenticated URL may consequently remain accessible after the request has completed. Any user or service that can inspect the relevant process arguments or logs could recover the token.
Attack Path
- A user follows the documented REST fallback while
APIFY_TOKENcontains a valid credential. - The shell expands
$APIFY_TOKENinto the curl command's URL. - The complete authenticated URL is exposed to a process observer, diagnostic system, proxy, API gateway, or logging platform.
- An attacker with access to that source extracts the value of the
tokenquery parameter. - The attacker submits requests to the Apify API using the recovered token.
- The attacker can use the token until it expires or is revoked, subject to the token's assigned permissions and account limits.
Impact Assessment
Successful exploitation compromises the confidentiality of the Apify API token. The attacker may invoke actors, consume account resources, incur usage charges, and access other Apify resources authorized for t ...[truncated 191 chars]
- A user follows the documented REST fallback while
- Remediation
View remediation
Remediation Suggestions
Remove the token from the URL and transmit it through the Apify API authorization header instead:
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}'Additional hardening measures:
- Use a narrowly scoped token with only the permissions required to run the designated actor.
- Prevent command tracing and verbose diagnostics from printing authorization headers.
- Redact authorization data in client, proxy, gateway, and monitoring logs.
- Store the token in an approved secret manager or protected environment variable rather than source files.
- Rotate the token if the documented query-parameter command has already been used in an environment where URLs or process arguments may have been retained.
- Configure expiration and usage monitoring where supported, and investigate unexpected actor runs or account consumption.
