Home / mailingsPDF  

FreeBSD Security Advisory FreeBSD-SA-24:06.ktrace

Posted on 07 August 2024
FreeBSD security notificat

=============================================================================FreeBSD-SA-24:06.ktrace Security Advisory
The FreeBSD Project

Topic: ktrace(2) fails to detach when executing a setuid binary

Category: core
Module: ktrace
Announced: 2024-08-07
Affects: All supported versions of FreeBSD
Corrected: 2024-08-07 13:41:53 UTC (stable/14, 14.1-STABLE)
2024-08-07 13:44:29 UTC (releng/14.1, 14.1-RELEASE-p3)
2024-08-07 13:44:47 UTC (releng/14.0, 14.0-RELEASE-p9)
2024-08-07 13:42:10 UTC (stable/13, 13.3-STABLE)
2024-08-07 13:44:59 UTC (releng/13.3, 13.3-RELEASE-p5)
CVE Name: CVE-2024-6760

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 ktrace utility enables kernel trace logging for the specified processes,
commonly used for diagnostic or debugging purposes. The kernel operations
that are traced include system calls, namei translations, signal processing,
and I/O as well as data associated with these operations.

II. Problem Description

A logic bug in the code which disables kernel tracing for setuid programs
meant that tracing was not disabled when it should have, allowing
unprivileged users to trace and inspect the behavior of setuid programs.

III. Impact

The bug may be used by an unprivileged user to read the contents of files to
which they would not otherwise have access, such as the local password
database.

IV. Workaround

No workaround is available.

I/O tracing can be disabled by setting the kern.ktrace.genio_size sysctl to
0, but other information recorded by ktrace, such as system call arguments,
can still be leaked.

V. Solution

Upgrade your vulnerable system to a supported FreeBSD stable or
release / security branch (releng) dated after the correction date.

Perform one of the following:

1) To update your vulnerable system via a binary patch:

Systems running a RELEASE version of FreeBSD on the amd64 or arm64 platforms,
or the i386 platform on FreeBSD 13, can be updated via the freebsd-update(8)
utility:

# freebsd-update fetch
# freebsd-update install
# shutdown -r +10min "Rebooting for a security update"

2) 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-24:06/ktrace.patch
# fetch https://security.FreeBSD.org/patches/SA-24:06/ktrace.patch.asc
# gpg --verify ktrace.patch.asc

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

# cd /usr/src
# patch < /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/14/ 8b400c8488f0 stable/14-n268423
releng/14.1/ 22d04990cee5 releng/14.1-n267693
releng/14.0/ c39fb98e4740 releng/14.0-n265429
stable/13/ f702110bc4bc stable/13-n258224
releng/13.3/ 769536bcb5c3 releng/13.3-n257445
- -------------------------------------------------------------------------

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-2024-6760>

The latest revision of this advisory is available at
<URL:https://security.FreeBSD.org/advisories/FreeBSD-SA-24:06.ktrace.asc>

 

TOP