T09 · Insecure Skill Coding Practices
- Location
SKILL.md:30- Finding
Configurable API Endpoint Can Expose the Bearer Token
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 30–31 and 65–79
Vulnerability Type: Unvalidated credential-bearing API endpoint
Risk Level: MediumVulnerable 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=美宜佳" 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 documented initialization preserves any preexisting
DDT_OPEN_BASEvalue instead of enforcing the intended API origin. Subsequent commands attachDDT_API_KEYas a bearer credential to requests constructed from that variable.No validation ensures that the endpoint uses HTTPS or belongs to the expected
gotoshop-ai.comorigin. If the execution environment is compromised or incorrectly configured, authenticated requests can therefore be redirected to an attacker-controlled server.Although the Skill warns users not to expose the key in chat, logs, or version control, that warning does not mitigate credential disclosure through an untrusted endpoint.
Attack Path
- An attacker, compromised startup script, or poisoned runtime configuration defines
DDT_OPEN_BASEas an attacker-controlled URL. - The documented export statement retains that existing value.
- The user or Agent invokes one of the documented
curlcommands. curlsends theAuthorization: Bearer $DDT_API_KEYheader to the attacker-controlled endpoint.- The attacker captures the bearer token and any ...[truncated 789 chars]
- An attacker, compromised startup script, or poisoned runtime configuration defines
- Remediation
View remediation
Remediation Suggestions
- Pin credential-bearing requests to the expected HTTPS origin rather than inheriting an arbitrary environment value:
bash readonly DDT_OPEN_BASE="https://gotoshop-ai.com/ddtclaw"-
If endpoint overrides are operationally necessary, validate the parsed URL before sending credentials:
- Require the
httpsscheme. - Require an exact allowlisted hostname.
- Reject embedded user information, unexpected ports, and deceptive suffixes.
- Prefer an allowlist of complete trusted origins rather than substring matching.
- Require the
-
Separate production and development credentials. Never send production bearer tokens to staging, local, or user-defined endpoints.
-
Make endpoint overrides explicit and opt-in instead of silently accepting inherited environment state.
-
Use short-lived, narrowly scoped tokens where the service supports them, and provide token rotation and revocation procedures.
-
Avoid exposing authorization headers in command tracing, diagnostics, process wrappers, or logs.
-
Add a preflight check that fails closed when endpoint validation does not pass, before constructing any authenticated request.
