T09 · Insecure Skill Coding Practices
- Location
scripts/create-group.ts:54- Finding
DingTalk Access Token Exposed in URL Query String
- Content
View full analysis
Vulnerability Details
File Location:
scripts/create-group.ts, lines 54–57
Vulnerability Type: Sensitive token exposure through a URL query parameter
Risk Level: Mediumtypescript const options = { hostname: 'oapi.dingtalk.com', path: `${path}?access_token=${accessToken}`, method, headers: { 'Content-Type': 'application/json', } as Record<string, string>, };Technical Analysis
The script places the DingTalk access token directly in the HTTPS request URL. TLS protects the request in transit, and the destination is the legitimate DingTalk API domain. However, URL query strings are commonly recorded by reverse proxies, destination access logs, application-performance monitoring systems, diagnostic tooling, and error telemetry.
Consequently, systems with no legitimate need to possess the token may store it in plaintext logs. The implementation does not intentionally print the request URL or token, but it cannot ensure that infrastructure processing the request will redact the query string.
Attack Path
- The skill obtains a valid access token using the configured DingTalk application credentials.
- The script constructs
/chat/create?access_token=<token>. - A proxy, monitoring agent, API gateway, destination server, or diagnostic system records the request target.
- An attacker or unauthorized operator obtains access to the resulting logs or telemetry.
- The token is extracted from the query string.
- Before the token expires or is revoked, the attacker replays it against DingTalk APIs authorized for the application.
This path depends on access to infrastructure logs or telemetry and on the token remaining valid.
Impact Assessment
A leaked token could allow an attacker to exercise the DingTalk permissions granted to the associated application until the token expires or is revoked. Within the functionality demonstrated by this project, this ...[truncated 389 chars]
- Remediation
View remediation
Remediation Suggestions
- Prefer a current DingTalk endpoint or SDK operation that accepts the token in an authorization header rather than in the URL.
- If the legacy API requires a query-string token, configure proxies, API gateways, HTTP clients, monitoring systems, and destination-side logs to redact
access_tokenvalues or omit query strings entirely. - Restrict access to logs and telemetry, encrypt them at rest, and apply short retention periods.
- Grant the DingTalk application only the minimum permissions needed to create groups.
- Establish token-revocation and credential-rotation procedures for suspected exposure.
- Ensure debug and error handling never emit complete request URLs.
- Add automated tests or log-scrubbing checks that verify sensitive query parameters cannot appear in operational telemetry.
