Bug 1588004 - pam_mysql segfaults if the passwords starts with not-letter character
Summary: pam_mysql segfaults if the passwords starts with not-letter character
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: pam_mysql
Version: el6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Paul P Komkoff Jr
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-06-06 13:00 UTC by Alexander Bersenev
Modified: 2018-12-14 20:41 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-12-10 23:19:57 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
the patch (755 bytes, patch)
2018-06-06 13:00 UTC, Alexander Bersenev
no flags Details | Diff

Description Alexander Bersenev 2018-06-06 13:00:44 UTC
Created attachment 1448305 [details]
the patch

Description of problem:
Pam_mysql segfaults when an encrypted password used and the characters of salt in database not in [a-zA-Z0-9./].

The pam_mysql uses first two characters of the password as salt for crypt functions. However, according to man-page, the salt can only contain these characters: [a-zA-Z0-9./], otherwise it can return null pointer.

The code of checking password (pam_mysql.c) looks like this:
vresult = strcmp(row[0], crypt(passwd, row[0]));

So when the crypt call failed, the row[0] string is compared with null-pointer string and the segfault occurs.

In the one of pam_mysql fork it was fixed in 2015: https://github.com/NigelCunningham/pam-MySQL/commit/af6c8bb9e0375dda6cee20b3de6a23f5d7087635#diff-5903b4d238fdc681232da9aea81f66c3

Version-Release number of selected component (if applicable):
0.7RC1

How reproducible:
The bug is reproducible in rhel6, but not reproducible in rhel5.

Steps to Reproduce:
Setup pam_mysql to use encrypted passwords, create a user with password "!@#$%^" and try to login.

Actual results:
Program segfaults

Expected results:
Program doesn't segfault

Comment 1 Paul P Komkoff Jr 2018-06-06 14:51:34 UTC
I should probably just rebase this onto Nigel's fork :\

Comment 2 Alexander Bersenev 2018-06-06 17:57:40 UTC
Great idea!

Comment 3 Fedora Update System 2018-12-01 13:18:18 UTC
pam_mysql-0.8.1-0.2.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-bb07632c10

Comment 4 Fedora Update System 2018-12-01 13:18:34 UTC
pam_mysql-0.8.1-0.2.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2018-e600272170

Comment 5 Fedora Update System 2018-12-02 07:54:23 UTC
pam_mysql-0.8.1-0.2.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-bb07632c10

Comment 6 Fedora Update System 2018-12-02 10:10:13 UTC
pam_mysql-0.8.1-0.2.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-e600272170

Comment 7 Randy Barlow 2018-12-10 23:19:57 UTC
An update associated with this bug has been pushed to stable.

Comment 8 Randy Barlow 2018-12-11 17:04:09 UTC
A Fedora update associated with this bug has been pushed to the stable repository.

Comment 9 Randy Barlow 2018-12-14 20:41:19 UTC
A Fedora update associated with this bug has been pushed to the stable repository.


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