deadsimple BSD Security Advisories and Announcements

FreeBSD Security Advisory FreeBSD-SA-22:12.lib9p

Hash: SHA512

FreeBSD-SA-22:12.lib9p                                      Security Advisory
                                                          The FreeBSD Project

Topic:          Missing bounds check in 9p message handling

Category:       contrib
Module:         lib9p
Announced:      2022-08-09
Credits:        Robert Morris
Affects:        FreeBSD 13.0 and 13.1
Corrected:      2022-08-09 13:33:14 UTC (stable/13, 13.1-STABLE)
                2022-08-09 20:01:13 UTC (releng/13.1, 13.1-RELEASE-p1)
                2022-08-09 20:00:03 UTC (releng/13.0, 13.0-RELEASE-p12)
CVE Name:       CVE-2022-23092

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

I.   Background

lib9p provides an implementation of the 9p file system protocol.  It is
used by bhyve(8) to provide guest access to a host file system tree via
the virtio-9p device model.  The FreeBSD base system does not contain
any other users of lib9p.

II.  Problem Description

The implementation of lib9p's handling of RWALK messages was missing a
bounds check needed when unpacking the message contents.  The missing
check means that the receipt of a specially crafted message will cause
lib9p to overwrite unrelated memory.

III. Impact

The bug can be triggered by a malicious bhyve guest kernel to overwrite
memory in the bhyve(8) process.  This could potentially lead to
user-mode code execution on the host, subject to bhyve's Capsicum

IV.  Workaround

No workaround is available.  Systems not using bhyve's virtio-9p device
model 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 restart any VMs utilizing virtio-9p devices.

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

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
# fetch
# gpg --verify lib9p.patch.asc

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

# cd /usr/src
# patch < /path/to/patch

c) Recompile the operating system using buildworld and installworld as
described in <URL:>.

Restart restart any VMs utilizing virtio-9p devices, or 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/                              c536045c51da    stable/13-n252071
releng/13.1/                            7dfe949791e7  releng/13.1-n250154
releng/13.0/                            70a2cf7bb2e0  releng/13.0-n244806
- -------------------------------------------------------------------------

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:


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


The latest revision of this advisory is available at