Bug 1673802 - CVE-2019-7639 gsi-openssh: enabling PermitPAMUserChange allows to login with the correct username and wrong password [fedora-all]
Summary: CVE-2019-7639 gsi-openssh: enabling PermitPAMUserChange allows to login with ...
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: gsi-openssh
Version: 29
Hardware: All
OS: Linux
unspecified
urgent
Target Milestone: ---
Assignee: Mattias Ellert
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Keywords: Security, SecurityTracking
Depends On:
Blocks: CVE-2019-7639
TreeView+ depends on / blocked
 
Reported: 2019-02-08 07:52 UTC by viraniac
Modified: 2019-07-22 13:14 UTC (History)
4 users (show)

(edit)
Clone Of:
(edit)
Last Closed: 2019-02-18 01:26:28 UTC


Attachments (Terms of Use)

Description viraniac 2019-02-08 07:52:43 UTC
Description of problem:
If PermitPAMUserChange is set to yes in the sshd_config for gsi-openssh-server, anyone is allowed to login to the system with existing user even if they provide incorrect password

Version-Release number of selected component (if applicable): 7.9p1-3.fc29


How reproducible:
Always

Steps to Reproduce:
1. Install gsi-openssh-server
2. Initialize rsa, ecdsa, ed25519 keys for gsi-openssh server using gsissh-keygen
2. Set PermitPAMUserChange to yes in /etc/gsissh/sshd_config
3. Run /usr/sbin/gsisshd
4. Try to connect to the system using Putty with user "root" and some incorrect password like "test1234" (The actual password for root on the test system was root1234)

Actual results:
User gets logged in even though there is a failure entry in /var/log/messages for user authentication


Expected results:
User should not be able to login unless he provides the correct password

Additional info:
This use to work fine on 7.7p1. I haven't tested the 7.8p1 but its possible that earlier versions might also be vulnerable.

Comment 1 viraniac 2019-02-08 12:43:51 UTC
I have posted a request for CVE and have got the following id for the same. CVE-2019-7639

Comment 2 viraniac 2019-02-08 14:23:18 UTC
I went through the code of openssh-7.9p1-gsissh.patch

I found the following code at line 511

 	sshpam_err = pam_authenticate(sshpam_handle, flags);
+	if (options.permit_pam_user_change) {
+		sshpam_check_userchanged();
+	}

and then I saw the definition of sshpam_check_userchanged() function and I noticed that its also using the same variable "sshpam_err" to check if the user that we want to map to exists.

But because of that, it changes sshpam_err to say that the operation was a success. The code present on line 515 onward interpret it as authentication was successful and user ends up logging into the system with incorrect password.

Comment 3 Fedora Update System 2019-02-08 21:39:55 UTC
gsi-openssh-7.9p1-5.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-af3d726d38

Comment 4 Fedora Update System 2019-02-08 21:41:07 UTC
gsi-openssh-7.8p1-3.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2019-710afd062a

Comment 5 Mattias Ellert 2019-02-08 23:02:05 UTC
+ not affected
- affected

+ gsi-openssh-7.7p1-5.fc28
- gsi-openssh-7.8p1-1.fc28
- gsi-openssh-7.8p1-2.fc28
+ gsi-openssh-7.8p1-3.fc28

+ gsi-openssh-7.7p1-5.fc29
- gsi-openssh-7.9p1-1.fc29
- gsi-openssh-7.9p1-2.fc29
- gsi-openssh-7.9p1-3.fc29
- gsi-openssh-7.9p1-4.fc29
+ gsi-openssh-7.9p1-5.fc29

+ gsi-openssh-7.7p1-5.fc30
- gsi-openssh-7.9p1-1.fc30
- gsi-openssh-7.9p1-2.fc30
- gsi-openssh-7.9p1-2.fc30.1
- gsi-openssh-7.9p1-3.fc30- 
- gsi-openssh-7.9p1-3.fc30.1
- gsi-openssh-7.9p1-4.fc30
+ gsi-openssh-7.9p1-5.fc30

Comment 6 Fedora Update System 2019-02-10 01:50:55 UTC
gsi-openssh-7.8p1-3.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-2019-710afd062a

Comment 7 Fedora Update System 2019-02-10 04:27:52 UTC
gsi-openssh-7.9p1-5.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-2019-af3d726d38

Comment 8 Fedora Update System 2019-02-18 01:26:28 UTC
gsi-openssh-7.8p1-3.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2019-02-18 02:03:56 UTC
gsi-openssh-7.9p1-5.fc29 has been pushed to the Fedora 29 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.