summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYue Tao <Yue.Tao@windriver.com>2014-06-15 22:24:44 -0400
committerJoe MacDonald <joe_macdonald@mentor.com>2014-06-15 23:21:56 -0400
commit26b31ad72899a68d93029f5cce4afa63c3b78a6b (patch)
treee0d1c162da0fd449b4887e7f3b8e1c77ff0f1cfd
parentd42a2e16056777615e6bcc126cdb92db3b4f9cdf (diff)
downloadmeta-openembedded-26b31ad72899a68d93029f5cce4afa63c3b78a6b.tar.gz
quagga: Security Advisory - CVE-2012-1820
The bgp_capability_orf function in bgpd in Quagga 0.99.20.1 and earlier allows remote attackers to cause a denial of service (assertion failure and daemon exit) by leveraging a BGP peering relationship and sending a malformed Outbound Route Filtering (ORF) capability TLV in an OPEN message. http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2012-1820 Signed-off-by: Yue Tao <Yue.Tao@windriver.com> Signed-off-by: Jackie Huang <jackie.huang@windriver.com> Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
-rw-r--r--meta-networking/recipes-protocols/quagga/files/0001-bgpd-CVE-2012-1820-DoS-in-bgp_capability_orf.patch87
-rw-r--r--meta-networking/recipes-protocols/quagga/files/0001-bgpd-relax-ORF-capability-length-handling.patch42
-rw-r--r--meta-networking/recipes-protocols/quagga/quagga.inc2
3 files changed, 131 insertions, 0 deletions
diff --git a/meta-networking/recipes-protocols/quagga/files/0001-bgpd-CVE-2012-1820-DoS-in-bgp_capability_orf.patch b/meta-networking/recipes-protocols/quagga/files/0001-bgpd-CVE-2012-1820-DoS-in-bgp_capability_orf.patch
new file mode 100644
index 000000000..5a2ee1b2c
--- /dev/null
+++ b/meta-networking/recipes-protocols/quagga/files/0001-bgpd-CVE-2012-1820-DoS-in-bgp_capability_orf.patch
@@ -0,0 +1,87 @@
1From fe9bb6459afe0d55e56619cdc5061d8407cd1f15 Mon Sep 17 00:00:00 2001
2From: Denis Ovsienko <infrastation@yandex.ru>
3Date: Thu, 19 Apr 2012 20:34:13 +0400
4Subject: [PATCH] bgpd: CVE-2012-1820, DoS in bgp_capability_orf()
5
6Upstream-Status: Backport
7
8An ORF (code 3) capability TLV is defined to contain exactly one
9AFI/SAFI block. Function bgp_capability_orf(), which parses ORF
10capability TLV, uses do-while cycle to call its helper function
11bgp_capability_orf_entry(), which actually processes the AFI/SAFI data
12block. The call is made at least once and repeated as long as the input
13buffer has enough data for the next call.
14
15The helper function, bgp_capability_orf_entry(), uses "Number of ORFs"
16field of the provided AFI/SAFI block to verify, if it fits the input
17buffer. However, the check is made based on the total length of the ORF
18TLV regardless of the data already consumed by the previous helper
19function call(s). This way, the check condition is only valid for the
20first AFI/SAFI block inside an ORF capability TLV.
21
22For the subsequent calls of the helper function, if any are made, the
23check condition may erroneously tell, that the current "Number of ORFs"
24field fits the buffer boundary, where in fact it does not. This makes it
25possible to trigger an assertion by feeding an OPEN message with a
26specially-crafted malformed ORF capability TLV.
27
28This commit fixes the vulnerability by making the implementation follow
29the spec.
30---
31 bgpd/bgp_open.c | 26 ++------------------------
32 1 files changed, 2 insertions(+), 24 deletions(-)
33
34diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c
35index d045dde..af711cc 100644
36--- a/bgpd/bgp_open.c
37+++ b/bgpd/bgp_open.c
38@@ -230,7 +230,7 @@ bgp_capability_orf_entry (struct peer *peer, struct capability_header *hdr)
39 }
40
41 /* validate number field */
42- if (sizeof (struct capability_orf_entry) + (entry.num * 2) > hdr->length)
43+ if (sizeof (struct capability_orf_entry) + (entry.num * 2) != hdr->length)
44 {
45 zlog_info ("%s ORF Capability entry length error,"
46 " Cap length %u, num %u",
47@@ -334,28 +334,6 @@ bgp_capability_orf_entry (struct peer *peer, struct capability_header *hdr)
48 }
49
50 static int
51-bgp_capability_orf (struct peer *peer, struct capability_header *hdr)
52-{
53- struct stream *s = BGP_INPUT (peer);
54- size_t end = stream_get_getp (s) + hdr->length;
55-
56- assert (stream_get_getp(s) + sizeof(struct capability_orf_entry) <= end);
57-
58- /* We must have at least one ORF entry, as the caller has already done
59- * minimum length validation for the capability code - for ORF there must
60- * at least one ORF entry (header and unknown number of pairs of bytes).
61- */
62- do
63- {
64- if (bgp_capability_orf_entry (peer, hdr) == -1)
65- return -1;
66- }
67- while (stream_get_getp(s) + sizeof(struct capability_orf_entry) < end);
68-
69- return 0;
70-}
71-
72-static int
73 bgp_capability_restart (struct peer *peer, struct capability_header *caphdr)
74 {
75 struct stream *s = BGP_INPUT (peer);
76@@ -573,7 +551,7 @@ bgp_capability_parse (struct peer *peer, size_t length, int *mp_capability,
77 break;
78 case CAPABILITY_CODE_ORF:
79 case CAPABILITY_CODE_ORF_OLD:
80- if (bgp_capability_orf (peer, &caphdr))
81+ if (bgp_capability_orf_entry (peer, &caphdr))
82 return -1;
83 break;
84 case CAPABILITY_CODE_RESTART:
85--
861.7.5.4
87
diff --git a/meta-networking/recipes-protocols/quagga/files/0001-bgpd-relax-ORF-capability-length-handling.patch b/meta-networking/recipes-protocols/quagga/files/0001-bgpd-relax-ORF-capability-length-handling.patch
new file mode 100644
index 000000000..0ec02dc86
--- /dev/null
+++ b/meta-networking/recipes-protocols/quagga/files/0001-bgpd-relax-ORF-capability-length-handling.patch
@@ -0,0 +1,42 @@
1From 5e728e929942d39ce5a4ab3d01c33f7b688c4e3f Mon Sep 17 00:00:00 2001
2From: David Lamparter <equinox@opensourcerouting.org>
3Date: Wed, 23 Jan 2013 05:50:24 +0100
4Subject: [PATCH] bgpd: relax ORF capability length handling
5
6Upstream-Status: Backport
7
8commit fe9bb64... "bgpd: CVE-2012-1820, DoS in bgp_capability_orf()"
9made the length test in bgp_capability_orf_entry() stricter and is now
10causing us to refuse (with CEASE) ORF capabilites carrying any excess
11data. This does not conform to the robustness principle as laid out by
12RFC1122 ("be liberal in what you accept").
13
14Even worse, RFC5291 is quite unclear on how to use the ORF capability
15with multiple AFI/SAFIs. It can be interpreted as either "use one
16instance, stuff everything in" but also as "use multiple instances".
17So, if not for applying robustness, we end up clearing sessions from
18implementations going by the former interpretation. (or if anyone dares
19add a byte of padding...)
20
21Cc: Denis Ovsienko <infrastation@yandex.ru>
22Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
23---
24 bgpd/bgp_open.c | 2 +-
25 1 files changed, 1 insertions(+), 1 deletions(-)
26
27diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c
28index af711cc..7bf3501 100644
29--- a/bgpd/bgp_open.c
30+++ b/bgpd/bgp_open.c
31@@ -230,7 +230,7 @@ bgp_capability_orf_entry (struct peer *peer, struct capability_header *hdr)
32 }
33
34 /* validate number field */
35- if (sizeof (struct capability_orf_entry) + (entry.num * 2) != hdr->length)
36+ if (sizeof (struct capability_orf_entry) + (entry.num * 2) > hdr->length)
37 {
38 zlog_info ("%s ORF Capability entry length error,"
39 " Cap length %u, num %u",
40--
411.7.5.4
42
diff --git a/meta-networking/recipes-protocols/quagga/quagga.inc b/meta-networking/recipes-protocols/quagga/quagga.inc
index 5eeb18beb..5ab43b300 100644
--- a/meta-networking/recipes-protocols/quagga/quagga.inc
+++ b/meta-networking/recipes-protocols/quagga/quagga.inc
@@ -36,6 +36,8 @@ SRC_URI = "${SAVANNAH_GNU_MIRROR}/quagga${QUAGGASUBDIR}/quagga-${PV}.tar.gz;name
36 file://quagga.pam \ 36 file://quagga.pam \
37 file://ripd-fix-two-bugs-after-received-SIGHUP.patch \ 37 file://ripd-fix-two-bugs-after-received-SIGHUP.patch \
38 file://quagga-Avoid-duplicate-connected-address.patch \ 38 file://quagga-Avoid-duplicate-connected-address.patch \
39 file://0001-bgpd-CVE-2012-1820-DoS-in-bgp_capability_orf.patch \
40 file://0001-bgpd-relax-ORF-capability-length-handling.patch \
39" 41"
40 42
41PACKAGECONFIG ??= "${@base_contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}" 43PACKAGECONFIG ??= "${@base_contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}"