T09 · Insecure Skill Coding Practices
- Location
SKILL.md:27- Finding
Bearer API Key Can Be Sent to an Untrusted Configurable Endpoint
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 27–28 and 69–86
Vulnerability Type: Unvalidated credential destination
Risk Level: MediumThe Skill permits
DDT_OPEN_BASEto be inherited from the execution environment and subsequently sendsDDT_API_KEYto that endpoint as a bearer token.bash export DDT_API_KEY="ddt_live_xxxxxxxx" export DDT_OPEN_BASE="${DDT_OPEN_BASE:-https://gotoshop-ai.com/ddtclaw}"The configurable value is then used as the destination for authenticated requests:
bash curl --fail --silent --show-error -G \ -H "Authorization: Bearer $DDT_API_KEY" \ "$DDT_OPEN_BASE/v1/auto-service/brand/profile" \ --data-urlencode "brand=中鑫之宝" curl --fail --silent --show-error -G \ -H "Authorization: Bearer $DDT_API_KEY" \ "$DDT_OPEN_BASE/v1/auto-service/brand/regions" \ --data-urlencode "brand=中鑫之宝" curl --fail --silent --show-error -G \ -H "Authorization: Bearer $DDT_API_KEY" \ "$DDT_OPEN_BASE/v1/auto-service/nearby" \ --data-urlencode "lng=120.6" \ --data-urlencode "lat=31.3" \ --data-urlencode "radius=3000"Technical Analysis
The default API endpoint is legitimate-looking, but the shell expansion preserves any preexisting
DDT_OPEN_BASEvalue without validating its URL scheme or hostname. The documentedcurlcommands attach the bearer credential to whichever server the variable identifies.This creates a credential-exfiltration sink when the Skill is executed in an environment whose variables can be influenced by another user, a wrapper script, compromised automation, or an untrusted configuration file. The flaw does not require command injection: an attacker only needs to substitute an HTTPS endpoint under their control.
Attack Path
- An attacker gains the ability to influence the environment or configuration used to invoke the Skill.
- The attacker sets
DDT_OPEN_BASEto an endpoint they control, such as `htt ...[truncated 995 chars]
- Remediation
View remediation
Remediation Suggestions
-
Pin authenticated requests to the expected service origin instead of inheriting an arbitrary base URL:
bash readonly DDT_OPEN_BASE="https://gotoshop-ai.com/ddtclaw" -
If endpoint configurability is required, validate the parsed URL before attaching credentials. Require HTTPS, the exact approved hostname, and the expected path prefix. Reject user-info components, alternate ports unless explicitly approved, and deceptive subdomains.
-
Restrict the protocol used by
curland prevent accidental protocol downgrades:bash curl --proto '=https' --fail --silent --show-error -G \ -H "Authorization: Bearer $DDT_API_KEY" \ "https://gotoshop-ai.com/ddtclaw/v1/auto-service/brand/profile" -
Do not forward the Authorization header across hosts. If redirects are enabled in future examples, ensure credentials cannot be propagated to a different origin.
-
Store the API key in a protected secret manager or tightly permissioned environment rather than general-purpose configuration files. Use a narrowly scoped, short-lived credential where supported.
-
Rotate the key immediately if commands may have been executed with an untrusted
DDT_OPEN_BASE, and review API access logs for unknown destinations, abnormal quota use, or unauthorized requests.
-
