T09 · Insecure Skill Coding Practices
- Location
PERMISSION_GUIDE.md:90- Finding
Access Token Exposed Through Terminal Output and Logs
- Content
View full analysis
Vulnerability Details
File Location:
PERMISSION_GUIDE.md, lines 90-96
Vulnerability Type: Sensitive credential disclosure
Risk Level: HighVulnerable Code
bash # 1. 获取 access_token TOKEN=$(curl -s -X POST 'https://api.dingtalk.com/v1.0/oauth2/accessToken' \ -H 'Content-Type: application/json' \ -d "{\"appKey\":\"$APP_KEY\",\"appSecret\":\"$APP_SECRET\"}" | \ python3 -c "import json,sys; print(json.load(sys.stdin)['accessToken'])") echo "Token: $TOKEN"Technical Analysis
The verification instructions explicitly print the DingTalk access token to standard output. A bearer token authorizes requests based on possession alone, so it must be treated as a secret.
Standard output may be retained in shell transcripts, CI/CD logs, agent conversation histories, terminal recordings, support bundles, or centralized logging systems. Although the token has a limited lifetime, disclosure creates an immediate opportunity for unauthorized API access.
The JSON-processing pipeline shown here is not remote code execution: it sends an authentication request to DingTalk and parses the response with local Python. The security issue is the subsequent disclosure of the resulting token.
Attack Path
- An administrator follows the permission-verification instructions.
- DingTalk returns an access token associated with the application's approved scopes.
echo "Token: $TOKEN"writes the complete bearer token to standard output.- The output is captured in an agent transcript, CI log, terminal recording, or support artifact.
- A party with access to that output extracts the token.
- Before expiration, that party submits DingTalk API requests using the
x-acs-dingtalk-access-tokenheader.
Impact Assessment
An attacker can exercise every DingTalk permission represented by the exposed token until it expires or is revoked. Depending on the application's approved scopes, this may inc ...[truncated 261 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove
echo "Token: $TOKEN"and never print the complete token. - Report only a non-sensitive status message such as
Access token acquired successfully. - Configure command tracing so secret-bearing commands are not recorded; avoid
set -xaround authentication operations. - Redact bearer tokens from agent transcripts, CI output, diagnostics, and support bundles.
- Keep tokens only in process memory or an appropriately protected secret store.
- Limit token lifetime and approved application scopes, and rotate the AppSecret if token or credential disclosure is suspected.
- Remove
