Bug 815993 - PATCH: properly deal with crypt() returning NULL
PATCH: properly deal with crypt() returning NULL
Product: Fedora
Classification: Fedora
Component: openssh (Show other bugs)
Unspecified Unspecified
low Severity low
: ---
: ---
Assigned To: Petr Lautrbach
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2012-04-24 21:41 EDT by Paul Wouters
Modified: 2012-08-21 05:57 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-08-21 05:57:36 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
patch hanlding crypt() returning NULL (1.54 KB, patch)
2012-04-24 21:42 EDT, Paul Wouters
no flags Details | Diff

  None (edit)
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.

Note You need to log in before you can comment on or make changes to this bug.