From mboxrd@z Thu Jan 1 00:00:00 1970 From: Leo Famulari Subject: [PATCH 1/1] gnu: cracklib: Fix CVE-2016-6318. Date: Tue, 16 Aug 2016 22:49:55 -0400 Message-ID: References: Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45812) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZqvt-0002V7-1c for guix-devel@gnu.org; Tue, 16 Aug 2016 22:50:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bZqvn-0008Kt-MG for guix-devel@gnu.org; Tue, 16 Aug 2016 22:50:21 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:56525) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZqvl-0008GF-CM for guix-devel@gnu.org; Tue, 16 Aug 2016 22:50:15 -0400 Received: from localhost.localdomain (c-73-188-17-148.hsd1.pa.comcast.net [73.188.17.148]) by mail.messagingengine.com (Postfix) with ESMTPA id 5EFA4F296E for ; Tue, 16 Aug 2016 22:49:59 -0400 (EDT) In-Reply-To: In-Reply-To: References: List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org * gnu/packages/patches/cracklib-CVE-2016-6318.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/password-utils.scm (cracklib)[source]: Use the patch. --- gnu/local.mk | 1 + gnu/packages/password-utils.scm | 2 + gnu/packages/patches/cracklib-CVE-2016-6318.patch | 95 +++++++++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100644 gnu/packages/patches/cracklib-CVE-2016-6318.patch diff --git a/gnu/local.mk b/gnu/local.mk index 7416850..d890046 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -464,6 +464,7 @@ dist_patch_DATA = \ %D%/packages/patches/cpio-gets-undeclared.patch \ %D%/packages/patches/cpio-CVE-2016-2037.patch \ %D%/packages/patches/cpufrequtils-fix-aclocal.patch \ + %D%/packages/patches/cracklib-CVE-2016-6318.patch \ %D%/packages/patches/crda-optional-gcrypt.patch \ %D%/packages/patches/crossmap-allow-system-pysam.patch \ %D%/packages/patches/csound-header-ordering.patch \ diff --git a/gnu/packages/password-utils.scm b/gnu/packages/password-utils.scm index 7a8bdcb..7288da6 100644 --- a/gnu/packages/password-utils.scm +++ b/gnu/packages/password-utils.scm @@ -29,6 +29,7 @@ #:use-module (guix build-system gnu) #:use-module (guix download) #:use-module (guix packages) + #:use-module (gnu packages) #:use-module (gnu packages admin) #:use-module (gnu packages base) #:use-module (gnu packages compression) @@ -159,6 +160,7 @@ and vice versa.") (uri (string-append "https://github.com/cracklib/cracklib/" "releases/download/" name "-" version "/" name "-" version ".tar.gz")) + (patches (search-patches "cracklib-CVE-2016-6318.patch")) (sha256 (base32 "0hrkb0prf7n92w6rxgq0ilzkk6rkhpys2cfqkrbzswp27na7dkqp")))) diff --git a/gnu/packages/patches/cracklib-CVE-2016-6318.patch b/gnu/packages/patches/cracklib-CVE-2016-6318.patch new file mode 100644 index 0000000..4806eca --- /dev/null +++ b/gnu/packages/patches/cracklib-CVE-2016-6318.patch @@ -0,0 +1,95 @@ +Fix CVE-2016-6318. + +https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-6318 + +Patch copied from Red Hat: + +https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2016-6318 +https://bugzilla.redhat.com/attachment.cgi?id=1188599&action=diff + +It is not safe to pass words longer than STRINGSIZE further to cracklib +so the longbuffer cannot be longer than STRINGSIZE. +diff -up cracklib-2.9.0/lib/fascist.c.longgecos cracklib-2.9.0/lib/fascist.c +--- cracklib-2.9.0/lib/fascist.c.longgecos 2014-02-06 16:03:59.000000000 +0100 ++++ cracklib-2.9.0/lib/fascist.c 2016-08-08 12:05:40.279235815 +0200 +@@ -515,7 +515,7 @@ FascistGecosUser(char *password, const c + char gbuffer[STRINGSIZE]; + char tbuffer[STRINGSIZE]; + char *uwords[STRINGSIZE]; +- char longbuffer[STRINGSIZE * 2]; ++ char longbuffer[STRINGSIZE]; + + if (gecos == NULL) + gecos = ""; +@@ -596,38 +596,47 @@ FascistGecosUser(char *password, const c + { + for (i = 0; i < j; i++) + { +- strcpy(longbuffer, uwords[i]); +- strcat(longbuffer, uwords[j]); +- +- if (GTry(longbuffer, password)) ++ if (strlen(uwords[i]) + strlen(uwords[j]) < STRINGSIZE) + { +- return _("it is derived from your password entry"); +- } +- +- strcpy(longbuffer, uwords[j]); +- strcat(longbuffer, uwords[i]); ++ strcpy(longbuffer, uwords[i]); ++ strcat(longbuffer, uwords[j]); + +- if (GTry(longbuffer, password)) +- { +- return _("it's derived from your password entry"); ++ if (GTry(longbuffer, password)) ++ { ++ return _("it is derived from your password entry"); ++ } ++ ++ strcpy(longbuffer, uwords[j]); ++ strcat(longbuffer, uwords[i]); ++ ++ if (GTry(longbuffer, password)) ++ { ++ return _("it's derived from your password entry"); ++ } + } + +- longbuffer[0] = uwords[i][0]; +- longbuffer[1] = '\0'; +- strcat(longbuffer, uwords[j]); +- +- if (GTry(longbuffer, password)) ++ if (strlen(uwords[j]) < STRINGSIZE - 1) + { +- return _("it is derivable from your password entry"); ++ longbuffer[0] = uwords[i][0]; ++ longbuffer[1] = '\0'; ++ strcat(longbuffer, uwords[j]); ++ ++ if (GTry(longbuffer, password)) ++ { ++ return _("it is derivable from your password entry"); ++ } + } + +- longbuffer[0] = uwords[j][0]; +- longbuffer[1] = '\0'; +- strcat(longbuffer, uwords[i]); +- +- if (GTry(longbuffer, password)) ++ if (strlen(uwords[i]) < STRINGSIZE - 1) + { +- return _("it's derivable from your password entry"); ++ longbuffer[0] = uwords[j][0]; ++ longbuffer[1] = '\0'; ++ strcat(longbuffer, uwords[i]); ++ ++ if (GTry(longbuffer, password)) ++ { ++ return _("it's derivable from your password entry"); ++ } + } + } + } -- 2.9.3