-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 ============================================================================= FreeBSD-SA-21:12.libradius Security Advisory The FreeBSD Project Topic: Missing message validation in libradius(3) Category: core Module: libradius Announced: 2021-05-26 Credits: leommxj and Swings from Chaitin Security Research Lab Affects: All supported versions of FreeBSD. Corrected: 2021-05-26 19:45:31 UTC (stable/13, 13.0-STABLE) 2021-05-26 20:36:29 UTC (releng/13.0, 13.0-RELEASE-p1) 2021-05-26 20:39:35 UTC (stable/12, 12.2-STABLE) 2021-05-26 20:40:23 UTC (releng/12.2, 12.2-RELEASE-p7) 2021-05-26 20:41:31 UTC (stable/11, 11.4-STABLE) 2021-05-26 20:41:58 UTC (releng/11.4, 11.4-RELEASE-p10) CVE Name: CVE-2021-29629 For general information regarding FreeBSD Security Advisories, including descriptions of the fields above, security branches, and the following sections, please visit . I. Background libradius(3) is a client and server library implementing the Remote Authentication Dial In User Service (RADIUS) protocol. It is used by pam_radius(8) and mpd5 (available in the ports tree as net/mpd5). II. Problem Description libradius did not perform sufficient validation of received messages. rad_get_attr(3) did not verify that the attribute length is valid before subtracting the length of the Type and Length fields. As a result, it could return success while also providing a bogus length of SIZE_T_MAX - 2 for the Value field. When processing attributes to find an optional authenticator, is_valid_response() failed to verify that each attribute length is non-zero and could thus enter an infinite loop. III. Impact A server may use libradius(3) to process messages from RADIUS clients. In this case, a malicious client could trigger a denial-of-service in the server. A client using libradius(3) to process messages from a server is susceptible to the same problem. The impact of the rad_get_attr(3) bug depends on how the returned length is validated and used by the consumer. It is possible that libradius(3) applications will crash or enter an infinite loop when calling rad_get_attr(3) on untrusted RADIUS messages. IV. Workaround No workaround is available. Systems not making use of libradius(3) are unaffected. 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, 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. [FreeBSD 13.0, 12.2] # fetch https://security.FreeBSD.org/patches/SA-21:12/libradius.patch # fetch https://security.FreeBSD.org/patches/SA-21:12/libradius.patch.asc # gpg --verify libradius.patch.asc [FreeBSD 11.4] # fetch https://security.FreeBSD.org/patches/SA-21:12/libradius.11.patch # fetch https://security.FreeBSD.org/patches/SA-21:12/libradius.11.patch.asc # gpg --verify libradius.11.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 . Restart all daemons that use the library, 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/ bec0d2c9c841 stable/13-n245765 releng/13.0/ 7d900abe6269 releng/13.0-n244743 stable/12/ r369859 releng/12.2/ r369864 stable/11/ r369866 releng/11.4/ r369867 - ------------------------------------------------------------------------- For FreeBSD 13 and later: Run the following command to see which files were modified by a particular commit: # git show --stat 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 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: VII. References The latest revision of this advisory is available at -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE/A6HiuWv54gCjWNV05eS9J6n5cIFAmCu6vMACgkQ05eS9J6n 5cLBUQ//aEsqwU/okABtOEAYbr87TSl0eHpmnNjfLS/OHgkQ7FPIBCpF2ThifBk3 t84F9q5ILOizrc916hT4RzFkTdHwVOGJCk7uEWwYCkHnDOIIzsbKD8Jzv+nKJf2P hyrm5aVmRyEgwImZFv3158dmaK+AvrrFoWOwZDW+A1zBDrf/EgCKCAFTn9I72wZI 1HoPkO8I4lJYTDKkr1AQ2Xh0fHYwcP5myvGZFwIJftmG6BbETgAzfPPiwiMC/dN4 ZUkyyZI9O+kfzRH+iIchEt+kls7m0eXIt5EQmVAyCj76Npa0zCPXa5pPLJ9no6N7 YT2nuuOGQUeriaMo1P9PeMhGECOcdW96DWuXGKsTjGei70634eADxmv8tjR0Vndm VPbi3f9O4d8Yqsr+ioNm1dwT8kgbChbTBob/r6NyIWqJVsinIVSI+u9U7aCAlxpK 6grc9FUZDHpGdP2DqdE5iZ4WSkjh7yZR9676sHmIvdnNkUT5LonxP8iDmGbexlLZ mGAiNNaI19hEeaf+1AyF0l8/VZdvgZsjoSYUtATqYH6aO4xF6MMzirKYtfbphrdj +BwVyZB4WRU0S71v2zkz7wAlErQnwRI+CYvZFxe7jyMkk5C70btxZllAs9dgYsHE DL7SugtvoKb/eBtIfSCSf6fe+MW1poIG0G7T26K5crHNiUxHYvY= =yqoJ -----END PGP SIGNATURE-----