Home / mailingsPDF  

FreeBSD Security Advisory FreeBSD-SA-22:09.elf

Posted on 10 August 2022
FreeBSD security notificat

=============================================================================FreeBSD-SA-22:09.elf Security Advisory
The FreeBSD Project

Topic: Out of bound read in elf_note_prpsinfo()

Category: core
Module: kernel
Announced: 2022-08-09
Credits: Josef 'Jeff' Sipek
Affects: All supported versions of FreeBSD.
Corrected: 2022-08-09 19:47:32 UTC (stable/13, 13.1-STABLE)
2022-08-09 20:00:43 UTC (releng/13.1, 13.1-RELEASE-p1)
2022-08-09 19:59:14 UTC (releng/13.0, 13.0-RELEASE-p12)
2022-08-09 19:57:35 UTC (stable/12, 12.3-STABLE)
2022-08-09 19:59:47 UTC (releng/12.3, 12.3-RELEASE-p6)
CVE Name: CVE-2022-23089

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

Process information known as "prpsinfo" is written when dumping core of a
process as an ELF note.

The sbuf family of functions allows one to safely allocate, compose and
release strings in kernel or user space.

II. Problem Description

When dumping core and saving process information, proc_getargv() might
return an sbuf which have a sbuf_len() of 0 or -1, which is not properly
handled.

III. Impact

An out-of-bound read can happen when user constructs a specially crafted
ps_string, which in turn can cause the kernel to crash.

IV. Workaround

The system administrator can workaround this issue by disabling coredump.
This can be done by adding:

kern.coredump=0

to /etc/sysctl.conf and run `service sysctl start`.

V. Solution

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

A reboot is required after applying the fix.

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, i386, or
(on FreeBSD 13 and later) arm64 platforms 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-22:09/elf.patch
# fetch https://security.FreeBSD.org/patches/SA-22:09/elf.patch.asc
# gpg --verify elf.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 by the corresponding Git commit hash or Subversion
revision number in the following stable and release branches:

Branch/path Hash Revision
- -------------------------------------------------------------------------
stable/13/ 8a44a2c644fc stable/13-n252079
releng/13.1/ 69a456c0b60b releng/13.1-n250152
releng/13.0/ 056ffc74a769 releng/13.0-n244804
stable/12/ r372376
releng/12.3/ r372380
- -------------------------------------------------------------------------

For FreeBSD 13 and later:

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

For FreeBSD 12 and earlier:

Run the following command to see which files were modified by a particular
revision, replacing NNNNNN with the revision number:

# svn diff -cNNNNNN --summarize svn://svn.freebsd.org/base

Or visit the following URL, replacing NNNNNN with the revision number:

<URL:https://svnweb.freebsd.org/base?view=revision&revision=NNNNNN>

VII. References

<URL:https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23089>

The latest revision of this advisory is available at
<URL:https://security.FreeBSD.org/advisories/FreeBSD-SA-22:09.elf.asc>

 

TOP