T05 · Unauthorized Access and Privilege Escalation
- Location
SKILL.md:173- Finding
Unnecessary Credential Environment Enumeration
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 173–178
Vulnerability Type: Credential discovery through excessive system access
Risk Level: MediumVulnerable Code
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 credential-related terms. This access is unnecessary for the stated diagram-generation functionality and violates least-privilege principles.
The Unix pipeline masks values before displaying them, but it still reveals the existence and names of potentially sensitive variables. Those names can disclose configured services, authentication mechanisms, infrastructure providers, and security tooling.
The PowerShell alternative is more dangerous because
Get-ChildItem Env:returns both variable names and values. Filtering the resulting objects by name and sending them toFormat-Tablecan display plaintext API keys and tokens. Because the Skill declaresexecaccess, an Agent following these instructions may place the output into terminal logs, model context, transcripts, or other execution records.The reviewed file does not contain instructions to transmit discovered credentials to a remote party. The confirmed issue is unnecessary credential reconnaissance and potential local disclosure rather than confirmed exfiltration.
Attack Path
- A user installs or invokes the Skill for diagram generation.
- The user or Agent follows the environment-validation instructions in
SKILL.md. - The Agent executes the Unix or PowerShell environment-enumeration command with the current process privileges.
- The command searches the entire inherited environment for names associated with API keys, tokens, or secrets.
- On Unix, sensitive variable names are discl ...[truncated 1156 chars]
- Remediation
View remediation
Remediation Suggestions
-
Remove broad environment enumeration from the setup and validation instructions.
-
Validate only the explicitly required variable by its exact name, without printing its value. For example:
bash if [ -n "${REQUIRED_API_KEY:-}" ]; then printf '%s\n' "REQUIRED_API_KEY is configured" else printf '%s\n' "REQUIRED_API_KEY is not configured" fi -
Use an equivalent presence-only check in PowerShell:
powershell if ($null -ne $env:REQUIRED_API_KEY -and $env:REQUIRED_API_KEY.Length -gt 0) { Write-Output "REQUIRED_API_KEY is configured" } else { Write-Output "REQUIRED_API_KEY is not configured" } -
Never pass secret values into Agent prompts, command output, logs, error messages, or conversation history.
-
Document the exact credentials needed by each optional external integration rather than searching for generic terms such as
API,KEY,TOKEN, orSECRET. -
Reassess whether
execpermission is required for ordinary Mermaid text generation. Remove it or restrict execution to narrowly defined rendering commands where the host platform supports tool-level allowlisting. -
Add output redaction as defense in depth, but do not treat redaction as a substitute for avoiding unnecessary secret access.
-
