]> git.pld-linux.org Git - packages/cyrus-sasl.git/commitdiff
CVE-2013-4122 cyrus-sasl: NULL pointer dereference (DoS)
authorTomasz Pala <gotar@pld-linux.org>
Mon, 11 Nov 2013 04:46:00 +0000 (05:46 +0100)
committerTomasz Pala <gotar@pld-linux.org>
Mon, 11 Nov 2013 04:46:00 +0000 (05:46 +0100)
when glibc v.2.17 or FIPS-140 enabled Linux system used

cyrus-sasl-2.1.26-glibc217-crypt.diff [new file with mode: 0644]
cyrus-sasl.spec

diff --git a/cyrus-sasl-2.1.26-glibc217-crypt.diff b/cyrus-sasl-2.1.26-glibc217-crypt.diff
new file mode 100644 (file)
index 0000000..020e2a0
--- /dev/null
@@ -0,0 +1,108 @@
+From 0626e86d2e1d0be63a56918371a15d98cfad19d1 Mon Sep 17 00:00:00 2001
+From: mancha <mancha1@hush.com>
+Date: Tue, 9 Jul 2013
+Subject: [PATCH] Handle NULL returns from glibc 2.17+ crypt().
+
+Starting with glibc 2.17 (eglibc 2.17), crypt() fails with EINVAL
+(w/ NULL return) if the salt violates specifications. Additionally,
+on FIPS-140 enabled Linux systems, DES/MD5-encrypted passwords
+passed to crypt() fail with EPERM (w/ NULL return).
+
+When using glibc's crypt(), check return value to avoid a possible
+NULL pointer dereference.
+---
+ pwcheck/pwcheck_getpwnam.c |    3 ++-
+ pwcheck/pwcheck_getspnam.c |    3 ++-
+ saslauthd/auth_getpwent.c  |    3 ++-
+ saslauthd/auth_shadow.c    |    7 ++-----
+ 4 files changed, 8 insertions(+), 8 deletions(-)
+
+--- a/pwcheck/pwcheck_getpwnam.c
++++ b/pwcheck/pwcheck_getpwnam.c
+@@ -32,6 +32,7 @@ extern char *crypt();
+ char *password;
+ {
+     char* r;
++    char* crpt_passwd;
+     struct passwd *pwd;
+
+     pwd = getpwnam(userid);
+@@ -41,7 +42,7 @@ char *password;
+     else if (pwd->pw_passwd[0] == '*') {
+       r = "Account disabled";
+     }
+-    else if (strcmp(pwd->pw_passwd, crypt(password, pwd->pw_passwd)) != 0) {
++    else if (!(crpt_passwd = crypt(password, pwd->pw_passwd)) || strcmp(pwd->pw_passwd, (const char *)crpt_passwd) != 0) {
+       r = "Incorrect password";
+     }
+     else {
+--- a/pwcheck/pwcheck_getspnam.c
++++ b/pwcheck/pwcheck_getspnam.c
+@@ -30,6 +30,7 @@ extern char *crypt();
+ char *pwcheck(userid, password)
+ char *userid;
+ char *password;
++char *crpt_passwd;
+ {
+     struct spwd *pwd;
+@@ -38,7 +39,7 @@ char *password;
+       return "Userid not found";
+     }
+     
+-    if (strcmp(pwd->sp_pwdp, crypt(password, pwd->sp_pwdp)) != 0) {
++    if (!(crpt_passwd = crypt(password, pwd->sp_pwdp)) || strcmp(pwd->sp_pwdp, (const char *)crpt_passwd) != 0) {
+       return "Incorrect password";
+     }
+     else {
+--- a/saslauthd/auth_getpwent.c
++++ b/saslauthd/auth_getpwent.c
+@@ -77,6 +77,7 @@ auth_getpwent (
+ {
+     /* VARIABLES */
+     struct passwd *pw;                        /* pointer to passwd file entry */
++    char *crpt_passwd;                        /* encrypted password */
+     int errnum;
+     /* END VARIABLES */
+   
+@@ -105,7 +106,7 @@ auth_getpwent (
+       }
+     }
+-    if (strcmp(pw->pw_passwd, (const char *)crypt(password, pw->pw_passwd))) {
++    if (!(crpt_passwd = crypt(password, pw->pw_passwd)) || strcmp(pw->pw_passwd, (const char *)crpt_passwd)) {
+       if (flags & VERBOSE) {
+           syslog(LOG_DEBUG, "DEBUG: auth_getpwent: %s: invalid password", login);
+       }
+--- a/saslauthd/auth_shadow.c
++++ b/saslauthd/auth_shadow.c
+@@ -210,8 +210,7 @@ auth_shadow (
+       RETURN("NO Insufficient permission to access NIS authentication database (saslauthd)");
+     }
+-    cpw = strdup((const char *)crypt(password, sp->sp_pwdp));
+-    if (strcmp(sp->sp_pwdp, cpw)) {
++    if (!(cpw = crypt(password, sp->sp_pwdp)) || strcmp(sp->sp_pwdp, (const char *)cpw)) {
+       if (flags & VERBOSE) {
+           /*
+            * This _should_ reveal the SHADOW_PW_LOCKED prefix to an
+@@ -221,10 +220,8 @@ auth_shadow (
+           syslog(LOG_DEBUG, "DEBUG: auth_shadow: pw mismatch: '%s' != '%s'",
+                  sp->sp_pwdp, cpw);
+       }
+-      free(cpw);
+       RETURN("NO Incorrect password");
+     }
+-    free(cpw);
+     /*
+      * The following fields will be set to -1 if:
+@@ -286,7 +283,7 @@ auth_shadow (
+       RETURN("NO Invalid username");
+     }
+   
+-    if (strcmp(upw->upw_passwd, crypt(password, upw->upw_passwd)) != 0) {
++    if (!(cpw = crypt(password, upw->upw_passwd)) || (strcmp(upw->upw_passwd, (const char *)cpw) != 0)) {
+       if (flags & VERBOSE) {
+           syslog(LOG_DEBUG, "auth_shadow: pw mismatch: %s != %s",
+                  password, upw->upw_passwd);
index 543e279b46884d6989293aa544010c603a6165c6..c2506dff8c2f92d4d788fb269e1501c228f271db 100644 (file)
@@ -56,6 +56,7 @@ Patch19:      0034-fix_dovecot_authentication.patch
 Patch20:       %{name}-auxprop.patch
 Patch21:       0030-dont_use_la_files_for_opening_plugins.patch
 Patch22:       %{name}-stddef.patch
+Patch23:       http://sourceforge.net/projects/miscellaneouspa/files/glibc217/cyrus-sasl-2.1.26-glibc217-crypt.diff
 URL:           http://asg.web.cmu.edu/sasl/
 BuildRequires: autoconf >= 2.54
 BuildRequires: automake >= 1:1.7
This page took 0.043953 seconds and 4 git commands to generate.