T09 · Insecure Skill Coding Practices
- Location
SKILL.md:27- Finding
Unvalidated API Base URL Can Expose the Bearer Credential
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 27–34 and 66–82
Vulnerability Type: Unvalidated credential destination
Risk Level: MediumThe Skill permits the API origin to be overridden through the existing
DDT_OPEN_BASEenvironment variable. It then includesDDT_API_KEYas a bearer credential in requests sent to that origin.bash export DDT_API_KEY="ddt_live_xxxxxxxx" export DDT_OPEN_BASE="${DDT_OPEN_BASE:-https://gotoshop-ai.com/ddtclaw}"Each request is instructed to include the bearer credential:
text Each request includes `Authorization: Bearer $DDT_API_KEY`.The vulnerable request pattern is demonstrated throughout the examples:
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 default endpoint uses HTTPS and points to the expected service. However, the shell expansion preserves any previously defined
DDT_OPEN_BASEvalue without validating its scheme, hostname, port, path, or ownership.Because the same variable determines the destination of requests carrying the
Authorizationheader, a malicious or compromised runtime configuration can redirect the bearer credential to an attacker-controlled endpoint. This is a credential exfiltration weakness caused by coupling a configurable destination with an automatically attached secret.The issue does not require command injection: a syntactically valid attacker-controlled URL is sufficient. HTTPS alone does not prevent the attack because ...[truncated 1372 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove the endpoint override if custom API origins are not operationally necessary:
bash readonly DDT_OPEN_BASE="https://gotoshop-ai.com/ddtclaw"-
If overrides are required, validate the parsed destination before attaching credentials:
- Require the
httpsscheme. - Allow only explicitly approved hostnames.
- Reject embedded user information, unexpected ports, fragments, and malformed URLs.
- Avoid suffix-based hostname validation that could accept domains such as
gotoshop-ai.com.attacker.example.
- Require the
-
Attach the
Authorizationheader only after confirming that the final request origin is allowlisted. -
Do not forward credentials across redirects. Reject cross-origin redirects and avoid options that preserve authorization headers when the destination changes.
-
Add a startup check that fails closed when
DDT_OPEN_BASEdiffers from an approved endpoint. -
Document that endpoint configuration must come only from trusted deployment configuration and must not be derived from user input.
-
Rotate
DDT_API_KEYimmediately if requests may already have been sent to an untrusted origin, and review service logs for unauthorized use or unusual quota consumption.
