Bug 1570649

Summary: pwdhash segfaults when CRYPT storage scheme is used
Product: Red Hat Enterprise Linux 7 Reporter: Viktor Ashirov <vashirov>
Component: 389-ds-baseAssignee: mreynolds
Status: CLOSED ERRATA QA Contact: RHDS QE <ds-qe-bugs>
Severity: unspecified Docs Contact: Marc Muehlfeld <mmuehlfe>
Priority: unspecified    
Version: 7.5CC: mreynolds, nkinder, pasik, rmeggins
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 389-ds-base-1.3.8.2-1.el7 Doc Type: Bug Fix
Doc Text:
The *pwdhash* utility no longer crashes when using the *CRYPT* password storage scheme Previously, the *pwdhash* utility used an invalid mutex lock when creating a hash using the *CRYPT* password storage scheme. As a consequence, *pwdhash* failed with a segmentation fault error. With this update, the utility uses the re-entrant form of the "crypt()" function that does not require a lock. As a result, *pwdhash* no longer crashes when using the *CRYPT* password storage scheme.
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-30 10:13:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Viktor Ashirov 2018-04-23 11:35:14 UTC
Description of problem:
pwdhash -s CRYPT Secret123 
Segmentation fault (core dumped)

Version-Release number of selected component (if applicable):
389-ds-base-1.3.7.5-18.el7.x86_64

How reproducible:
always


Additional info:
(gdb) r
Starting program: /usr/bin/pwdhash -s CRYPT Secret123
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
__GI___pthread_mutex_lock (mutex=mutex@entry=0x0) at ../nptl/pthread_mutex_lock.c:66
66	  unsigned int type = PTHREAD_MUTEX_TYPE_ELISION (mutex);
(gdb) bt 
#0  __GI___pthread_mutex_lock (mutex=mutex@entry=0x0) at ../nptl/pthread_mutex_lock.c:66
#1  0x00007ffff60a4ed9 in PR_Lock (lock=0x0) at ../../../nspr/pr/src/pthreads/ptsynch.c:176
#2  0x00007ffff09aaef1 in crypt_pw_enc_by_hash (pwd=0x555555f5a4e0 "Secret123", hash_algo=0) at ldap/servers/plugins/pwdstorage/crypt_pwd.c:116
#3  0x0000555555555cdf in main (argc=4, argv=0x7fffffffddc8) at ldap/servers/slapd/tools/pwenc.c:243

Comment 1 Viktor Ashirov 2018-04-23 11:40:44 UTC
Storage schemes CRYPT-MD5, CRYPT-SHA256, CRYPT-SHA512 are also producing a crash.

Comment 2 mreynolds 2018-04-23 13:51:39 UTC
Upstream ticket:
https://pagure.io/389-ds-base/issue/49649

Comment 3 mreynolds 2018-04-24 15:04:48 UTC
Fixed upstream

Comment 5 Viktor Ashirov 2018-06-13 21:21:47 UTC
Build tested: 389-ds-base-1.3.8.2-1.el7.x86_64

[root@rhel7 ~]# pwdhash -s CRYPT Secret123 
{crypt}upGHyxEsqa2OI

[root@rhel7 ~]# pwdhash -s CRYPT-MD5 Secret123 
{crypt}$1$8U$fbOhv2rxs2qCRX7tOEn7G/

[root@rhel7 ~]# pwdhash -s CRYPT-SHA256 Secret123 
{crypt}$5$ln$8ok5Y89Ih1bUzeZeER5i1zDqKqF0qrmcBdDJTq/UZd6

[root@rhel7 ~]# pwdhash -s CRYPT-SHA512 Secret123 
{crypt}$6$ul$iAPE8NfptLzwYBjXbZPXlVf98jjDRnw225uCaYPeay1TlROsz9RPHuAHoQiOFRwRGODy2.wUBgwLlijLav8MV/

pwdhash no longer crashes, marking as VERIFIED.

Comment 9 errata-xmlrpc 2018-10-30 10:13:48 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:3127