Sphere
Log in Join

CVE-2025-32463 sudo chroot escape: what I did on our Debian 12 CI runners

## The day it landed

CVE-2025-32463 hit the lists: a local user could abuse sudo's --chroot (-R) option to load an attacker-controlled nsswitch config and end up with root. Affected releases are in the 1.9.14 to 1.9.16 range, fixed in 1.9.17p2. Our Debian 12 runners were on 1.9.13p3, outside the range, which was a relief. Our one Ubuntu 24.04 build box was not:

$ sudo -V | head -1
Sudo version 1.9.15p5

That box lets contractors run jobs, so I treated it as urgent.

## Reproducing it carefully

I am not going to paste a working exploit into a post like this, but the shape is a single command against a directory you control:

sudo -R /tmp/fakeroot id

On a vulnerable sudo this can drop you into a root context. On a patched one the option is simply gone:

sudo: the -R option is no longer supported

That is the whole fix, by the way. Upstream removed --chroot rather than trying to police the config loading, which is blunt but effective. If anything in your estate relies on -R, it is going to break and you want to know before the upgrade, not after.

## The upgrade

On Ubuntu 24.04:

apt-get update
apt-get install --only-upgrade sudo
sudo -V | head -1
Sudo version 1.9.17p2

Then I swept the rest of the estate with ansible just to get everyone onto the same version. I would rather have one boring uniform number than argue about which minor is affected. The Debian machines needed no change, but I bumped them anyway since 1.9.13p3 is ancient and there will be another one of these. I also disabled the chroot plugin on that box after upgrading, because nothing legitimate needed it. A quick grep through /etc/sudoers.d found two more rules I could delete, which cut the attack surface more than the version bump did.

## What broke

We had one legacy build script doing this:

sudo -R /opt/buildenv make package

It started failing immediately with the "no longer supported" error above. I had forgotten this step existed; it was in a shell script last touched in 2022. The fix was to give the build user a proper confined account and call chroot directly under a sudoers rule that only permits that exact binary:

deploy ALL=(root) NOPASSWD: /usr/sbin/chroot /opt/buildenv /usr/bin/make

Narrower than what we had, honestly. I should have done it years ago.

## The check I added

A line in the runner image build so we do not drift again:

sudo -V | head -1 | grep -Eq '1\.9\.(17p[2-9]|[2-9][0-9])' || exit 1

Ugly regex, but it fails the image build rather than quietly shipping an old sudo. I also grep our scripts for -R now, which found two more uses in a forgotten docs repo. If you run CI with shared access, go look at your sudo version today; the repo you think is clean usually is not.