Symlink Attack in kubectl cp
Moderate severity
GitHub Reviewed
Published
Feb 15, 2022
to the GitHub Advisory Database
•
Updated Sep 18, 2023
Package
Affected versions
< 1.11.9
>= 1.12.0, < 1.12.7
>= 1.13.0, < 1.13.5
Patched versions
1.11.9
1.12.7
1.13.5
Description
Reviewed
May 19, 2021
Published to the GitHub Advisory Database
Feb 15, 2022
Last updated
Sep 18, 2023
The kubectl cp command allows copying files between containers and the user machine. To copy files from a container, Kubernetes creates a tar inside the container, copies it over the network, and kubectl unpacks it on the user’s machine. If the tar binary in the container is malicious, it could run any code and output unexpected, malicious results. An attacker could use this to write files to any path on the user’s machine when kubectl cp is called, limited only by the system permissions of the local user. The untar function can both create and follow symbolic links. The issue is resolved in kubectl v1.11.9, v1.12.7, v1.13.5, and v1.14.0.
References