🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.bsd.freebsd.announce
Article #40

FreeBSD Security Advisory FreeBSD-SA-26:97.pam_xdg

#40
From: FreeBSD Security Advisories
Date: Wed, 02 Dec 2026 23:00
163 lines
7524 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

=============================================================================
FreeBSD-SA-26:97.pam_xdg                                    Security Advisory
                                                          The FreeBSD Project

Topic:          Arbitrary file deletion via pam_xdg(8) symlink race

Category:       core
Module:         pam_xdg
Announced:      2026-12-02
Credits:        Othmane Tamagart
Credits:        OpenAI Security Research Team
Credits:        Kevin Day
Affects:        All supported versions of FreeBSD.
Corrected:      2026-12-02 19:25:52 UTC (stable/15, 15.2-STABLE)
                2026-12-02 19:27:29 UTC (releng/15.2, 15.2-RC1-p1)
                2026-12-02 19:26:27 UTC (releng/15.1, 15.1-RELEASE-p8)
                2026-12-02 19:28:17 UTC (stable/14, 14.5-STABLE)
                2026-12-02 19:29:17 UTC (releng/14.5, 14.5-RELEASE-p5)
                2026-12-02 19:28:47 UTC (releng/14.4, 14.4-RELEASE-p14)
CVE Name:       CVE-2026-127761

For general information regarding FreeBSD Security Advisories,
including descriptions of the fields above, security branches, and the
following sections, please visit <URL:https://security.FreeBSD.org/>.

I.   Background

pam_xdg(8) is a Pluggable Authentication Modules (PAM) module which
creates a per-user runtime directory, by default under /var/run/xdg/, as
specified by the XDG Base Directory Specification.  When the user's last
session ends, the module removes the directory and its contents.

II.  Problem Description

pam_xdg(8) removed the runtime directory as root, taking each entry's type
from readdir(3) and then opening subdirectories by name without
O_NOFOLLOW.  Since the directory is owned by the user, a process left
running by the user could replace a subdirectory with a symbolic link
between these steps, causing the module to delete the contents of the
link's target.

III. Impact

An unprivileged local user can delete arbitrary files and directories
as root, resulting in a Denial of Service (DoS) and, depending on the system
configuration, possibly privilege escalation.

IV.  Workaround

Systems that do not use pam_xdg(8) are not affected.  By default, it is
enabled for login(1) and xdm(1), but not for sshd(8).  The following
command lists the PAM policies that use it:

# grep -rl pam_xdg /etc/pam.d /usr/local/etc/pam.d

Removing pam_xdg(8) from these policies avoids the problem, but per-user
runtime directories will then no longer be created.

V.   Solution

Upgrade your vulnerable system to a supported FreeBSD stable or
release / security branch (releng) dated after the correction date.
Login sessions opened before the update still use the vulnerable module;
end them and restart xdm(1) if it is in use, or reboot the system.

Perform one of the following:

1) To update your vulnerable system installed from base system packages:

Systems running a 15.0-RELEASE or later version of FreeBSD on the amd64 or
arm64 platforms, which were installed using base system packages, can be
updated via the pkg(8) utility:

# pkg upgrade -r FreeBSD-base

2) To update your vulnerable system installed from binary distribution sets:

Systems running a RELEASE version of FreeBSD on the amd64 or arm64 platforms
which were not installed using base system packages can be updated via the
freebsd-update(8) utility:

# freebsd-update fetch
# freebsd-update install

3) To update your vulnerable system via a source code patch:

The following patches have been verified to apply to the applicable
FreeBSD release branches.

a) Download the relevant patch from the location below, and verify the
detached PGP signature using your PGP utility.

# fetch https://security.FreeBSD.org/patches/SA-26:97/pam_xdg.patch
# fetch https://security.FreeBSD.org/patches/SA-26:97/pam_xdg.patch.asc
# gpg --verify pam_xdg.patch.asc

b) Apply the patch.  Execute the following commands as root:

# cd /usr/src
# patch -E -p0 < /path/to/patch

c) Recompile the operating system using buildworld and installworld as
described in <URL:https://www.FreeBSD.org/handbook/makeworld.html>.

End login sessions opened before the update and restart xdm(1) if it is
in use, or reboot the system.

VI.  Correction details

This issue is corrected as of the corresponding Git commit hash in the
following stable and release branches:

Branch/path                             Hash                     Revision
- -------------------------------------------------------------------------
stable/15/                              e8c2eb7855ca    stable/15-n287076
releng/15.2/                            9ffe00d7798b  releng/15.2-n286782
releng/15.1/                            abaa5a465964  releng/15.1-n283705
stable/14/                              de4384e70dd4    stable/14-n275704
releng/14.5/                            824c8a4e8306  releng/14.5-n274938
releng/14.4/                            6dafe3458926  releng/14.4-n273839
- -------------------------------------------------------------------------

Run the following command to see which files were modified by a
particular commit:

# git show --stat <commit hash>

Or visit the following URL, replacing NNNNNN with the hash:

<URL:https://cgit.freebsd.org/src/commit/?id=NNNNNN>

To determine the commit count in a working tree (for comparison against
nNNNNNN in the table above), run:

# git rev-list --count --first-parent HEAD

VII. References

<URL:https://www.cve.org/CVERecord?id=CVE-2026-127761>

The latest revision of this advisory is available at
<URL:https://security.FreeBSD.org/advisories/FreeBSD-SA-26:97.pam_xdg.asc>
-----BEGIN PGP SIGNATURE-----

iQJPBAEBCgA5FiEEthUnfoEIffdcgYM7bljekB8AGu8FAmsQj2sbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMCwzAAoJEG5Y3pAfABrvfqEP/iwpPKIuyBXCO9vUkdih
t+3Z1ByKZF2S38IOl14GOtpOLviIxEW+gKOswDj7jAe6ImB8yX4hzYuWHwYLoCiN
jiIOvVjXTtSRG8fcJxBXDwws4/2LrY0y73R0iCT3F4OmesX2SCUk3iYIMW7MKlO1
rRkOSo2uF3WVxKjq087CkeyrLP4liQZRXdaWv6WrEkAkjL359ikAuXMhNFqZhlSc
R/k0+0OtQlKLBYFejkpsUsOHQCXpNvavH6mDeK9LbSbGK3N1QiNsbFgNQ0ow2q5P
dRhvR2p0Ee7OPnpJpWuJxaeaanw0JMrpAxVYl/4D8+elII0vz/F+3HYesvoAI6nL
hAXtZtQj7Mn6Zynpzohsc8FAhmyCRubWWCidR7Z8REdJzB+E7JHtdvVhwmaalIlu
w61Hb343p/QlDx7GQvtOtOh0ELkBzdxQsLag4vT5e9zCrhDOFnhUcSN7AF+hO994
D13d/Pqd3aVL0cnzbVYW0LGJ0OiGi/IkBz5oKBYF9VYA/aVG/aDqlS/Db+K0wfJR
8uQrqcvY10V2mNkg54v/4fiLL6+oGoN+oACPWKZDnMO/os44zcc+spV6Pt6LkS5Y
B37K4R2lcxRW2rn4A8zX1TE2aoFQN6lGrnQfpDvFwkSXYxbvRGJ0dXgvYMX5jxLh
GKweTq3tPwBlkDX8iH8KxxEb
=Ta6u
-----END PGP SIGNATURE-----
Technical Details
Message-ID: <179625241319.13115.2044426092328871299@rincewind.trouble.is>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.hispagatos.org!news.nntp4.net!news.mb-net.net!open-news-network.org!news.szaf.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.hispagatos.org!news.nntp4.net!news.mb-net.net!open-news-network.org!news.szaf.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: FreeBSD Security Advisories <security-advisories@freebsd.org>
Newsgroups: comp.unix.bsd.freebsd.announce
Subject: FreeBSD Security Advisory FreeBSD-SA-26:97.pam_xdg
Date: 2 Dec 2026 23:00:14 GMT
Lines: 163
Sender: Philip Paeps <philip@freebsd.org>
Approved: Philip Paeps <philip@trouble.is>
Message-ID: <179625241319.13115.2044426092328871299@rincewind.trouble.is>
X-Trace: individual.net EVxTIOrpfz19KPIsjr2QHwlmKfZtjhs2QEiPw4QjmHh18bCfSN
Cancel-Lock: sha1:5Kn/4e+yr89Z5hB03oynOWe+be4= sha256:PRlti5Vp5xQisYZxSmmKY4OKwiE/tM94OK8Dv0EDZYQ=