Bug 1730227 (CVE-2019-14837)

Summary: CVE-2019-14837 keycloak: keycloak uses hardcoded open dummy domain for new accounts enabling information disclosure
Product: [Other] Security Response Reporter: Marian Rehak <mrehak>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: aboyko, aileenc, avibelli, bgeorges, cbyrne, chazlett, cmacedo, cmoulliard, dffrench, dkreling, drieden, drusso, ggaughan, ikanello, janstey, jbalunas, jmadigan, jochrist, jpadman, jpallich, jshepherd, jwon, krathod, lthon, mszynkie, ngough, pdrozd, pgallagh, pjindal, psampaio, pwright, rruss, security-response-team, sthorger, trepel, trogers
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
A flaw was found in Keycloak. The use of an open hard-coded domain can allow an unauthorized login by setting up a mail server and resetting the user credentials, enabling information disclosure.
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-12-02 19:04:55 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1730228    
Attachments:
Description Flags
Series of screenshots none

Description Marian Rehak 2019-07-16 09:01:30 UTC
A flaw was found in keycloack before version 8.0.0. The owner of 'placeholder.org' domain can setup mail server on this domain and knowing only name of a client can reset password and then log in. For example, for client name 'test' the email address will be 'service-account-test@placeholder.org'

Upstream issue:

https://issues.jboss.org/browse/KEYCLOAK-10780

Upstream patch:

https://github.com/keycloak/keycloak/commit/9a7c1a91a59ab85e7f8889a505be04a71580777f

Comment 1 Jason Shepherd 2019-08-12 02:21:37 UTC
The version of Keycloak used in Red Hat Mobile Application Platform did not have the Service Account feature. It was added in version 1.4, see: https://planet.jboss.org/post/service_accounts_support_in_keycloak

Comment 5 Paramvir jindal 2019-09-13 11:59:46 UTC
please refer to these screen shot attach to replicate this.

Comment 6 Paramvir jindal 2019-09-13 12:00:18 UTC
Created attachment 1614803 [details]
Series of screenshots

Comment 7 Paramvir jindal 2019-09-13 12:16:27 UTC
Steps to reproduce :

- Create an application and deploy it on JBoss EAP with authentication mechanism as BASIC and secure it with RHSSO.
- Register this application this as a RHSSO client (confidential client) with service account enabled (shown in the screen shot attached).
- Setup email server and email verification in RHSSO Realm. (shown in the screen shot attached).
- I have also attached screen shot of my local JDBC client showing the USER_ENTITY table from H2 database. Observe the default email ID created of service accounts.(shown in the screen shot attached)
- Just to be sure that RHSSO indeed send password reset emails, change the default email ID with the one you have access to.
- Now access your application URL and click on "forget password".
- Enter the user name as "service-account-<client-id>" and click submit. (shown in the screen shot attached)
- You will get the password reset email on your email ID.(shown in the screen shot attached)
- Now reset the password and login again with the new password.

Comment 10 Marian Rehak 2019-10-23 13:58:10 UTC
Acknowledgments:

Name: Vadim Ashikhman

Comment 11 Paramvir jindal 2019-11-12 06:06:02 UTC
Mitigation:

It is not a very straight forward workaround but it is possible to mitigate this by manually editing the default Email ID (service_account_name@placeholder.org) to some valid email ID (abc@gmail.com) in the USER_ENTITY table in the RHSSO database used.

Comment 14 errata-xmlrpc 2019-12-02 17:02:52 UTC
This issue has been addressed in the following products:

  Red Hat Single Sign-On 7.3 for RHEL 7

Via RHSA-2019:4041 https://access.redhat.com/errata/RHSA-2019:4041

Comment 15 errata-xmlrpc 2019-12-02 17:03:27 UTC
This issue has been addressed in the following products:

  Red Hat Single Sign-On 7.3 for RHEL 6

Via RHSA-2019:4040 https://access.redhat.com/errata/RHSA-2019:4040

Comment 16 errata-xmlrpc 2019-12-02 17:03:44 UTC
This issue has been addressed in the following products:

  Red Hat Single Sign-On 7.3 for RHEL 8

Via RHSA-2019:4042 https://access.redhat.com/errata/RHSA-2019:4042

Comment 17 errata-xmlrpc 2019-12-02 17:21:16 UTC
This issue has been addressed in the following products:

  Red Hat Single Sign-On

Via RHSA-2019:4045 https://access.redhat.com/errata/RHSA-2019:4045

Comment 18 Product Security DevOps Team 2019-12-02 19:04:55 UTC
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s):

https://access.redhat.com/security/cve/cve-2019-14837