4.9 Ensure that COPY is used instead of ADD in Dockerfiles

Information

You should use the COPY instruction instead of the ADD instruction in the Dockerfile.

Rationale:

The COPY instruction simply copies files from the local host machine to the container file system. The ADD instruction could potentially retrieve files from remote URLs and perform operations such as unpacking them. The ADD instruction therefore introduces security risks. For example, malicious files may be directly accessed from URLs without scanning, or there may be vulnerabilities associated with decompressing them.

Impact:

Care needs to be taken in implementing this control if the application requires functionality that is part of the ADD instruction, for example, if you need to retrieve files from remote URLs.

NOTE: Nessus has not performed this check. Please review the benchmark to ensure target compliance.

Solution

You should use COPY rather than ADD instructions in Dockerfiles.

Default Value:

Not Applicable

See Also

https://workbench.cisecurity.org/files/4532

Item Details

Category: CONFIGURATION MANAGEMENT

References: 800-53|CM-6, 800-53|CM-7, CSCv7|5.2

Plugin: Unix

Control ID: d6543cad92622d857d1f536cc798c260df7d6162f776b2d4d7a73877e6d8f22d