package/openldap: add upstream security fix for CVE-2021-27212
authorPeter Korsgaard <peter@korsgaard.com>
Fri, 26 Feb 2021 23:13:17 +0000 (00:13 +0100)
committerYann E. MORIN <yann.morin.1998@free.fr>
Sat, 27 Feb 2021 08:10:45 +0000 (09:10 +0100)
In OpenLDAP through 2.4.57 and 2.5.x through 2.5.1alpha, an assertion
failure in slapd can occur in the issuerAndThisUpdateCheck function via a
crafted packet, resulting in a denial of service (daemon exit) via a short
timestamp.  This is related to schema_init.c and checkTime.

For more details, see the bugtracker:
https://bugs.openldap.org/show_bug.cgi?id=9454

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
package/openldap/0005-ITS-9454-fix-issuerAndThisUpdateCheck.patch [new file with mode: 0644]
package/openldap/openldap.mk

diff --git a/package/openldap/0005-ITS-9454-fix-issuerAndThisUpdateCheck.patch b/package/openldap/0005-ITS-9454-fix-issuerAndThisUpdateCheck.patch
new file mode 100644 (file)
index 0000000..a611b9f
--- /dev/null
@@ -0,0 +1,26 @@
+From 9badb73425a67768c09bcaed1a9c26c684af6c30 Mon Sep 17 00:00:00 2001
+From: Howard Chu <hyc@openldap.org>
+Date: Sat, 6 Feb 2021 20:52:06 +0000
+Subject: [PATCH] ITS#9454 fix issuerAndThisUpdateCheck
+
+Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
+---
+ servers/slapd/schema_init.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/servers/slapd/schema_init.c b/servers/slapd/schema_init.c
+index 31be1154e..8b1e25539 100644
+--- a/servers/slapd/schema_init.c
++++ b/servers/slapd/schema_init.c
+@@ -3900,6 +3900,8 @@ issuerAndThisUpdateCheck(
+                                       break;
+                               }
+                       }
++                      if ( tu->bv_len < STRLENOF("YYYYmmddHHmmssZ") ) return LDAP_INVALID_SYNTAX;
++
+                       x.bv_val += tu->bv_len + 1;
+                       x.bv_len -= tu->bv_len + 1;
+-- 
+2.20.1
+
index b4c06d8640e9095ab9bbeee1bb33941a1104a97a..ec11e4fa7db95242edd5e005d2c4d4b8e155a116 100644 (file)
@@ -13,6 +13,9 @@ OPENLDAP_CPE_ID_VENDOR = openldap
 OPENLDAP_INSTALL_STAGING = YES
 OPENLDAP_DEPENDENCIES = host-pkgconf
 
+# 0005-ITS-9454-fix-issuerAndThisUpdateCheck.patch
+OPENLDAP_IGNORE_CVES += CVE-2021-27212
+
 ifeq ($(BR2_PACKAGE_OPENSSL),y)
 OPENLDAP_TLS = openssl
 OPENLDAP_DEPENDENCIES += openssl