T09 · Insecure Skill Coding Practices
- Location
SKILL.md:18- Finding
Configurable API Base URL Can Expose the Karma API Key
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 18–20 and 29–33
Vulnerability Type: Untrusted endpoint configuration leading to credential disclosure
Risk Level: HighVulnerable Code
bash BASE_URL="${KARMA_API_URL:-https://gapapi.karmahq.xyz}" API_KEY="${KARMA_API_KEY}" INVOCATION_ID=$(uuidgen)bash curl -s "${BASE_URL}/v2/agent/info" \ -H "x-api-key: ${API_KEY}" \ -H "X-Source: skill:project-manager" -H "X-Invocation-Id: $INVOCATION_ID" -H "X-Skill-Version: 2.0.0"The same configurable
BASE_URLis also used by other authenticated API requests documented in the skill.Technical Analysis
The skill accepts
KARMA_API_URLfrom the process environment without validating its scheme or destination hostname. It then attaches the sensitiveKARMA_API_KEYvalue as anx-api-keyheader to requests sent to that endpoint.An attacker capable of controlling or poisoning the skill's environment can set
KARMA_API_URLto an attacker-operated server. When the skill verifies the API key or performs another authenticated request,curlsends the key to that server. The configuration also does not require HTTPS, so anhttp://override could expose the credential in plaintext to a network-positioned attacker.The documented setup verification is sufficient to trigger disclosure; no project mutation needs to occur.
Attack Path
- An attacker gains the ability to influence the environment used to launch the agent or skill.
- The attacker sets
KARMA_API_URLto an attacker-controlled URL, such ashttps://attacker.example. - A legitimate user invokes the skill while
KARMA_API_KEYis configured. - Following the setup instructions, the agent requests
${BASE_URL}/v2/agent/info. - The request includes
x-api-key: ${API_KEY}and sends the Karma API key to the attacker's server. - The attacker records the credential and reuses it against the legitimate Karma API.
- Depending on the key's assigned permission ...[truncated 824 chars]
- Remediation
View remediation
Remediation Suggestions
- Pin authenticated requests to the official API origin:
bash BASE_URL="https://gapapi.karmahq.xyz"-
If endpoint overrides are operationally necessary, validate the URL before making any request:
- Require the
httpsscheme. - Compare the parsed hostname against an explicit allowlist.
- Reject embedded credentials, unexpected ports, IP literals, and malformed URLs.
- Do not rely on substring or prefix comparisons for hostname validation.
- Require the
-
Require explicit user approval before sending credentials to any non-default endpoint.
-
Harden
curltransport behavior:
bash curl --proto '=https' --proto-redir '=https' ...Avoid following redirects for authenticated requests. If redirects are required, ensure authentication headers cannot be forwarded to another origin.
-
Separate endpoint selection from credential attachment. Add
x-api-keyonly after the destination has passed validation. -
Use a narrowly scoped API key with the minimum permissions required by the requested operation, and rotate any key that may have been used while an untrusted
KARMA_API_URLwas configured.
