T09 · Insecure Skill Coding Practices
- Location
SKILL.md:34- Finding
Configurable API Base URL Can Expose the Bearer Credential
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 34–38 and 72–76
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}"bash curl --fail --silent --show-error -G \ -H "Authorization: Bearer $DDT_API_KEY" \ "$DDT_OPEN_BASE/v1/retail/brand/profile" \ --data-urlencode "brand=美宜佳"The same credential-bearing request pattern is also used by the other documented API examples through line 89.
Technical Analysis
DDT_OPEN_BASEretains any value already present in the execution environment. The instructions do not validate its URL scheme, hostname, port, or origin before using it in requests that attachDDT_API_KEYas a bearer token.Consequently, a preconfigured or poisoned environment can change
DDT_OPEN_BASEto an attacker-controlled endpoint. Following the documented request flow then transmits the authorization header and query parameters to that endpoint. The endpoint can also return fabricated API responses that may be treated as retail-analysis data.Allowing an HTTP URL would additionally expose the bearer token and submitted data to network interception because the instructions do not enforce HTTPS.
Attack Path
- An attacker or compromised environment configuration defines
DDT_OPEN_BASEas an attacker-controlled URL, such ashttps://attacker.example. - The user follows the documented initialization command.
- Because the shell expansion only applies the legitimate URL when the variable is unset or empty, the malicious value remains active.
- The user or agent executes one of the documented
curlrequests. curlsendsAuthorization: Bearer $DDT_API_KEYand the request parameters to the attacker-controlled server.- The attacker captures the API key and submitted brand or location d ...[truncated 753 chars]
- An attacker or compromised environment configuration defines
- Remediation
View remediation
Remediation Suggestions
-
Hard-code the trusted HTTPS origin when sending the authorization header:
bash readonly DDT_OPEN_BASE="https://gotoshop-ai.com/ddtclaw" -
If endpoint configurability is required for approved testing environments, validate the parsed URL before making requests:
- Require the
httpsscheme. - Require an explicit allowlisted hostname.
- Reject embedded credentials, unexpected ports, fragments, and malformed URLs.
- Resolve the destination only after validation.
- Require the
-
Do not attach
Authorizationto requests whose origin differs from the approved API origin. -
Keep cross-origin redirects disabled. If redirects are later enabled, ensure the authorization header is stripped whenever the scheme, hostname, or port changes.
-
Separate production and testing credentials. Use narrowly scoped, short-lived keys for non-production endpoints.
-
Add a preflight check that terminates with an error when
DDT_OPEN_BASEis set to an unapproved value, rather than silently trusting an inherited environment variable. -
Rotate any API credential that may already have been used while the base URL pointed to an untrusted destination.
-
