T09 · Insecure Skill Coding Practices
- Location
scripts/env.py:8- Finding
Unrestricted Disclosure of Sensitive Environment Variables
- Content
View full analysis
Vulnerability Details
File Location:
scripts/env.py:8-11
Related Documentation:SKILL.md:16-17,SKILL.md:23-24
Vulnerability Type: Sensitive environment-variable exposure
Risk Level: MediumVulnerable Code
python if args.var: print(os.environ.get(args.var, '')) else: for k, v in sorted(os.environ.items()): print(f"{k}={v}")The documented default usage explicitly invokes this unrestricted behavior:
markdown - List all environment variables with valuesbash # List all environment variables env-toolTechnical Analysis
When invoked without an argument, the script enumerates the complete inherited process environment and prints every variable name and raw value. It does not apply secret-name filtering, value redaction, access confirmation, or an explicit opt-in requirement.
Environment variables in agent, development, container, and CI/CD environments frequently hold API keys, access tokens, passwords, signing credentials, cloud credentials, and internal service configuration. Printing these values can place them in terminal history, agent context, execution transcripts, CI logs, or any system collecting standard output.
The project contains no network request or direct exfiltration mechanism. Consequently, this finding concerns local disclosure through output rather than demonstrated transmission to an external party.
Attack Path
- A user or agent follows the documented example and invokes
env-toolwithout a variable name. - The script enters the
elsebranch and callsos.environ.items(). - Every inherited environment variable is formatted as
NAME=value. - Secret-bearing values are written in plaintext to standard output.
- The output may subsequently be retained in agent conversations, CI logs, terminal recordings, monitoring systems, or other downstream output consumers.
- Any party able to access those records may recover the exposed credentials and use them wi ...[truncated 585 chars]
- A user or agent follows the documented example and invokes
- Remediation
View remediation
Remediation Suggestions
- Make variable names without values the default output for bulk enumeration.
- Require an explicit option such as
--show-valuesbefore printing any values. - Require additional confirmation before displaying all values in an interactive session.
- Redact variables whose names indicate sensitive content, including names containing
TOKEN,SECRET,PASSWORD,PASS,KEY,CREDENTIAL,AUTH, orCOOKIE. - Prefer an allowlist of variables that are safe to display rather than relying only on a denylist.
- Preserve targeted lookup as the primary workflow, but warn users when requesting a likely sensitive variable.
- Update
SKILL.mdso it does not recommend unrestricted value enumeration. - Avoid writing unredacted environment output to logs, agent context, telemetry, or persistent execution records.
A safer default implementation would resemble:
python if args.var: value = os.environ.get(args.var, '') print(value) else: for key in sorted(os.environ): print(key)Bulk value display, if retained, should be placed behind a clearly named explicit option and should redact likely secrets.
