Bug 1264790 (CVE-2015-5284)

Summary: CVE-2015-5284 ipa: ipa-kra-install includes certificate and private key in world readable file
Product: [Other] Security Response Reporter: Martin Prpič <mprpic>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED NOTABUG QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: edewata, jcholast, mbasti, mkosek, nkinder, rcritten, security-response-team, ssorce
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: ipa 4.2.2 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-10-08 11:45:54 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1264793    
Bug Blocks: 1264794    
Attachments:
Description Flags
Proposed patch
none
Proposed patch mbasti: review+

Description Martin Prpič 2015-09-21 08:46:26 UTC
It was discovered that ipa-kra-install puts the CA agent certificate and private key to a world readable file, /etc/httpd/alias/kra-agent.pem. This allows users on an IPA server where ipa-kra-install was run to issue arbitrary certificates with the IPA CA.

The ipa-kra-install script configures the KRA subsystem of Dogtag, which is used for the Password Vault feature of IPA. During the configuration process, a KRA agent user account is created in Dogtag, which is used by IPA to authenticate to the KRA. Currently the KRA agent uses the same certificate and private key as the CA agent, which IPA uses to authenticate to the CA.

The kra-agent.pem file is necessary because the Dogtag client Python library does not support using a certificate and private key from a NSS database for authentication, so it is not possible to use the CA agent certificate and private key directly from their primary location, which is the NSS database at /etc/httpd/alias.

Comment 2 Martin Prpič 2015-09-21 08:56:04 UTC
Statement:

This issue did not affect the versions of ipa as shipped with Red Hat Enterprise Linux 6 and 7 as they did not include the affected KRA subsystem.

Comment 3 Martin Prpič 2015-09-21 09:53:19 UTC
Acknowledgements:

This issue was discovered by Jan Cholasta of Red Hat.

Comment 4 Jan Cholasta 2015-09-21 10:48:38 UTC
Created attachment 1075455 [details]
Proposed patch

See attachment for a patch fixing the issue.

Comment 5 Jan Cholasta 2015-09-21 12:39:21 UTC
Created attachment 1075511 [details]
Proposed patch

Found a copy & paste issue in the patch, updated patch attached.

Comment 6 Martin Bašti 2015-09-22 06:51:08 UTC
The updated patch works for me, ACK.

Comment 7 Simo Sorce 2015-09-22 22:05:32 UTC
Patch looks good to me.

Comment 8 Tomas Hoger 2015-09-25 11:37:20 UTC
Just to explicitly confirm, do the upgrade.py part of the patch take care of automatically fixing existing installations that already have the file with bad permissions?  I see ipa-server's %posttrans runs ipa-server-upgrade.  Is no manual action required after that?

Comment 9 Martin Bašti 2015-09-25 11:45:27 UTC
Yes, upgrade will fix permissions on file, no manual action is needed.

Comment 10 Tomas Hoger 2015-09-25 11:53:43 UTC
Affected functionality was introduced in IPA 4.2.  Therefore, this issue did not affect IPA versions as shipped with Red Hat Enterprise Linux 6 and 7.  The new IPA 4.2 is part of Red Hat Enterprise Linux 7.2 Beta and it is planned to be addressed before the final release of Red Hat Enterprise Linux 7.2.

Comment 11 Jan Cholasta 2015-09-30 05:24:28 UTC
Actually, the certificate is not revoked during the upgrade, so anyone with a copy of kra-agent.pem can still authenticate with it after the upgrade. To prevent this, the private key and certificate must be manually replaced after the upgrade.

Comment 12 Tomas Hoger 2015-10-08 11:42:46 UTC
Lifting embargo.

Comment 13 Tomas Hoger 2015-10-08 11:45:54 UTC
No released Red Hat Enterprise Linux or Fedora version was affected by this flaw.