Impact & Risk Analysis
- Severity: Medium
- CIS Benchmark: CIS 4.9
- Impact: Malicious File Download & Zip Bombs. The
ADDinstruction can retrieve files from remote URLs and automatically unpack them. This introduces security risks where malicious files might be downloaded without scanning, or vulnerabilities associated with decompression (like Zip Bombs) could be exploited.
Common Misconfiguration
Using theADD instruction to copy files into the image. While ADD allows for remote file retrieval and auto-extraction, these features make the build process unpredictable and potentially insecure compared to the COPY instruction.
Vulnerable Example
Secure Example
Audit Procedure
Run the command below to get the list of images:ADD instructions:
ADD instructions present.
Remediation
You should useCOPY rather than ADD instructions in Dockerfiles. The COPY instruction simply copies files from the local host machine to the container file system without the risks associated with remote URL retrieval or automatic decompression.
