Where
-Infinity
0
Severity
1

The newgidmap and newuidmap helper utilities accept a directory file descriptor identifying a target process's /proc/<pid>/ directory, and validate that this descriptor refers to the procfs filesystem by comparing device numbers (stdev/strdev) against a known procfs path. After this check, the utilities open a file (for example "setgroups") by name relative to that directory descriptor and write privileged uid/gid mapping data to it.

An unprivileged local user can defeat this validation using Linux user and mount namespaces: by bind-mounting an arbitrary, attacker-chosen file over the expected child path inside a procfs directory they hold a descriptor to, the device-number check (which only inspects the directory itself) still passes, while the subsequent open-by-name resolves through the bind mount to the attacker's chosen file instead of the intended procfs file. This redirects the helper's privileged write, resulting in the first five bytes of the attacker-chosen file being overwritten with the fixed content "deny\n".

This was reported publicly, with a working proof of concept demonstrating the primitive against a SUID-root build of newgidmap, and fixed upstream in shadow 4.20.4 by using openat2(2) with RESOLVENOXDEV for path resolution and by removing the affected "fd:N" argument form entirely.

First published (updated )

Hi!

I've released publicly shadow-4.20.4 a moment ago. Below are the details about the security issues (from the previous email, to linux-distros@).

The release is available at <https://github.com/shadow-maint/shadow/releases/tag/4.20.4>.

Have a lovely night! Alex Date: 2026-11-14 23:23:41+0100 From: Alejandro Colomar <alx () kernel org>

Hi!

Below goes the original bug report. Date: Fri, 6 Nov 2026 20:43:45 -0500 From: Dickson Wu <dickson.wu () certik com> To: alx () kernel org, ipedrosa () redhat com, serge () hallyn com Subject: Security report: newgidmap (encrypted) Message-ID: <CAFaZ9eqJ18S7PsVj5Rj9wustfU2eNZrGqXp4AJD1+yROc1u3Q () mail gmail com>

Hi Alejandro, Iker and Serge,

I'm reporting a local issue in newgidmap, following SECURITY.md (encrypted to the three keys listed there).

newgidmap fd:N checks that the passed directory FD is on the procfs device, then opens "setgroups" relative to it with ORDWR as root and writes "deny\n". An unprivileged user can, inside their own user and mount namespace, bind-mount a root-owned file over setgroups under a task directory of the host procfs and pass that directory FD back to newgidmap. The device check passes because the directory itself is still on procfs, and the first five bytes of the target file become "deny\n". Mapping the caller's own GID is enough to reach writesetgroups(), so no subgid entry is needed, and the later gidmap failure doesn't undo the write.

I reproduced it on the 4.20.3 release with the helper installed SUID root and a disposable root-owned 0600 file: the first five bytes changed and the rest of the file, owner and mode stayed the same, while a fresh-procfs control was rejected and left its file untouched. getpid.c and newgidmap.c are the same on current master. It's a fixed five-byte write at offset 0, so I'd call it a local integrity/DoS issue rather than code execution.

Report, affected lines, a suggested fix (fstat the opened setgroups FD, or openat2 with RESOLVENOXDEV) and the PoC are here:

<https://gist.github.com/DicksonWu654/cdad661068d6a50da475aac57a9f07f2>

Happy to test a fix or answer questions whenever it's useful.

Best, Dickson We worked on this patch set of two patches (sent as replies to this mail), which applies on top of the 4.20.3 release to fix the bug. If you need help backporting it to older versions, let me know (but I think it should be relatively easy).

Let's use an embargo of 1 week, so let's disclose on 2026-11-22.

I haven't encrypted this patch set, since we've already been discussing it unencrypted, and it's also not critical.

Have a lovely night! Alex

Serge E. Hallyn (2): lib/idmapping.c, src/newidmap.c: Use openat2(2) for safety src/new[gu]idmap.c: Drop fd:N

lib/Makefile.am | 2 ++ lib/atoi/getnum.c | 1 - lib/atoi/getnum.h | 9 --------- lib/fs/open/open.c | 48 +++++++++++++++++++++++++++++++++++++++++++++ lib/fs/open/open.h | 16 +++++++++++++++ lib/getpid.c | 32 ------------------------------ lib/idmapping.c | 3 ++- lib/prototypes.h | 1 - man/newgidmap.1.xml | 11 ----------- man/newuidmap.1.xml | 11 ----------- src/newgidmap.c | 20 +++++++------------ src/newuidmap.c | 17 ++++------------ 12 files changed, 79 insertions(+), 92 deletions(-) create mode 100644 lib/fs/open/open.c create mode 100644 lib/fs/open/open.h

-- 2.55.0 -- <https://www.alejandro-colomar.es>

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203