summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-networking/recipes-protocols/frr/frr/CVE-2022-36440.patch71
-rw-r--r--meta-networking/recipes-protocols/frr/frr_8.2.2.bb1
2 files changed, 72 insertions, 0 deletions
diff --git a/meta-networking/recipes-protocols/frr/frr/CVE-2022-36440.patch b/meta-networking/recipes-protocols/frr/frr/CVE-2022-36440.patch
new file mode 100644
index 0000000000..c06de49eb3
--- /dev/null
+++ b/meta-networking/recipes-protocols/frr/frr/CVE-2022-36440.patch
@@ -0,0 +1,71 @@
1From 02a0e45f66160f571196a105b217e1bb84d1a835 Mon Sep 17 00:00:00 2001
2From: Donald Sharp <sharpd@nvidia.com>
3Date: Fri, 30 Sep 2022 08:51:45 -0400
4Subject: [PATCH] bgpd: Ensure FRR has enough data to read 2 bytes in
5 peek_for_as4_capability
6
7In peek_for_as4_capability the code is checking that the
8stream has at least 2 bytes to read ( the opt_type and the
9opt_length ). However if BGP_OPEN_EXT_OPT_PARAMS_CAPABLE(peer)
10is configured then FRR is reading 3 bytes. Which is not good
11since the packet could be badly formated. Ensure that
12FRR has the appropriate data length to read the data.
13
14Signed-off-by: Donald Sharp <sharpd@nvidia.com>
15(cherry picked from commit 3e46b43e3788f0f87bae56a86b54d412b4710286)
16
17CVE: CVE-2022-36440
18CVE: CVE-2022-40302
19
20Upstream-Status: Backport
21[https://github.com/FRRouting/frr/commit/02a0e45f66160f571196a105b217e1bb84d1a835]
22
23Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
24---
25 bgpd/bgp_open.c | 27 +++++++++++++++++++++------
26 1 file changed, 21 insertions(+), 6 deletions(-)
27
28diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c
29index c2562c75d3fc..fe4c24a8c979 100644
30--- a/bgpd/bgp_open.c
31+++ b/bgpd/bgp_open.c
32@@ -1116,15 +1116,30 @@ as_t peek_for_as4_capability(struct peer *peer, uint16_t length)
33 uint8_t opt_type;
34 uint16_t opt_length;
35
36- /* Check the length. */
37- if (stream_get_getp(s) + 2 > end)
38+ /* Ensure we can read the option type */
39+ if (stream_get_getp(s) + 1 > end)
40 goto end;
41
42- /* Fetch option type and length. */
43+ /* Fetch the option type */
44 opt_type = stream_getc(s);
45- opt_length = BGP_OPEN_EXT_OPT_PARAMS_CAPABLE(peer)
46- ? stream_getw(s)
47- : stream_getc(s);
48+
49+ /*
50+ * Check the length and fetch the opt_length
51+ * If the peer is BGP_OPEN_EXT_OPT_PARAMS_CAPABLE(peer)
52+ * then we do a getw which is 2 bytes. So we need to
53+ * ensure that we can read that as well
54+ */
55+ if (BGP_OPEN_EXT_OPT_PARAMS_CAPABLE(peer)) {
56+ if (stream_get_getp(s) + 2 > end)
57+ goto end;
58+
59+ opt_length = stream_getw(s);
60+ } else {
61+ if (stream_get_getp(s) + 1 > end)
62+ goto end;
63+
64+ opt_length = stream_getc(s);
65+ }
66
67 /* Option length check. */
68 if (stream_get_getp(s) + opt_length > end)
69--
702.40.1
71
diff --git a/meta-networking/recipes-protocols/frr/frr_8.2.2.bb b/meta-networking/recipes-protocols/frr/frr_8.2.2.bb
index 80f4729e1f..2da870ae4e 100644
--- a/meta-networking/recipes-protocols/frr/frr_8.2.2.bb
+++ b/meta-networking/recipes-protocols/frr/frr_8.2.2.bb
@@ -13,6 +13,7 @@ SRC_URI = "git://github.com/FRRouting/frr.git;protocol=https;branch=stable/8.2 \
13 file://CVE-2022-37035.patch \ 13 file://CVE-2022-37035.patch \
14 file://CVE-2022-37032.patch \ 14 file://CVE-2022-37032.patch \
15 file://CVE-2022-42917.patch \ 15 file://CVE-2022-42917.patch \
16 file://CVE-2022-36440.patch \
16 file://frr.pam \ 17 file://frr.pam \
17 " 18 "
18 19