Hacking

Gaining Root Access to Host through rkt Container hack

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

[adrotate banner=”9″] [adrotate banner=”12″]

Pierluigi Paganini

(SecurityAffairs – rkt container, hacking)

[adrotate banner=”5″]

[adrotate banner=”13″]

Pierluigi Paganini

Pierluigi Paganini is member of the ENISA (European Union Agency for Network and Information Security) Threat Landscape Stakeholder Group and Cyber G7 Group, he is also a Security Evangelist, Security Analyst and Freelance Writer. Editor-in-Chief at "Cyber Defense Magazine", Pierluigi is a cyber security expert with over 20 years experience in the field, he is Certified Ethical Hacker at EC Council in London. The passion for writing and a strong belief that security is founded on sharing and awareness led Pierluigi to find the security blog "Security Affairs" recently named a Top National Security Resource for US. Pierluigi is a member of the "The Hacker News" team and he is a writer for some major publications in the field such as Cyber War Zone, ICTTF, Infosec Island, Infosec Institute, The Hacker News Magazine and for many other Security magazines. Author of the Books "The Deep Dark Web" and “Digital Virtual Currency and Bitcoin”.

Recent Posts

US offers a $10 million reward for information on four Iranian nationals

The Treasury Department's Office of Foreign Assets Control (OFAC) sanctioned four Iranian nationals for their…

2 hours ago

The street lights in Leicester City cannot be turned off due to a cyber attack

A cyber attack on Leicester City Council resulted in certain street lights remaining illuminated all…

2 hours ago

North Korea-linked APT groups target South Korean defense contractors

The National Police Agency in South Korea warns that North Korea-linked threat actors are targeting…

14 hours ago

U.S. Gov imposed Visa restrictions on 13 individuals linked to commercial spyware activity

The U.S. Department of State imposed visa restrictions on 13 individuals allegedly linked to the…

1 day ago

A cyber attack paralyzed operations at Synlab Italia

A cyber attack has been disrupting operations at Synlab Italia, a leading provider of medical…

1 day ago

Russia-linked APT28 used post-compromise tool GooseEgg to exploit CVE-2022-38028 Windows flaw

Russia-linked APT28 group used a previously unknown tool, dubbed GooseEgg, to exploit Windows Print Spooler…

1 day ago

This website uses cookies.