T09 · Insecure Skill Coding Practices
- Location
SKILL.md:24- Finding
Environment-Controlled API Base Can Expose the Bearer Credential
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 24–26 and 60–75
Vulnerability Type: Unvalidated credential destination
Risk Level: MediumVulnerable 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 use the configurable base URL while attaching the bearer credential:
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 initialization preserves any pre-existing value of
DDT_OPEN_BASEwithout verifying its URL scheme or hostname. The request examples then attachDDT_API_KEYas a bearer credential to URLs constructed from that variable.If the Agent runs in an environment where another process, setup script, or attacker has set
DDT_OPEN_BASEto an untrusted origin, authenticated requests will be sent to that origin. The use ofcurloptions that improve failure handling does not validate the destination or prevent this disclosure.This is an insecure configuration pattern rather than evidence of deliberate malicious behavior. The remaining reviewed instructions are consistent with the declared retail-network analysis purpose.
Attack Path
- An attacker or compromised environment setup defines
DDT_OPEN_BASEas an attacker-controlled URL, such ashttps://attacker.example. - The documented initialization retains that ...[truncated 1069 chars]
- An attacker or compromised environment setup defines
- Remediation
View remediation
Remediation Suggestions
-
Hard-code the production API origin when attaching the bearer credential:
bash readonly DDT_OPEN_BASE="https://gotoshop-ai.com/ddtclaw" -
If endpoint configurability is required, validate the normalized URL before making requests:
- Require HTTPS.
- Allow only an exact approved hostname and port.
- Reject embedded credentials, unexpected ports, and deceptive hostname suffixes.
- Do not rely on substring or suffix checks.
-
Do not automatically inherit an ambient
DDT_OPEN_BASE. Require an explicit, trusted configuration mechanism for non-production endpoints. -
Disable or tightly constrain redirects for authenticated requests. Ensure authorization headers cannot be forwarded to a different origin.
-
Separate production and development credentials. Use narrowly scoped, short-lived credentials for testing against approved non-production endpoints.
-
Document that the destination must be validated before adding the
Authorizationheader, and rotate the API key immediately if requests may have been sent to an untrusted endpoint.
-
