T09 · Insecure Skill Coding Practices
- Location
SKILL.md:31- Finding
Environment-Controlled API Endpoint Can Expose Bearer Credentials
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 31–34 and 72–87
Vulnerability Type: Unvalidated API base URL used with an authorization header
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 configurable value is subsequently used in authenticated requests:
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
DDT_OPEN_BASEvalue and does not validate its URL scheme, hostname, port, or origin. The documented requests then attach the bearer credential to that configurable destination.An attacker who can influence the process environment can set
DDT_OPEN_BASEto an attacker-controlled HTTPS endpoint. Following the documented workflow would transmit theAuthorization: Bearerheader to that endpoint. Request parameters—including brand names, coordinates, addresses represented by coordinates, and store-related queries—may also be disclosed.This issue does not establish that the Skill is intentionally malicious. It is an insecure configuration pattern that creates a credential-exfiltration opportunity when the execution environment is compromised or improperly configured.
Attack Path
- An attacker, compromised launcher, shell profile, CI configuration, or wrapper process defines `DDT_OPE ...[truncated 1172 chars]
- Remediation
View remediation
Remediation Suggestions
-
Hard-code the trusted HTTPS API origin when sending credentials:
bash readonly DDT_OPEN_BASE="https://gotoshop-ai.com/ddtclaw" -
If endpoint configurability is required, parse and validate the URL before making requests. Require:
- Scheme exactly equal to
https - Hostname exactly equal to
gotoshop-ai.com - An approved port
- An approved base path
- No embedded user information or ambiguous URL syntax
- Scheme exactly equal to
-
Refuse to send the
Authorizationheader when validation fails. Do not silently fall back to or contact an untrusted destination. -
Separate production and development credentials. Permit custom development endpoints only with non-production keys and an explicit opt-in mechanism.
-
Use short-lived, narrowly scoped credentials with server-side rate limits, expiration, monitoring, and prompt revocation capability.
-
Document that inherited environment variables must not override the authenticated production endpoint, and sanitize the environment in CI, agent runners, and wrapper scripts.
-
Add an automated test verifying that authenticated requests cannot be directed to an unapproved origin.
-
