T09 · Insecure Skill Coding Practices
- Location
SKILL.md:67- Finding
API Credential Can Be Redirected to an Arbitrary Host
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:67-68
Additional Locations:SKILL.md:27, 93-94, 123-124, 144-145, 166-167, 187-188, 211-214, 239-240, 263-264, 284-287, 331-332
Vulnerability Type: Unvalidated credential-bearing endpoint override
Risk Level: MediumVulnerable Code
bash curl -s -H "X-Shelter-Key: $SHELTER_API_KEY" \ "${SHELTER_API_URL:-https://api.shelter.money/agent}/v1/status"The same endpoint override pattern is used for all documented API requests.
Technical Analysis
The Skill sends the sensitive
SHELTER_API_KEYvalue in an HTTP header to a base URL controlled by theSHELTER_API_URLenvironment variable. The value is not validated, restricted to the expectedapi.shelter.moneyhostname, or required to use HTTPS.If an attacker can influence the agent's environment, shell configuration, process launcher, or project-specific environment settings, the attacker can set
SHELTER_API_URLto a server under their control. The next Skill request will then disclose the API key in theX-Shelter-Keyheader. Anhttp://value could additionally expose the key in plaintext to network observers.Attack Path
- An attacker influences the environment in which the agent runs and sets
SHELTER_API_URLto an attacker-controlled URL, such ashttps://attacker.example/collect. - The user asks the agent to check financial status, runway, alerts, or another Shelter function.
- The agent executes the documented
curlcommand. curlsendsX-Shelter-Key: $SHELTER_API_KEYto the attacker-controlled server.- The attacker captures the API key and uses it against the legitimate Shelter API, subject to the key's assigned scopes and rate limits.
Impact Assessment
Successful exploitation exposes the user's Shelter API credential. The attacker could access the financial information allowed by that key, potentially including balances, safe-to-spend amounts, e ...[truncated 409 chars]
- An attacker influences the environment in which the agent runs and sets
- Remediation
View remediation
Remediation Suggestions
- Remove the endpoint override for normal use and hardcode the trusted endpoint:
bash SHELTER_API_URL="https://api.shelter.money/agent" - If custom endpoints are required for development, validate the parsed URL before attaching the API key:
- Require the
https:scheme. - Require an exact hostname allowlist, such as
api.shelter.money. - Reject embedded credentials, unexpected ports, redirects to other hosts, and malformed URLs.
- Require the
- Configure
curlto reject insecure transport and unsafe redirects. Do not forward the credential across cross-origin redirects. - Separate development credentials from production credentials and require an explicit development mode before permitting a non-production endpoint.
- Document that users should rotate the API key immediately if an unexpected
SHELTER_API_URLvalue may have been used. - Apply narrowly scoped API permissions and short credential lifetimes to reduce the impact of disclosure.
- Remove the endpoint override for normal use and hardcode the trusted endpoint:
