summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-networking/recipes-support/strongswan/files/CVE-2021-41990.patch62
-rw-r--r--meta-networking/recipes-support/strongswan/files/CVE-2021-41991.patch41
-rw-r--r--meta-networking/recipes-support/strongswan/strongswan_5.8.4.bb2
3 files changed, 105 insertions, 0 deletions
diff --git a/meta-networking/recipes-support/strongswan/files/CVE-2021-41990.patch b/meta-networking/recipes-support/strongswan/files/CVE-2021-41990.patch
new file mode 100644
index 0000000000..b7118ba1fb
--- /dev/null
+++ b/meta-networking/recipes-support/strongswan/files/CVE-2021-41990.patch
@@ -0,0 +1,62 @@
1From 423a5d56274a1d343e0d2107dfc4fbf0df2dcca5 Mon Sep 17 00:00:00 2001
2From: Tobias Brunner <tobias@strongswan.org>
3Date: Tue, 28 Sep 2021 17:52:08 +0200
4Subject: [PATCH] Reject RSASSA-PSS params with negative salt length
5
6The `salt_len` member in the struct is of type `ssize_t` because we use
7negative values for special automatic salt lengths when generating
8signatures.
9
10Not checking this could lead to an integer overflow. The value is assigned
11to the `len` field of a chunk (`size_t`), which is further used in
12calculations to check the padding structure and (if that is passed by a
13matching crafted signature value) eventually a memcpy() that will result
14in a segmentation fault.
15
16Fixes: a22316520b91 ("signature-params: Add functions to parse/build ASN.1 RSASSA-PSS params")
17Fixes: 7d6b81648b2d ("gmp: Add support for RSASSA-PSS signature verification")
18Fixes: CVE-2021-41990
19
20Upstream-Status: Backport [https://download.strongswan.org/security/CVE-2021-41990]
21CVE: CVE-2021-41990
22
23Signed-off-by: Virendra Thakur <virendra.thakur@kpit.com>
24
25---
26 src/libstrongswan/credentials/keys/signature_params.c | 6 +++++-
27 src/libstrongswan/plugins/gmp/gmp_rsa_public_key.c | 2 +-
28 2 files changed, 6 insertions(+), 2 deletions(-)
29
30diff --git a/src/libstrongswan/credentials/keys/signature_params.c b/src/libstrongswan/credentials/keys/signature_params.c
31index d89bd2c96bb5..837de8443d43 100644
32--- a/src/libstrongswan/credentials/keys/signature_params.c
33+++ b/src/libstrongswan/credentials/keys/signature_params.c
34@@ -322,7 +322,11 @@ bool rsa_pss_params_parse(chunk_t asn1, int level0, rsa_pss_params_t *params)
35 case RSASSA_PSS_PARAMS_SALT_LEN:
36 if (object.len)
37 {
38- params->salt_len = (size_t)asn1_parse_integer_uint64(object);
39+ params->salt_len = (ssize_t)asn1_parse_integer_uint64(object);
40+ if (params->salt_len < 0)
41+ {
42+ goto end;
43+ }
44 }
45 break;
46 case RSASSA_PSS_PARAMS_TRAILER:
47diff --git a/src/libstrongswan/plugins/gmp/gmp_rsa_public_key.c b/src/libstrongswan/plugins/gmp/gmp_rsa_public_key.c
48index f9bd1d314dec..3a775090883e 100644
49--- a/src/libstrongswan/plugins/gmp/gmp_rsa_public_key.c
50+++ b/src/libstrongswan/plugins/gmp/gmp_rsa_public_key.c
51@@ -168,7 +168,7 @@ static bool verify_emsa_pss_signature(private_gmp_rsa_public_key_t *this,
52 int i;
53 bool success = FALSE;
54
55- if (!params)
56+ if (!params || params->salt_len < 0)
57 {
58 return FALSE;
59 }
60--
612.25.1
62
diff --git a/meta-networking/recipes-support/strongswan/files/CVE-2021-41991.patch b/meta-networking/recipes-support/strongswan/files/CVE-2021-41991.patch
new file mode 100644
index 0000000000..2d898fa5cf
--- /dev/null
+++ b/meta-networking/recipes-support/strongswan/files/CVE-2021-41991.patch
@@ -0,0 +1,41 @@
1From b667237b3a84f601ef5a707ce8eb861c3a5002d3 Mon Sep 17 00:00:00 2001
2From: Tobias Brunner <tobias@strongswan.org>
3Date: Tue, 28 Sep 2021 19:38:22 +0200
4Subject: [PATCH] cert-cache: Prevent crash due to integer overflow/sign change
5
6random() allocates values in the range [0, RAND_MAX], with RAND_MAX usually
7equaling INT_MAX = 2^31-1. Previously, values between 0 and 31 were added
8directly to that offset before applying`% CACHE_SIZE` to get an index into
9the cache array. If the random value was very high, this resulted in an
10integer overflow and a negative index value and, therefore, an out-of-bounds
11access of the array and in turn dereferencing invalid pointers when trying
12to acquire the read lock. This most likely results in a segmentation fault.
13
14Fixes: 764e8b2211ce ("reimplemented certificate cache")
15Fixes: CVE-2021-41991
16
17Upstream-Status: Backport [https://download.strongswan.org/security/CVE-2021-41991]
18CVE: CVE-2021-41991
19
20Signed-off-by: Virendra Thakur <virendra.thakur@kpit.com>
21
22---
23 src/libstrongswan/credentials/sets/cert_cache.c | 2 +-
24 1 file changed, 1 insertion(+), 1 deletion(-)
25
26diff --git a/src/libstrongswan/credentials/sets/cert_cache.c b/src/libstrongswan/credentials/sets/cert_cache.c
27index f1579c60a9bc..ceebb3843725 100644
28--- a/src/libstrongswan/credentials/sets/cert_cache.c
29+++ b/src/libstrongswan/credentials/sets/cert_cache.c
30@@ -151,7 +151,7 @@ static void cache(private_cert_cache_t *this,
31 for (try = 0; try < REPLACE_TRIES; try++)
32 {
33 /* replace a random relation */
34- offset = random();
35+ offset = random() % CACHE_SIZE;
36 for (i = 0; i < CACHE_SIZE; i++)
37 {
38 rel = &this->relations[(i + offset) % CACHE_SIZE];
39--
402.25.1
41
diff --git a/meta-networking/recipes-support/strongswan/strongswan_5.8.4.bb b/meta-networking/recipes-support/strongswan/strongswan_5.8.4.bb
index 8a8809243a..b45b8074c4 100644
--- a/meta-networking/recipes-support/strongswan/strongswan_5.8.4.bb
+++ b/meta-networking/recipes-support/strongswan/strongswan_5.8.4.bb
@@ -11,6 +11,8 @@ SRC_URI = "http://download.strongswan.org/strongswan-${PV}.tar.bz2 \
11 file://fix-funtion-parameter.patch \ 11 file://fix-funtion-parameter.patch \
12 file://0001-memory.h-Include-stdint.h-for-uintptr_t.patch \ 12 file://0001-memory.h-Include-stdint.h-for-uintptr_t.patch \
13 file://0001-Remove-obsolete-setting-regarding-the-Standard-Outpu.patch \ 13 file://0001-Remove-obsolete-setting-regarding-the-Standard-Outpu.patch \
14 file://CVE-2021-41990.patch \
15 file://CVE-2021-41991.patch \
14 " 16 "
15 17
16SRC_URI[md5sum] = "0634e7f40591bd3f6770e583c3f27d29" 18SRC_URI[md5sum] = "0634e7f40591bd3f6770e583c3f27d29"