FreeBSD Security Advisory FreeBSD-SA-26:42.unlinkat
30 June, 2026
•
by security-advisories@freebsd.org
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
=============================================================================
FreeBSD-SA-26:42.unlinkat Security Advisory
The FreeBSD Project
Topic: unlinkat(2) ignores AT_RESOLVE_BENEATH flag
Category: core
Module: unlinkat
Announced: 2026-06-30
Credits: Yuxiang Yang, Yizhou Zhao, Ao Wang, Xuewei Feng, Qi Li,
and Ke Xu from Tsinghua University using GLM-5.1 from Z.ai
Affects: All supported versions of FreeBSD.
Corrected: 2026-06-30 17:20:10 UTC (stable/15, 15.1-STABLE)
2026-06-30 17:21:59 UTC (releng/15.1, 15.1-RELEASE-p1)
2026-06-30 17:21:27 UTC (releng/15.0, 15.0-RELEASE-p11)
2026-06-30 17:19:51 UTC (stable/14, 14.4-STABLE)
2026-06-30 17:20:59 UTC (releng/14.4, 14.4-RELEASE-p7)
2026-06-30 17:20:33 UTC (releng/14.3, 14.3-RELEASE-p16)
CVE Name: CVE-2026-49421
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
The unlinkat(2) and funlinkat(2) system calls remove directory entries
relative to a given file descriptor. The AT_RESOLVE_BENEATH flag
restricts path resolution so that it cannot ascend above the starting
directory, providing a path-containment guarantee that may be relied upon
when processing paths from an untrusted source.
II. Problem Description
The kernel function that implements unlinkat(2) and funlinkat(2) validated
the AT_RESOLVE_BENEATH flag but failed to pass it through to the
underlying path lookup. The flag was silently dropped, so path
resolution was not actually restricted.
III. Impact
A process that uses AT_RESOLVE_BENEATH with unlinkat(2) or funlinkat(2)
to confine path resolution can in fact resolve paths above the starting
directory. A caller relying on this flag for path containment may
delete files outside the intended directory tree.
IV. Workaround
No workaround is available. Applications that do not use
AT_RESOLVE_BENEATH with unlinkat(2) or funlinkat(2) are not affected.
V. Solution
Upgrade your vulnerable system to a supported FreeBSD stable or
release / security branch (releng) dated after the correction date, and
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
# shutdown -r +10min "Rebooting for a security update"
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
# shutdown -r +10min "Rebooting for a security update"
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.
[FreeBSD 15.x]
# fetch https://security.FreeBSD.org/patches/SA-26:42/unlinkat-15.patch
# fetch https://security.FreeBSD.org/patches/SA-26:42/unlinkat-15.patch.asc
# gpg --verify unlinkat-15.patch.asc
[FreeBSD 14.x]
# fetch https://security.FreeBSD.org/patches/SA-26:42/unlinkat-14.patch
# fetch https://security.FreeBSD.org/patches/SA-26:42/unlinkat-14.patch.asc
# gpg --verify unlinkat-14.patch.asc
b) Apply the patch. Execute the following commands as root:
# cd /usr/src
# patch -E -p0 < /path/to/patch
c) Recompile your kernel as described in
<URL:https://www.FreeBSD.org/handbook/kernelconfig.html> and 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/ 45f1fcb9d2f7 stable/15-n284326
releng/15.1/ 63a8e7bc0412 releng/15.1-n283571
releng/15.0/ 278ebff1ee51 releng/15.0-n281073
stable/14/ 7982ae91a51a stable/14-n274451
releng/14.4/ 9a6bccc57c68 releng/14.4-n273733
releng/14.3/ acfff8b35bfe releng/14.3-n271533
- -------------------------------------------------------------------------
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-49421>
The latest revision of this advisory is available at
<URL:https://security.FreeBSD.org/advisories/FreeBSD-SA-26:42.unlinkat.asc>
-----BEGIN PGP SIGNATURE-----
iQJPBAEBCgA5FiEEthUnfoEIffdcgYM7bljekB8AGu8FAmpEEkMbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMCwzAAoJEG5Y3pAfABrv7KgP/21qi7igC4TUd2Hjk7l+
L97zhQeW3TqERBHPTNdeHF2R4dgyGzI/tYUS48btWN6rOUDS3137UE+u1dBkZPIY
MpdTszKSGZQz/wjd6M1utUWIZzGSOa+L60RSzsEucSQHwiBkNXK4hCSW9TIG3Dug
oF8HW6HIv3oZkrSET34+WWcrSWiXvEow3N0B7ICWfFp1b7rzwo7fMqhCL/1SVDtF
3hfUz6OC13HC7MVe44nHKW1LodC9fyekyfY5kD167FZtvgeIy2kn+D+ZOsJIVPsI
tgiJCerS+R9GWIhdeJcCPT+Prq/LO8Vb7x0ggTO2ejJVqwcFWgJTP4aZrtNEC0is
iYuAJPRSCHdRjBQC2ELGZVDHN4ybm8UAlkImKc48pl6ey0xTQb+iaTUKeghbupUW
7/lPpwaOHWObCwn1a5CXcTJ2LwX6vZYdLoCXM69/bTQ9fHI1zI4qo+PUUqwNVg9s
7hsWd9Y/fDXPofDI+vgnXmq87A2EGcQ6iIh5YGEkayfVfpjTJSzZ7wfUtPjRLyqt
QdMtnpFI0mnMIBmKX4ESZh2hB7E6ZG/J2Ky6ll/fA+5ITvE/D2qpzSYljOzu9ZV1
t3UQvMNWkq4cBjJiHpvVR73Bj5vyEtSrUu70NwV80fVtQqinWalVPlWHm51tkTW+
6mH3f+G+BExq2ovEvUQqDy6o
=Jjhy
-----END PGP SIGNATURE-----