T09 · Insecure Skill Coding Practices
- Location
SKILL.md:34- Finding
Plaintext Logging of Potentially Sensitive Environment Variable Values
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 34–46
Vulnerability Type: Plaintext storage of potentially sensitive data
Risk Level: MediumVulnerable Code Snippet:
markdown ## 记录要求 默认把环境变量变更记录写到: - `logs/env-change-log.md` 每次记录至少包含: - 时间 - 改了哪个变量 - 修改前是什么 - 修改后是什么 - 为什么要改Technical Analysis
The Skill requires every environment-variable change record to contain both the previous and new values. It does not exclude secret-bearing variables or require sensitive values to be detected and redacted.
Environment variables commonly store API keys, access tokens, passwords, private connection strings, and other credentials. Following these instructions when modifying such a variable would place both the old and replacement secrets in plaintext in the predictable project-local file
logs/env-change-log.md. This also preserves credentials after the original environment variable has been changed or rotated.No automatic code execution or privilege escalation is involved. Exploitation requires the Skill to process a sensitive variable and an unauthorized party subsequently to gain access to the generated log through the workspace, source control, backups, shared artifacts, or another local access path.
Attack Path
- A user asks an agent using this Skill to change an environment variable containing a credential.
- The agent follows the mandatory logging instructions.
- The agent writes the variable's old and new plaintext values to
logs/env-change-log.md. - The log is committed to source control, included in a backup or artifact, shared with another party, or read by another user or agent with workspace access.
- The unauthorized party extracts the credential and uses it against the service or resource to which that credential grants access.
Impact Assessment
Disclosure is limited to values recorded in the log, but those values may grant access to externa ...[truncated 535 chars]
- Remediation
View remediation
Remediation Suggestions
- Prohibit logging the values of secret-bearing environment variables. Record only the timestamp, variable name, reason, operation type, and whether the change succeeded.
- Detect sensitive names such as
TOKEN,SECRET,PASSWORD,PASS,API_KEY,PRIVATE_KEY, and credential-bearing connection variables. Treat uncertain values as sensitive by default. - If change correlation is necessary, store a non-reversible fingerprint or a heavily redacted representation, such as
sha256:…9f2aorsk-…9f2a, rather than the original value. - Require explicit user consent before logging any non-secret value.
- Add
logs/env-change-log.mdto.gitignoreand equivalent artifact-exclusion rules. - Create the log with restrictive file permissions and document retention and secure-deletion requirements.
- Add a mandatory pre-write check that aborts or redacts the record whenever the value resembles a credential, token, private key, password, or authenticated connection string.
