Home / mailingsPDF  

FreeBSD Security Advisory FreeBSD-SA-21:14.ggatec

Posted on 24 August 2021
FreeBSD security notificat

=============================================================================FreeBSD-SA-21:14.ggatec Security Advisory
The FreeBSD Project

Topic: Remote code execution in ggatec(8)

Category: core
Module: ggatec
Announced: 2021-08-24
Credits: Johannes Totz
Affects: All supported versions of FreeBSD.
Corrected: 2021-08-24 17:50:50 UTC (stable/13, 13.0-STABLE)
2021-08-24 17:37:45 UTC (releng/13.0, 13.0-RELEASE-p4)
2021-08-24 18:30:13 UTC (stable/12, 12.2-STABLE)
2021-08-24 18:32:15 UTC (releng/12.2, 12.2-RELEASE-p10)
2021-08-24 18:29:35 UTC (stable/11, 11.4-STABLE)
2021-08-24 18:31:29 UTC (releng/11.4, 11.4-RELEASE-p13)
CVE Name: CVE-2021-29630

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

GEOM Gate is a GEOM module that reflects I/O requests into user mode where
the ggatec(8) daemon fowards those requests to ggated(8), possibly over the
network to another machine.

II. Problem Description

The ggatec(8) daemon does not validate the size of a response before writing
it to a fixed-sized buffer. This allows to overwrite the stack of ggatec(8).

III. Impact

A malicious ggated(8) or an attacker in a priviledged network position can
overwrite the stack with crafted content and potentially execute arbitrary
code.

IV. Workaround

No workaround is available but systems not using ggatec(8) are not affected.
Neither ggatec(8) nor ggated(8) are enabled by default and need explicit
configuration by the super-user.

V. Solution

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

Restart any ggatec(8) instances. Existing ggate devices can be kept alive
and restarted with `ggatec rescue`.

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 https://security.FreeBSD.org/patches/SA-21:14/ggatec.patch
# fetch https://security.FreeBSD.org/patches/SA-21:14/ggatec.patch.asc
# gpg --verify ggatec.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:https://www.FreeBSD.org/handbook/makeworld.html>.

Restart the applicable daemons, 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/ 0729ba2f49c9 stable/13-n246938
releng/13.0/ c8a2cc4ba845 releng/13.0-n244757
stable/12/ r370383
releng/12.2/ r370394
stable/11/ r370381
releng/11.4/ r370387
- -------------------------------------------------------------------------

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-2021-29630>

The latest revision of this advisory is available at
<URL:https://security.FreeBSD.org/advisories/FreeBSD-SA-21:14.ggatec.asc>

 

TOP