Unpatched vulnerabilities affect the rkt container runtime that could be exploited by an attacker to escape the container and gain root access to the host.

The security researchers Yuval Avrahami discovered some vulnerabilities in the rkt containter that could be exploited by an attacker to compromise the underlying host when a user executes the ‘ rkt enter’ command into an attacker-controlled pod.

rkt (pronounced like a “rocket”) is a CLI for running application containers on Linux. rkt is designed to be secure, composable , and standards-based.

The basic unit of execution at runtime is a pod, that includes multiple containers running in a shared context.

The ‘rkt enter’ command allows users to execute binaries in a running container. The binaries are executed as root, with no seccomp filtering or cgroup isolation, the only restriction is represented by namespaces.

Avrahami discovered that it is possible to escape the container by triggering the vulnerabilities.

“The ‘rkt enter’ command allows users to run a binary in a running container, and is the rkt equivalent of ‘docker exec’.” states the expert.

“Binaries from the container executed via ‘rkt enter’ run as root, with all capabilities, and with no seccomp filtering or cgroup isolation applied. They are only restricted by namespaces, which are not enough to prevent them from breaking out and compromising the host.”

Below the list of the issues reported to RedHat (who acquired CoreOS in mid-2018):

CVE-2019-10144: processes run with `rkt enter` are given all capabilities during stage 2

CVE-2019-10145: processes run with `rkt enter` do not have seccomp filtering during stage 2

CVE-2019-10147: processes run with `rkt enter` are not limited by cgroups during stage 2

The researchers published a video PoC that shows the exploitation of the above vulnerabilities.

The attacker needs to have root access to the container, then when the user runs the ‘rkt enter’ command, he can overwrite binaries and libraries in the container to run his malicious code.

For example , an attacker can overwrite /bin/bash in the container, because it is the default binary executed if the user doesn’t specify another.

The attacker could also overwrite libc.so.6 in the container, which is likely to be loaded by processes spawned with ‘rkt enter’. Using the gcc constructor attribute the code is run whenever the modified libc library is loaded by a process.

“Once an attacker is running in the context of a container process spawned by ‘rkt enter’, he can escape the container and gain root access on the host with relative ease, as he runs with all capabilities, no seccomp filtering and without cgroup isolation,” continues the security researcher.

The expert provides as an example of exploitation the escape via mounting the host’s root directory.

Mounting the host root directory using the ‘mknod’ and ‘mount’ syscalls, would give the attacker root access on the host. The expert also published a video PoC for this attack.

Avrahami reported the flaws to RedHat and CoreOS, but RedHat revealed that at the time it has no plan for addressing them. RedHat asked the expert to share his findings with the community of the users.

“While investigating rkt I also discovered a way to create malicious ACI/OCI images that will compromise the host when run. Although this is certainly not ideal, malicious images are not a part of rkt’s threat module. Running images from an untrusted source is not aligned with rkt’s recommendations nor proper use,” concludes the researcher.

“As I stated at the start of this blog, if you are using rkt , avoid using the ‘ rkt enter’ command as the vulnerabilities in it are currently unpatched . I also suggest considering alternative container runtimes which are more steadily maintained, such as Docker, podman or LXD.”

If you appreciate my effort in spreading cybersecurity awareness, please vote for Security Affairs in the section “Your Vote for the Best EU Security Tweeter”

Thank you

Pierluigi Paganini

( SecurityAffairs – rkt container, hacking)

Share this...

Linkedin Reddit Pinterest

Share On