frr: Fix CVE-2023-41909

An issue was discovered in FRRouting FRR through 9.0. bgp_nlri_parse_flowspec
in bgpd/bgp_flowspec.c processes malformed requests with no attributes,
leading to a NULL pointer dereference.

References:
https://nvd.nist.gov/vuln/detail/CVE-2023-41909
https://security-tracker.debian.org/tracker/CVE-2023-41909

Signed-off-by: Narpat Mali <narpat.mali@windriver.com>
[Minor fixup ]
Signed-off-by: Armin Kuster <akuster808@gmail.com>
This commit is contained in:
Armin Kuster 2023-09-23 13:37:33 -04:00
parent dd5003603b
commit 799e0847cc
2 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,42 @@
From 5966b6a1fc72d3698d08199922cc4f42ea7fc9eb Mon Sep 17 00:00:00 2001
From: Donald Sharp <sharpd@nvidia.com>
Date: Fri, 8 Sep 2023 11:46:12 +0000
Subject: [PATCH] bgpd: Limit flowspec to no attribute means a implicit
withdrawal
All other parsing functions done from bgp_nlri_parse() assume
no attributes == an implicit withdrawal. Let's move
bgp_nlri_parse_flowspec() into the same alignment.
Reported-by: Matteo Memelli <mmemelli@amazon.it>
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
CVE: CVE-2023-41909
Upstream-Status: Backport [https://github.com/FRRouting/frr/commit/cfd04dcb3e689754a72507d086ba3b9709fc5ed8]
Signed-off-by: Narpat Mali <narpat.mali@windriver.com>
---
bgpd/bgp_flowspec.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/bgpd/bgp_flowspec.c b/bgpd/bgp_flowspec.c
index 341cfe9d0..3e2b1ac49 100644
--- a/bgpd/bgp_flowspec.c
+++ b/bgpd/bgp_flowspec.c
@@ -112,6 +112,13 @@ int bgp_nlri_parse_flowspec(struct peer *peer, struct attr *attr,
afi = packet->afi;
safi = packet->safi;
+ /*
+ * All other AFI/SAFI's treat no attribute as a implicit
+ * withdraw. Flowspec should as well.
+ */
+ if (!attr)
+ withdraw = 1;
+
if (packet->length >= FLOWSPEC_NLRI_SIZELIMIT_EXTENDED) {
flog_err(EC_BGP_FLOWSPEC_PACKET,
"BGP flowspec nlri length maximum reached (%u)",
--
2.40.0

View File

@ -20,6 +20,7 @@ SRC_URI = "git://github.com/FRRouting/frr.git;protocol=https;branch=stable/8.2 \
file://CVE-2023-31490.patch \
file://CVE-2023-38802.patch \
file://CVE-2023-41358.patch \
file://CVE-2023-41909.patch \
file://frr.pam \
"