T09 · Insecure Skill Coding Practices
- Location
SKILL.md:37- Finding
Configurable API Base URL May Expose Bearer Credentials
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 37–40; the variable is used in authenticated request examples at lines 74–88
Vulnerability Type: Unvalidated authentication endpoint configuration
Risk Level: Mediumbash export DDT_API_KEY="ddt_live_xxxxxxxx" export DDT_OPEN_BASE="${DDT_OPEN_BASE:-https://gotoshop-ai.com/ddtclaw}"The configured value is subsequently used with the bearer credential:
bash curl --fail --silent --show-error -G \ -H "Authorization: Bearer $DDT_API_KEY" \ "$DDT_OPEN_BASE/v1/auto-service/brand/profile" \ --data-urlencode "brand=中鑫之宝"Technical Analysis
The shell initialization preserves any pre-existing
DDT_OPEN_BASEenvironment variable without validating its URL scheme or hostname. Authenticated requests subsequently combine that configurable endpoint with anAuthorization: Bearerheader containingDDT_API_KEY.Environment variables may be inherited from a parent process, development environment, shell profile, CI configuration, container configuration, or launcher. If an attacker can influence
DDT_OPEN_BASE, requests can be redirected to a server under the attacker's control. That server would receive the bearer credential and submitted query parameters.The documented default endpoint uses HTTPS, but no check ensures that an overridden value also uses HTTPS or belongs to the expected
gotoshop-ai.comhost. Consequently, the configuration permits credential transmission to an arbitrary HTTPS host or potentially over plaintext HTTP.Attack Path
- An attacker compromises or influences the environment used to invoke the Skill.
- The attacker sets
DDT_OPEN_BASEto an attacker-controlled endpoint, such ashttps://attacker.example. - The documented initialization retains this existing value because
${DDT_OPEN_BASE:-...}only applies the default when the variable is unset or empty. - The user or Agent runs one of the d ...[truncated 1025 chars]
- Remediation
View remediation
Remediation Suggestions
- Hard-code the trusted API origin when attaching the bearer credential:
bash DDT_OPEN_BASE="https://gotoshop-ai.com/ddtclaw" - If endpoint configurability is required, parse and validate the URL before issuing requests. Require:
- The
httpsscheme. - An exact approved hostname.
- An approved port.
- An expected path prefix.
- No embedded user information.
- The
- Reject inherited or user-supplied endpoint values by default instead of silently trusting them.
- Ensure credentials are not forwarded during cross-origin redirects. Consider disabling redirects entirely for authenticated API requests.
- Separate development endpoints from production credentials. Test or staging endpoints should use distinct, narrowly scoped credentials.
- Use short-lived, least-privilege API tokens where supported, and document immediate token revocation and rotation if endpoint poisoning is suspected.
- Add a preflight check that terminates the request without displaying the key when the endpoint fails validation.
- Hard-code the trusted API origin when attaching the bearer credential:
