T09 · Insecure Skill Coding Practices
- Location
SKILL.md:27- Finding
Unsafe Reflection of Untrusted Values in Error Messages
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, line 27
Vulnerability Type: Unsafe error handling and potential sensitive-data disclosure
Risk Level: MediumCode Snippet:
markdown - When an invariant is checked, include the unexpected value in the error so debugging is possible.Technical Analysis
The instruction broadly recommends including unexpected, potentially untrusted values in error messages. Because validation errors may be returned to clients, recorded in application logs, displayed in terminals, or rendered by monitoring interfaces, reflecting raw values without safeguards can expose sensitive information or create an injection path.
An attacker could supply values containing credentials, personal information, newline characters, terminal escape sequences, markup, or excessively large content. If the generated implementation follows this guidance literally, those values may cause log injection, terminal manipulation, unsafe content rendering, log amplification, or disclosure of confidential data.
Attack Path
- An attacker submits an invalid value through an external trust boundary such as an HTTP request, CLI argument, file, API response, or user message.
- The value contains sensitive content or a crafted payload, such as forged log lines, control characters, terminal escape sequences, or markup.
- Input validation rejects the value and, following the Skill's instruction, embeds the raw unexpected value in an error.
- The application returns or records the error in a client response, log, terminal, monitoring platform, or web-based error viewer.
- The attacker-controlled value may disclose sensitive information, corrupt log integrity, manipulate terminal output, or become unsafe content in downstream systems.
Impact Assessment
This issue does not directly grant operating-system privileges or unauthorized code execution. Its primary impact is on confidentiality ...[truncated 328 chars]
- Remediation
View remediation
Remediation Suggestions
Replace the instruction with guidance that distinguishes safe diagnostic metadata from raw input values:
- Prefer reporting the field name, expected type or range, failure reason, and a correlation identifier.
- Do not include passwords, tokens, session identifiers, personal data, or other secrets in errors or logs.
- Keep client-facing errors generic and place necessary diagnostic details only in access-controlled server logs.
- If recording an input value is essential, apply explicit redaction, strict length limits, and contextual encoding.
- Escape or remove newline characters, control characters, and terminal escape sequences before logging.
- Ensure web-based error and log interfaces encode content for the relevant output context.
- Configure retention and access controls for logs that may contain user-supplied data.
A safer replacement would be:
markdown - When an invariant fails, report the field name, expected constraint, and a correlation ID. Do not include raw untrusted values unless they have been redacted, escaped, and truncated; never expose sensitive values in client-facing errors.
