T09 · Insecure Skill Coding Practices
- Location
data.md:225- Finding
Sensitive Environment Variable Disclosure
- Content
View full analysis
Vulnerability Details
File Location:
data.md:225-226
Vulnerability Type: Sensitive data exposure through unsafe.envinspection
Risk Level: MediumVulnerable Code
bash # .env files grep -v '^#' .env | grep '='Technical Analysis
The documented command prints every non-comment line in the
.envfile containing an equals sign. Environment files commonly store plaintext API keys, access tokens, database credentials, passwords, and other sensitive configuration values.The command does not redact values, restrict output to variable names, obtain explicit authorization, or distinguish secrets from non-sensitive configuration. If an agent follows this guidance, complete secret values may be copied into terminal output, agent context, execution logs, conversation transcripts, or subsequent responses.
No external transmission mechanism was identified in the project. Therefore, this is an insecure secret-handling practice rather than confirmed intentional exfiltration.
Attack Path
- A user asks the agent to inspect, parse, summarize, or troubleshoot project configuration.
- The agent loads and follows the guidance in
data.md. - The agent executes
grep -v '^#' .env | grep '='in a project containing an.envfile. - All matching assignments, including secret values, are printed to standard output.
- The resulting secrets enter the agent's context, terminal logs, transcripts, or generated response.
- Anyone with access to those outputs may recover and misuse the exposed credentials.
Impact Assessment
The command itself does not grant additional operating-system privileges. The scope of potential compromise depends on the credentials stored in
.env. Exposed values could permit unauthorized access to databases, cloud services, third-party APIs, internal services, or administrative interfaces under the privileges associated with those credentials.The immediate exposure scope includes the command output, ag ...[truncated 223 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove guidance that prints complete
.envassignments. - Require explicit user authorization before accessing files likely to contain credentials.
- Enumerate variable names without exposing their values:
bash sed -nE 's/^[[:space:]]*(export[[:space:]]+)?([A-Za-z_][A-Za-z0-9_]*)=.*/\2/p' .env- If values must be validated, process them locally and emit only validation status or redacted forms.
- Redact sensitive values before including output in logs, transcripts, diagnostics, or model responses.
- Apply restrictive permissions to environment files, such as owner-only access where appropriate.
- Prefer a dedicated secret manager over plaintext
.envstorage for production credentials. - Add an explicit warning that
.envcontents must never be displayed or copied into conversational output.
- Remove guidance that prints complete
