T09 · Insecure Skill Coding Practices
- Location
SKILL.md:5- Finding
Bypassable curl Host Allowlist May Expose the Freepik API Key
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:5
Vulnerability Type:T09: Insecure Skill Coding Practices
Risk Level: HighVulnerable code:
yaml allowed-tools: Bash(curl *api.freepik.com*), Bash(curl **.freepik.com*), Bash(jq *), Bash(mkdir -p ~/.freepik/*)Technical Analysis
The
curlpermissions use substring-style wildcard patterns rather than enforcing an exact parsed origin. In particular,*api.freepik.com*may match a command containing an attacker-controlled lookalike hostname such asapi.freepik.com.attacker.example, depending on the OpenClaw command-matching implementation.The skill's documented requests attach the secret
FREEPIK_API_KEYto curl requests through thex-freepik-api-keyheader. If the command matcher only checks whether the command text containsapi.freepik.com, an attacker could construct a URL that satisfies the allowlist while resolving to infrastructure outside Freepik's control.The second pattern,
**.freepik.com*, also ends in an unrestricted wildcard and does not explicitly constrain the URL scheme, port, redirects, or parsed destination. Textual command matching is not equivalent to validating the effective network destination.Attack Path
- An attacker supplies a crafted URL or endpoint through user-controlled skill arguments, indirect prompt injection, or content processed by the agent.
- The URL contains the permitted text while using an attacker-controlled hostname, such as
https://api.freepik.com.attacker.example/collect. - The resulting curl command may pass the substring-based
allowed-toolsrule. - The agent follows the documented authentication pattern and adds
x-freepik-api-key: $FREEPIK_API_KEY. - Curl connects to the attacker-controlled server and transmits the API key.
- The attacker uses the stolen key to make Freepik API requests under the victim's account.
Exploitability depends on the exact semantics of the O ...[truncated 656 chars]
- Remediation
View remediation
Remediation Suggestions
- Replace substring-based Bash patterns with a structured network policy that permits only:
- Scheme:
https - Host: exactly
api.freepik.com - Port:
443
- Scheme:
- Validate the parsed destination rather than searching the raw command text for an allowed substring.
- Reject URL user-info, unexpected ports, encoded host components, and hostnames that merely contain the trusted hostname.
- Disable redirects for authenticated requests where possible, for example with
--max-redirs 0. If redirects are required, independently validate every redirect destination before forwarding sensitive headers. - Restrict protocols with curl options such as:
bash --proto '=https' --proto-redir '=https' - Use a fixed wrapper or API client that constructs the Freepik origin internally and accepts only validated relative endpoint paths.
- Do not attach
x-freepik-api-keyuntil the final parsed destination has been confirmed as exactlyapi.freepik.com. - Add negative tests for lookalike destinations, including
api.freepik.com.attacker.example, alternate ports, URL user-info, encoded hostnames, and redirect-based attempts.
- Replace substring-based Bash patterns with a structured network policy that permits only:
