T09 · Insecure Skill Coding Practices
- Location
SKILL.md:86- Finding
Apify API Token Exposed in Request URL
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 86–91
Vulnerability Type: Credential exposure through a URL query parameter
Risk Level: MediumVulnerable Code
bash curl -X POST "https://api.apify.com/v2/acts/apidojo~tiktok-scraper/runs?token=$APIFY_TOKEN" -H "Content-Type: application/json" -d '{ "keywords": ["#ad", "#sponsored", "#fitnesspartner"], "maxItems": 300 }'Technical Analysis
The REST fallback interpolates the
APIFY_TOKENenvironment variable directly into a URL query parameter. Although HTTPS protects the request in transit, URLs can be exposed outside the encrypted connection through shell history, process command-line inspection, debugging output, reverse-proxy logs, monitoring systems, and server access logs.Consequently, users following this documented command may unintentionally disclose a reusable account credential to local users or infrastructure operators with access to those records.
Attack Path
- A user sets
APIFY_TOKENand runs the documented REST fallback command. - The shell expands
$APIFY_TOKENinto the command-line URL. - The complete URL is retained or observed through shell history, process inspection, diagnostic output, proxy telemetry, or access logs.
- An attacker with access to one of those sources extracts the token.
- The attacker submits unauthorized requests to Apify APIs using the stolen token.
- The attacker can exercise any capabilities granted to that token until it is revoked or expires.
Impact Assessment
Successful exploitation may permit unauthorized use of Apify resources within the compromised token's permission scope. Potential consequences include running actors, consuming quotas, causing unexpected charges, and accessing account-scoped resources or results available to the token.
This issue does not independently grant operating-system privileges. Its scope is limited by the permissions associated with the exposed Apify token.
- A user sets
- Remediation
View remediation
Remediation Suggestions
Transmit the token in an authorization header rather than a URL query parameter:
bash curl -X POST \ "https://api.apify.com/v2/acts/apidojo~tiktok-scraper/runs" \ -H "Authorization: Bearer $APIFY_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "keywords": ["#ad", "#sponsored", "#fitnesspartner"], "maxItems": 300 }'Apply the following additional controls:
- Avoid enabling shell tracing, verbose HTTP output, or debug logging when secrets are present.
- Ensure authorization headers are redacted from application, proxy, and observability logs.
- Store the token in a protected secret manager or restricted environment variable rather than source files.
- Grant the token only the minimum permissions required for actor execution.
- Rotate any token previously used with the query-string example if relevant logs or command history may have been accessible.
- Add automated documentation or static checks that reject credentials in URL query parameters.
