T09 · Insecure Skill Coding Practices
- Location
SKILL.md:35- Finding
Environment-Controlled API URL Can Expose the Bearer Credential
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 35–41
Vulnerability Type: Credential exposure through an untrusted API endpoint override
Risk Level: HighVulnerable Code
markdown ## Authentication All API requests require:Authorization: Bearer <SWARMRECALL_API_KEY>
text ## API Base URL `https://swarmrecall-api.onrender.com` (override with `SWARMRECALL_API_URL` if set)Technical Analysis
The skill directs the agent to use the value of
SWARMRECALL_API_URLas the API base URL whenever that environment variable is set. It also directs the agent to includeSWARMRECALL_API_KEYas a bearer credential in all API requests.No origin validation, HTTPS enforcement, host allowlist, redirect restriction, or explicit user approval requirement is specified for the override. Consequently, an attacker who can influence the agent's environment could set
SWARMRECALL_API_URLto an attacker-controlled endpoint. If the agent follows these instructions, authenticated requests would disclose the bearer credential to that endpoint.This is an insecure configuration practice rather than evidence of intentionally malicious behavior.
Attack Path
- An attacker gains the ability to influence the environment used to run the agent, such as through a compromised project configuration, shell profile, CI configuration, or parent process.
- The attacker sets
SWARMRECALL_API_URLto an endpoint under the attacker's control. - The skill instructs the agent to use that endpoint as the API base URL.
- The agent sends a request containing:
http Authorization: Bearer <SWARMRECALL_API_KEY> - The attacker-controlled server records the bearer credential.
- The attacker reuses the credential against the legitimate SwarmRecall API, subject to the credential's scopes and validity.
Impact Assessment
Successful exploitation could disclose the SwarmRecall API key. The attacker could exercise the permissions gr ...[truncated 460 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove support for
SWARMRECALL_API_URLunless custom endpoints are operationally necessary. - If overrides are required, validate the parsed URL against an explicit allowlist of trusted origins.
- Require HTTPS and reject URLs containing user information, unexpected ports, IP-literal hosts, fragments, or non-allowlisted hostnames.
- Do not attach
Authorizationheaders to requests whose scheme, hostname, or port differs from the approved origin. - Disable automatic redirects for authenticated requests, or strip credentials and revalidate the destination before following any redirect.
- Require explicit user confirmation before sending credentials to a non-default endpoint.
- Apply narrowly scoped, short-lived API credentials and provide a documented revocation and rotation procedure.
- Treat environment variables as untrusted configuration and fail closed when endpoint validation fails.
- Remove support for
