T09 · Insecure Skill Coding Practices
- Location
SKILL.md:34- Finding
Configurable API Base URL Can Disclose the Bearer Token
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 34–39 and 69–84
Vulnerability Type: Arbitrary authenticated endpoint configuration
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 request examples subsequently use the configurable base URL while attaching the API key:
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 preexisting
DDT_OPEN_BASEenvironment variable without validating its URL scheme or destination host. The documented requests then attachAuthorization: Bearer $DDT_API_KEYto URLs constructed from that value.Consequently, an attacker who controls the inherited environment or execution configuration can redirect authenticated requests to an arbitrary endpoint. HTTPS alone does not prevent this issue because an attacker can operate a valid HTTPS server under a domain they control.
The vulnerability does not require shell-command injection: assigning a conventional attacker-controlled URL is sufficient to receive the authorization header when the documented request is executed.
Attack Path
- The attacker gains influence over the Agent's process environment or launch configuration.
- The attacker sets
DDT_OPEN_BASEto an endpoint under their control, such ashttps://attacker.example. - The documented initializat ...[truncated 855 chars]
- Remediation
View remediation
Remediation Suggestions
- Hard-code the trusted HTTPS API origin when production credentials are attached.
- If endpoint configuration is required, parse and validate the URL before each authenticated request:
- Require the
httpsscheme. - Require an exact allowlisted hostname.
- Reject user-information components, unexpected ports, and ambiguous hostname forms.
- Normalize the URL before comparison.
- Require the
- Do not preserve an inherited endpoint variable silently. Require an explicit, trusted configuration step for alternate environments.
- Use separate credentials for development or staging endpoints; never send production credentials to configurable origins.
- Prevent authorization headers from being forwarded to untrusted redirect destinations. Prefer disabling redirects or validating every redirect target against the same allowlist.
- Apply least privilege, expiration, rotation, and usage monitoring to API keys.
- Revoke and rotate any credential suspected of having been used while
DDT_OPEN_BASEpointed to an untrusted host.
A safer fixed-origin example is:
bash readonly DDT_OPEN_BASE="https://gotoshop-ai.com/ddtclaw" curl --fail --silent --show-error -G \ -H "Authorization: Bearer $DDT_API_KEY" \ "$DDT_OPEN_BASE/v1/auto-service/brand/profile" \ --data-urlencode "brand=中鑫之宝"
