T09 · Insecure Skill Coding Practices
- Location
SKILL.md:218- Finding
Rewrite Policy Preserves Known Security and Safety Defects
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 218-235
Vulnerability Type: Unsafe defect-preservation policy
Risk Level: MediumVulnerable Skill Instructions
The following is an English rendering of the relevant instructions:
markdown Core principle: functional flow takes priority. The source code supplied by the user represents the existing functional implementation flow. Even if the code contains errors, its complete functional flow must be understood before modification. The existing functional flow must not be damaged merely to comply with the specification. Regarding bugs in the original code: - Bugs in the original code are part of the "functional flow." - If a bug is behavior the user expects to preserve, such as a known workaround, preserve it. - If the original code contains syntax errors and cannot compile, identify the problem but do not fix it without authorization. - Unless explicitly requested by the user, do not change the functional logic of the original code.Technical Analysis
The rewrite policy conflates intended externally observable behavior with implementation defects. It directs the Agent to preserve bugs by default and discourages correction unless the user explicitly requests a functional change.
In embedded firmware, an implementation defect can include an out-of-bounds access, integer overflow, unchecked buffer length, race condition, missing timeout, unsafe register operation, invalid interrupt synchronization, fail-open error handling, or undefined behavior. Preserving such a defect during a standards-oriented rewrite can produce code that appears cleaner and more trustworthy while retaining the original vulnerability.
The risk is heightened because the Skill advertises production-grade output and includes guidance for automotive, aerospace, industrial, and military systems. Formatting and structural improvements may obscure the conti ...[truncated 1670 chars]
- Remediation
View remediation
Remediation Suggestions
- Replace the instruction to preserve bugs with a requirement to preserve only documented, intended, externally observable behavior.
- Require the Agent to distinguish among:
- Intended behavior.
- Documented hardware workarounds.
- Compatibility constraints.
- Security defects.
- Safety defects.
- Syntax errors and undefined behavior.
- Require a security and safety review before completing every rewrite.
- Never silently preserve memory-safety defects, undefined behavior, invalid synchronization, missing bounds checks, or fail-open error handling.
- If changing a defect could alter compatibility, require the Agent to:
- Describe the defect clearly.
- Explain its security or safety consequences.
- Provide a corrected implementation.
- Optionally provide a separate compatibility-preserving variant.
- Allow documented hardware workarounds to remain only when their purpose, affected hardware revision, assumptions, and validation evidence are recorded.
- Change the syntax-error policy so that non-compiling output is not presented as a completed production-grade rewrite.
- Add an explicit checklist item confirming that the rewritten output contains no known unresolved security or safety defects.
- Clearly label any intentionally unresolved issue in the final output and prevent claims of production readiness until it is resolved.
