T09 · Insecure Skill Coding Practices
- Location
scripts/dockerfile_audit.py:243- Finding
Invalid checksum verification guidance for remote Docker build artifacts
- Content
View full analysis
| sha256sum -c instead. ``` ```python fix="Use RUN curl -fsSL | sha256sum -c instead, or use COPY with a pre-downloaded file.", ``` ### Technical Analysis The Skill identifies remote `ADD` instructions as insecure but recommends piping downloaded content directly into `sha256sum -c`. This is not a valid method of comparing arbitrary downloaded bytes against an expected digest. The `sha256sum -c` option consumes a checksum manifest in a format such as: ```text /tmp/downloaded-file ``` It does not accept downloaded file contents through standard input followed by an expected hash as a positional argument. Consequently, the documented commands generally fail or interpret the input and arguments incorrectly rather than performing the promised integrity check. The issue appears both in the documentation’s pass criteria and in the remediation generated by the scanner. This can give users false confidence that a remote artifact is being securely verified. The Skill itself does not make network requests or execute these commands; the exposure arises when users copy the generated remediation into a Dockerfile or CI workflow. ### Attack Path 1. A project obtains an executable, installer, archive, or other build artifact from a remote URL. 2. The auditor reports the remote `ADD` instruction and recommends the affected `curl | sha256sum -c` command. 3. A user copies or adapts that remediation under the assumption that it validates the artifact against a trusted digest. 4. The remote hosting account, distribution endpoint, DNS path, or ...[truncated 1350 chars]- Remediation
View remediation
/tmp/file" | sha256sum -c -; \ install /tmp/file /desired/path; \ rm -f /tmp/file ``` Apply the following hardening measures: 1. Replace the invalid examples at `SKILL.md:79` and `SKILL.md:168`. 2. Replace the generated remediation at `scripts/dockerfile_audit.py:243`. 3. Ensure the expected digest is obtained through a separate trusted channel and pinned in source control. 4. Never download an expected checksum from the same unauthenticated or mutable source and treat it as independent verification. 5. Use `&&` or `set -e` so artifact installation and execution cannot continue after a failed verification. 6. Prefer `COPY` of a separately verified local artifact when practical. 7. Consider recommending signed releases or provenance verification, such as Sigstore, where supported. 8. Add automated tests confirming that a matching artifact passes and a modified artifact causes a nonzero build result. ]]>
