T09 · Insecure Skill Coding Practices
- Location
SKILL.md:33- Finding
Unvalidated API Base URL Can Expose the Bearer Token
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 33–37; affected request examples at lines 70–84
Vulnerability Type: Unvalidated authenticated API endpoint
Risk Level: HighVulnerable Code
bash export DDT_API_KEY="ddt_live_xxxxxxxx" export DDT_OPEN_BASE="${DDT_OPEN_BASE:-https://gotoshop-ai.com/ddtclaw}"The resulting variable is used directly in authenticated requests:
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 configuration preserves any pre-existing value of
DDT_OPEN_BASEwithout validating its URL scheme or destination hostname. The documented requests subsequently attach the production bearer token to that configurable destination.If an attacker can influence the Agent's process environment, deployment configuration, shell initialization, or wrapper responsible for invoking the Skill, the attacker can set
DDT_OPEN_BASEto a server under their control. Following the Skill's documented workflow would then transmit theAuthorization: Bearer $DDT_API_KEYheader to the attacker-controlled endpoint.The configuration also does not enforce HTTPS after an override. An
http://endpoint could expose the credential and query data to network interception in addition to the configured recipient.Attack Path
- The attacker gains the ability to influence the environment used to run the Skill, without needing direct access to the API key.
- The attacker sets `DDT_OPEN_BAS ...[truncated 1167 chars]
- Remediation
View remediation
Remediation Suggestions
- Hardcode the trusted production API origin when attaching production credentials:
bash readonly DDT_OPEN_BASE="https://gotoshop-ai.com/ddtclaw"-
If endpoint configurability is required, parse and validate the URL before making a request:
- Require the
httpsscheme. - Require an exact allowlisted hostname.
- Reject embedded credentials, unexpected ports, fragments, and noncanonical host representations.
- Avoid suffix-only hostname checks that could accept attacker-controlled domains.
- Require the
-
Attach the
Authorizationheader only after the destination has passed validation. -
Separate development and production configuration. Development endpoints should use dedicated, least-privileged test credentials rather than production API keys.
-
Restrict who can modify the Agent's environment, launcher configuration, shell initialization files, and deployment manifests.
-
Configure short-lived, narrowly scoped credentials where supported, along with rate limits and rapid token revocation.
-
Avoid logging authorization headers and rotate the API key immediately if requests may already have been sent to an untrusted endpoint.
