T09 · Insecure Skill Coding Practices
- Location
SKILL.md:31- Finding
Configurable API Origin Can Expose Bearer Credentials
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 31–77
Vulnerability Type: Bearer-token disclosure through an untrusted API base URL
Risk Level: MediumVulnerable Code
bash 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/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 initialization expression preserves any existing value of
DDT_OPEN_BASE. Every documented API request then attaches the secretDDT_API_KEYas a bearer token to a URL derived from that variable.If an attacker can influence the environment used to launch the Skill, the attacker can set
DDT_OPEN_BASEto an HTTPS endpoint under their control. The documentedcurlcommands will consequently transmit the authorization header and request parameters to that endpoint.Shell quoting prevents command substitution through this variable, so this is not a shell-command injection issue. The vulnerability is instead a failure to validate the authorization destination before disclosing a credential.
Attack Path
- An attacker compromises or influences the launcher, shell profile, container environment, CI configuration, or another mechanism that supplies environment variables.
- The attacker sets
DDT_OPEN_BASEto an attacker-controlled URL, such ashttps://attacker.example. - The documented initialization preserves the malicious val ...[truncated 975 chars]
- Remediation
View remediation
Remediation Suggestions
-
Hard-code the trusted API origin when attaching the bearer token:
bash readonly DDT_OPEN_BASE="https://gotoshop-ai.com/ddtclaw" -
If endpoint configurability is operationally required, validate the parsed URL before making a request. Allow only the exact expected HTTPS scheme, hostname, port, and base path. Do not rely on substring or suffix matching.
-
Reject non-HTTPS URLs, embedded user information, unexpected ports, alternate hosts, and malformed URLs.
-
Avoid inheriting the authenticated endpoint from an uncontrolled environment. Use a trusted configuration file with restrictive permissions or a deployment-controlled constant instead.
-
Disable redirects for authenticated requests, or independently validate every redirect destination before forwarding the
Authorizationheader. -
Use a wrapper that adds the authorization header only after destination validation rather than placing the header directly in generic command examples.
-
Rotate
DDT_API_KEYimmediately if requests may already have been sent whileDDT_OPEN_BASEwas controlled by an untrusted party. Review API access logs for unknown destinations, unusual usage, or quota consumption.
-
