You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Getting privileged permissions using an escalated plugin by adjusting workspace
Dear Woodpecker Security Team,
I am writing to inform you about the possibility of running arbitrary code in a privileged container using the default configuration.
As you know, the default configuration has multiple containers that run in privileged mode. These include the "plugins/docker" image. (I haven't looked at the other images, though I'm sure they are vulnerable to the same or similar exploits.)
My POC uses the workspace attribute with the base set to "/use/local". This way, I can place a file at "/usr/local/bin/dockerd-entrypoint.sh" in a step before the "plugins/docker" step to overwrite the commands executed in the privileged container.
This is possible because the only things checked before allowing the setting of the container to privileged are that the "Commands" and "Entrypoint" attributes are unset using the "IsPlugin" function.
There are multiple other ways to gain code execution in the privileged container, such as setting environment variables like "LD_PRELOAD".
I only tested this in the docker runner, but looking at the code, the same should be possible for the kubernetes runner.
I'm not sure how to fix this correctly, as it is broken by design when allowing the building of docker images inside the CI.
Similar bugs exist in the Drone CI, so a scheduled disclosure with them makes sense.
I am also informing you that I am the author of a CTF Challenge where people tried to find and exploit this bug. The event was a final to a qualification with a small number of participants. Two Teams solved the challenge by finding other bugs. I will tell them to report their found vulnerability as well.
Feel free to follow up with any questions.
Best,
Daniel Kilimnik
Neodyme AG
Getting secrets value using manipulated entrypoint via adjusted workspace
create a secret called TOKEN for the plugin plugins/docker only
6543
changed the title
RESERVED
Getting privileged permissions using an escalated plugin by adjusting workspace / Getting secrets value using manipulated entrypoint via adjusted workspace
Oct 4, 2024
6543
changed the title
Getting privileged permissions using an escalated plugin by adjusting workspace / Getting secrets value using manipulated entrypoint via adjusted workspace
Getting "privileged permissions" / "secrets value" by using (... an escalated plugin and/) by adjusting workspace
Oct 4, 2024
Getting privileged permissions using an escalated plugin by adjusting workspace
Dear Woodpecker Security Team,
I am writing to inform you about the possibility of running arbitrary code in a privileged container using the default configuration.
As you know, the default configuration has multiple containers that run in privileged mode. These include the "plugins/docker" image. (I haven't looked at the other images, though I'm sure they are vulnerable to the same or similar exploits.)
My POC uses the workspace attribute with the base set to "/use/local". This way, I can place a file at "/usr/local/bin/dockerd-entrypoint.sh" in a step before the "plugins/docker" step to overwrite the commands executed in the privileged container.
This is possible because the only things checked before allowing the setting of the container to privileged are that the "Commands" and "Entrypoint" attributes are unset using the "IsPlugin" function.
There are multiple other ways to gain code execution in the privileged container, such as setting environment variables like "LD_PRELOAD".
I only tested this in the docker runner, but looking at the code, the same should be possible for the kubernetes runner.
I'm not sure how to fix this correctly, as it is broken by design when allowing the building of docker images inside the CI.
Similar bugs exist in the Drone CI, so a scheduled disclosure with them makes sense.
I am also informing you that I am the author of a CTF Challenge where people tried to find and exploit this bug. The event was a final to a qualification with a small number of participants. Two Teams solved the challenge by finding other bugs. I will tell them to report their found vulnerability as well.
Feel free to follow up with any questions.
Best,
Daniel Kilimnik
Neodyme AG
Getting secrets value using manipulated entrypoint via adjusted workspace
create a secret called
TOKEN
for the pluginplugins/docker
onlycreate this pipeline
GHSA-xw35-rrcp-g7xm
The text was updated successfully, but these errors were encountered: