T09 · Insecure Skill Coding Practices
- Location
SKILL.md:30- Finding
Configurable API Origin Can Disclose the Moltgate API Key
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 30–35 and 48–116
Vulnerability Type: Unrestricted authenticated API destination
Risk Level: HighVulnerable Code
bash export MOLTGATE_BASE_URL="https://moltgate.com"text If `MOLTGATE_BASE_URL` is not set, default to `https://moltgate.com`.text Authorization: Bearer $MOLTGATE_API_KEYRepresentative authenticated requests include:
bash curl -s -H "Authorization: Bearer $MOLTGATE_API_KEY" \ "$MOLTGATE_BASE_URL/api/inbox/messages/?status=NEW"bash curl -s -X PATCH \ -H "Authorization: Bearer $MOLTGATE_API_KEY" \ -H "Content-Type: application/json" \ -d '{"inbox_status":"DELIVERED"}' \ "$MOLTGATE_BASE_URL/api/inbox/messages/{id}/update_status/"bash curl -s -H "Authorization: Bearer $MOLTGATE_API_KEY" \ "$MOLTGATE_BASE_URL/api/offers/"Technical Analysis
The Skill permits
MOLTGATE_BASE_URLto override the API origin, but does not require HTTPS or validate the destination hostname before attachingMOLTGATE_API_KEYas a bearer credential. The default origin is legitimate, but an altered environment can redirect all documented authenticated requests to an arbitrary server.This behavior exceeds minimum privilege. Supporting the declared Moltgate integration requires sending the credential only to the trusted Moltgate API, not to an unrestricted configurable origin. Because bearer tokens grant access to whoever possesses them, an attacker-controlled destination can capture and reuse the key. An
http://value could also expose it through plaintext interception.Attack Path
- An attacker, compromised launcher, deployment configuration, or unsafe setup changes
MOLTGATE_BASE_URLto an attacker-controlled HTTPS endpoint or a plaintext HTTP endpoint. - The user invokes the Skill to list offers, fetch paid tasks, inspect task details, or update task status.
- The Agent follows the documented
curlcommand and attache ...[truncated 890 chars]
- An attacker, compromised launcher, deployment configuration, or unsafe setup changes
- Remediation
View remediation
Remediation Suggestions
- Remove
MOLTGATE_BASE_URLconfigurability if alternate API origins are not operationally required, and use the fixed trusted endpointhttps://moltgate.com. - If configurability is required, parse and validate the URL before any authenticated request:
- Require the
httpsscheme. - Allowlist the exact expected hostname or a narrowly defined set of trusted hosts.
- Reject URL user information, nonstandard destinations, fragments, and ambiguous host representations.
- Do not rely on substring or suffix checks that can accept attacker domains.
- Require the
- Prevent credentials from crossing origins through redirects. Disable redirects or independently validate every redirect destination before forwarding the authorization header.
- Harden documented
curlinvocations, for example with--proto '=https' --proto-redir '=https' --max-redirs 0, in addition to hostname validation. - Keep credential attachment conditional: add the
Authorizationheader only after the final request origin has passed validation. - Apply least privilege to
MOLTGATE_API_KEY, rotate any key suspected of exposure, and monitor for access from unexpected origins or clients. - Add explicit Skill instructions forbidding users and untrusted task content from changing the API origin.
- Remove
