Apptainer blocked the SUID based exploit
Gregory Kurtzer tests the newly disclosed pkexec vulnerability in polkit against an Apptainer container to see whether the privilege escalation carries through the container runtime. On a Rocky Linux 8.4 host with a vulnerable polkit package, running the compiled exploit as a regular user yields a root shell almost immediately.
He then builds a Rocky Linux container from the default Docker Hub container image, deliberately installing the vulnerable polkit and polkit-libs packages, and opens a shell inside it with Apptainer. Running the same payload inside the container fails: pkexec reports that it must be installed setuid root, even though it is, because Apptainer blocks the privilege escalation path. The takeaway for HPC and shared-system administrators is that users running workloads through Apptainer or Singularity are not exposed to this exploit via the container runtime.
Key takeaways
- On a Rocky Linux 8.4 host with a vulnerable polkit, the compiled pkexec exploit gives a regular user a root shell in seconds.
- The test container is built from the default Rocky Linux Docker Hub image with vulnerable polkit and polkit-libs deliberately installed.
- Inside the apptainer shell the same payload fails, and pkexec only reports that it must be installed setuid root.
- apptainer builds single-file containers, so the whole container can be executed directly or entered with an interactive shell.
- Users running through Apptainer or Singularity are not exposed to this pkexec exploit via the container runtime.
Questions this video answers
Does the pkexec polkit exploit work inside an Apptainer container?
No. In this test the exploit gains root on the host but fails inside an Apptainer container that has the same vulnerable polkit packages installed. Apptainer blocks the setuid-based privilege escalation, so pkexec falls back to an error saying it must be installed setuid root, even though the binary is setuid root.
How was the apptainer test environment set up?
The host runs Rocky Linux 8.4 with a vulnerable polkit version. A Rocky Linux container is built from a recipe that pulls the default image from Docker Hub and installs polkit and polkit-libs at the vulnerable versions. Apptainer then opens a shell inside the single-file container as the same unprivileged user.
This video is part of the Apptainer playlist. Browse every CIQ video by product and topic.
Transcript
hello so i was playing with the recent vulnerability that was just announced this morning around pk exact in pulkit and uh i was curious is this vulnerable vulnerability um susceptible when when running on a system through a apptaner or a singularity container and so decided to test it and document my findings so here's my host system you can see i'm running a 8.4 version of rocky linux if i look at what version of pulkit is installed you'll see it is a vulnerable version and you can see i'm running as as me in this directory i have the exploit code already compiled and if i execute
that exploit code you'll see i am now root uh it was pretty easy to get root as you can see uh so now what i'm curious on is as i said does this work when i'm running through an optaner container so i've created a rocky container using this recipe where i'm basically taking uh out of docker hub i'm taking the rocky container and the default rocky container and i'm basically just installing these two packages in there pull kit and pulkit libs i'm using this rep this method just to ensure that i am getting the vulnerable versions of these uh these packages and then i built
that and you can see here's the container file if you're not familiar with apptaner or singularity this container system builds single file based containers so inside that single executable file i have my entire container and i can execute that file directly or i can use Apptainer to to basically get an active shell inside of that container which is what i'm going to do so so now you can see i'm sitting inside of this this container and you can see my host was running rocky linux 8.4 now i'm sitting in 8.5 inside of this container i did install as you saw in the previous recipe
file that pull kit is installed and it is again it is a vulnerable version of pull kit which then means i should be able to run this exploit oh and i should show you i am me i am not root inside of this container so if i run this this payload in this in the current directory which by the way again is the current directory where i started so if i run the payload here i should end up with um root i should end up with a root prompt but i'm not uh it's actually is blocking the privilege escalation going through pk exec and pk
View full transcriptHide full transcript
exec doesn't exactly know why that it's not running with the appropriate uh privileges so it just gives a default error message saying that pk exact must be installed set uid root let's just confirm that it actually is and it is as you can see is actually installed setuid root but the act the exploit did not work so if you do have users on your systems that are using apptaner or singularity this exploit is not going to be vulnerable through this container runtime so that was the the gist of what i wanted to show if you have any questions please feel free to reach out to
myself the optaner community or my company control iq thank you
Built for scale. Chosen by the world’s best.
2.75M+
Rocky Linux instances
Being used world wide
90%
Of fortune 100 companies
Use CIQ supported technologies
250k
Avg. monthly downloads
Rocky Linux
9
Enterprise products
Spanning the kernel to the orchestrator
Have questions about your infrastructure?
Talk to a CIQ engineer about Rocky Linux, HPC, and AI infrastructure.
