T05 · Unauthorized Access and Privilege Escalation
- Location
SKILL.md:174- Finding
Sensitive Environment-Variable Enumeration May Expose Credentials
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 174-181
Vulnerability Type: Sensitive environment-variable reconnaissance
Risk Level: MediumVulnerable Code
bash ### 3. 验证配置 配置完成后,可通过以下方式验证是否正常工作: ```bash # 验证环境变量是否设置 echo "配置检查:" env | grep -E "API|KEY|TOKEN|SECRET" | sed "s/=.*/=***/" # Linux/macOS # 或 PowerShell # Get-ChildItem Env: | Where-Object {$_.Name -match "API|KEY|TOKEN"} | Format-TableTechnical Analysis
The skill instructs the agent to enumerate all environment variables whose names contain broad secret-related terms such as
API,KEY,TOKEN, orSECRET. This operation is not required for the stated local note-management functionality and violates least-privilege principles by inspecting unrelated process credentials.The Linux/macOS command masks values before displaying the result, but it still reveals the names and presence of potentially sensitive credentials. More critically, the PowerShell command formats complete matching environment-variable objects without redacting their values. Depending on the PowerShell output format, credential values may therefore be exposed directly in the terminal, agent context, conversation transcript, or execution logs.
No credential transmission or unauthorized account access is implemented in the audited file. Nevertheless, exposing a valid credential can enable subsequent access with the permissions assigned to that credential.
Attack Path
- A user or agent follows the skill's configuration-verification instructions.
- On Windows, the agent executes the provided PowerShell command.
- PowerShell locates every environment variable whose name contains
API,KEY, orTOKEN. - The formatted output may include both the names and values of matching variables.
- These values enter the agent's context, terminal history, session transcript, or centralized execution logs.
- Any party able to read those ou ...[truncated 861 chars]
- Remediation
View remediation
Remediation Suggestions
-
Remove broad environment enumeration from the configuration-verification procedure.
-
Identify the exact environment variable required by the skill and test only whether that variable exists.
-
Never print, format, log, or return credential values to the agent or user.
-
Use a presence-only check, such as:
bash if [ -n "${EXPECTED_API_KEY:-}" ]; then echo "EXPECTED_API_KEY is configured" else echo "EXPECTED_API_KEY is not configured" fipowershell if (Test-Path Env:EXPECTED_API_KEY) { Write-Output "EXPECTED_API_KEY is configured" } else { Write-Output "EXPECTED_API_KEY is not configured" } -
Prevent command output containing secrets from being added to conversation transcripts, telemetry, or persistent logs.
-
Document the minimum required credential scope and recommend short-lived, least-privileged tokens.
-
If the PowerShell command has previously been executed, inspect relevant transcripts and logs and rotate any credentials that may have been exposed.
-
