[Pkg-swan-devel] [strongswan] 01/02: Add patch to fix CVE-2017-11185
Yves-Alexis Perez
corsac at moszumanska.debian.org
Sun Sep 3 13:23:46 UTC 2017
This is an automated email from the git hooks/post-receive script.
corsac pushed a commit to branch jessie-security
in repository strongswan.
commit 3d3fad165ee42118af16e3d80392d703db2e8ac7
Author: Yves-Alexis Perez <corsac at corsac.net>
Date: Thu Aug 3 20:59:56 2017 +0200
Add patch to fix CVE-2017-11185
* debian/patches:
- CVE-2017-11185 added, fix insufficient validation in gmp plugin
(CVE-2017-11185)
---
debian/changelog | 8 ++++++
debian/patches/CVE-2017-11185.patch | 51 +++++++++++++++++++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 60 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index e984266..f966f9b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+strongswan (5.2.1-6+deb8u5) UNRELEASED; urgency=medium
+
+ * debian/patches:
+ - CVE-2017-11185 added, fix insufficient validation in gmp plugin
+ (CVE-2017-11185)
+
+ -- Yves-Alexis Perez <corsac at debian.org> Thu, 03 Aug 2017 20:58:30 +0200
+
strongswan (5.2.1-6+deb8u4) jessie-security; urgency=medium
* debian/rules:
diff --git a/debian/patches/CVE-2017-11185.patch b/debian/patches/CVE-2017-11185.patch
new file mode 100644
index 0000000..1fb527e
--- /dev/null
+++ b/debian/patches/CVE-2017-11185.patch
@@ -0,0 +1,51 @@
+From ed282e9a463c068146c945984fdea7828e663861 Mon Sep 17 00:00:00 2001
+From: Tobias Brunner <tobias at strongswan.org>
+Date: Mon, 29 May 2017 11:59:34 +0200
+Subject: [PATCH] gmp: Fix RSA signature verification for m >= n
+
+By definition, m must be <= n-1, we didn't enforce that and because
+mpz_export() returns NULL if the passed value is zero a crash could have
+been triggered with m == n.
+
+Fixes CVE-2017-11185.
+---
+ src/libstrongswan/plugins/gmp/gmp_rsa_public_key.c | 12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/src/libstrongswan/plugins/gmp/gmp_rsa_public_key.c b/src/libstrongswan/plugins/gmp/gmp_rsa_public_key.c
+index 32a72ac9600b..a741f85d4f62 100644
+--- a/src/libstrongswan/plugins/gmp/gmp_rsa_public_key.c
++++ b/src/libstrongswan/plugins/gmp/gmp_rsa_public_key.c
+@@ -78,11 +78,17 @@ static chunk_t rsaep(private_gmp_rsa_public_key_t *this, chunk_t data)
+ mpz_t m, c;
+ chunk_t encrypted;
+
+- mpz_init(c);
+ mpz_init(m);
+-
+ mpz_import(m, data.len, 1, 1, 1, 0, data.ptr);
+
++ if (mpz_cmp_ui(m, 0) <= 0 || mpz_cmp(m, this->n) >= 0)
++ { /* m must be <= n-1, but 0 is a valid value, doesn't really make sense
++ * here, though */
++ mpz_clear(m);
++ return chunk_empty;
++ }
++
++ mpz_init(c);
+ mpz_powm(c, m, this->e, this->n);
+
+ encrypted.len = this->k;
+@@ -150,7 +156,7 @@ static bool verify_emsa_pkcs1_signature(private_gmp_rsa_public_key_t *this,
+ */
+
+ /* check magic bytes */
+- if (*(em.ptr) != 0x00 || *(em.ptr+1) != 0x01)
++ if (em.len < 2 || *(em.ptr) != 0x00 || *(em.ptr+1) != 0x01)
+ {
+ goto end;
+ }
+--
+2.7.4
+
+
diff --git a/debian/patches/series b/debian/patches/series
index 59adb6e..e226e3a 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -8,3 +8,4 @@ CVE-2015-8023_eap_mschapv2_state.patch
CVE-2017-9022_insufficient_input_validation_gmp_plugin.patch
CVE-2017-9023_incorrect_handling_of_choice_types_in_asn1_parser.patch
0001-openssl-Don-t-pre-initialize-OpenSSL-HMAC-with-an-em.patch
+CVE-2017-11185.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-swan/strongswan.git
More information about the Pkg-swan-devel
mailing list