Bug 815993

Summary: PATCH: properly deal with crypt() returning NULL
Product: [Fedora] Fedora Reporter: Paul Wouters <pwouters>
Component: opensshAssignee: Petr Lautrbach <plautrba>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: 17CC: mattias.ellert, mgrepl, plautrba, tmraz
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-21 05:57:36 EDT Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Description Flags
patch hanlding crypt() returning NULL none

Description Paul Wouters 2012-04-24 21:41:25 EDT
the xcrypt() function can use the crypt() function underneath, which can return NULL. But xcrypt() output is blindly strcmp()'ed.

Attached patch addresses this. Patch also send upstream.

crypt() returning NULL can happen in fips mode when the hash algo is not an approved algorithm such as the default MD5...
Comment 1 Paul Wouters 2012-04-24 21:42:54 EDT
Created attachment 580036 [details]
patch hanlding crypt() returning NULL
Comment 2 Tomas Mraz 2012-04-25 03:22:56 EDT
Just note that this code is used only in case UsePAM is set to 'no' which is unsupported configuration. Thus the severity is very low in this case.
Comment 3 Petr Lautrbach 2012-08-06 03:30:32 EDT
The openbsd-compat/port-uw.c patch part doesn't check a return value of the xcrypt() and moreover port-uw.c is not 
relevant to our platform so I used an upstream revision 1.91 of auth-passwd.c:

--- auth-passwd.c       8 Mar 2009 00:40:28 -0000       1.90
+++ auth-passwd.c       25 Apr 2012 23:51:28 -0000      1.91
@@ -209,6 +209,7 @@
         * Authentication is accepted if the encrypted passwords
         * are identical.
-       return (strcmp(encrypted_password, pw_password) == 0);
+       return encrypted_password != NULL &&
+           strcmp(encrypted_password, pw_password) == 0;

Thanks for the report.
Comment 4 Fedora Update System 2012-08-07 03:47:15 EDT
openssh-5.9p1-26.fc17 has been submitted as an update for Fedora 17.
Comment 5 Fedora Update System 2012-08-09 19:11:10 EDT
Package openssh-5.9p1-26.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing openssh-5.9p1-26.fc17'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).
Comment 6 Fedora Update System 2012-08-21 05:57:36 EDT
openssh-5.9p1-26.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.