[PATCH 1/2] security: safesetid: use real GID for GID policy lookup
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Sat Oct 3 10:39:50 UTC 2026
> From: Sung Byeongchan <tjdqudcks0424 at naver.com>
>
> SafeSetID policies constrain the ID transitions available to a task for
> each source ID. id_permitted_for_cred() always builds that source key
> from the old real UID, even when it is checking a GID transition. If the
> real UID and real GID differ, the policy attached to the real GID is
> therefore missed and the lookup can return the unconstrained default.
>
> On current mainline, a test task with real UID 1000, real GID 2000 and
> only CAP_SETGID obtained non-allowlisted GID 2002 despite a 2000:2001 GID
> policy. The bypass reproduced for setgid(), setegid(), setregid(),
> setresgid(), setfsgid() and setgroups() across three clean QEMU boots,
> and enabled access to a synthetic group-protected resource. This shows
> a SafeSetID GID policy bypass and group privilege expansion; it does not
> show direct UID 0 elevation or a universal local privilege escalation.
>
> Build the source key from the old real UID for UID policy checks and the
> old real GID for GID policy checks. In three fixed-kernel boots, all
> tested non-allowlisted transitions were blocked while the allowed target,
> existing-ID, no-policy and UID-policy controls, and the existing SafeSetID
> selftest continued to pass.
>
> Fixes: 5294bac97e12 ("LSM: SafeSetID: Add GID security policy handling")
> Cc: stable at vger.kernel.org
> Assisted-by: OpenAI Codex
> Signed-off-by: Sung Byeongchan <tjdqudcks0424 at naver.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1791023194.git.tjdqudcks0424@naver.com?part=1
More information about the Linux-security-module-archive
mailing list