Bug 1039801 (CVE-2013-6418)

Summary: CVE-2013-6418 pywbem: TOCTOU vulnerability in certificate validation
Product: [Other] Security Response Reporter: Murray McAllister <mmcallis>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: fweimer, jkurik, jrusnack, jsafrane, pfrields, security-response-team, sgallagh
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-01-20 17:48:29 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: 1026891, 1030983, 1065357, 1065358, 1065359, 1121049    
Bug Blocks: 1024277, 1039805    
Attachments:
Description Flags
final fix none

Description Murray McAllister 2013-12-10 02:42:18 UTC
Florian Weimer discovered a TOCTOU (time of check to time of use) vulnerability in the way PyWBEM, a Python library for making CIM (Common Information Model) operations over HTTP using the WBEM CIM-XML protocol, performed certificate validation. An attacker could use this flaw to perform man-in-the-middle attacks against applications that are using PyWBEM.

Acknowledgements:

This issue was discovered by Florian Weimer of the Red Hat Product Security Team.

Comment 1 Murray McAllister 2013-12-10 02:51:58 UTC
In depth information from Florian:

I noticed this code in cim_http.py:

     124             try:
     125                 from OpenSSL import SSL
     126                 ctx = SSL.Context(SSL.SSLv3_METHOD)
     127                 ctx.set_verify(SSL.VERIFY_PEER, verify_callback)
     128                 # Add the key and certificate to the session
     129                 if cert_file is not None and key_file is not None:
     130                   ctx.use_certificate_file(cert_file)
     131                   ctx.use_privatekey_file(key_file)
     132                 s = SSL.Connection(ctx, socket.socket(socket.AF_INET,
     133 socket.SOCK_STREAM))
     134                 s.connect((host, port))
     135                 s.do_handshake()
     136                 s.shutdown()
     137                 s.close()
     138             except socket.error, arg:
     139                 raise Error("Socket error: %s" % (arg,))
     140             except socket.sslerror, arg:
     141                 raise Error("SSL error: %s" % (arg,))



     151         h = HTTPSConnection(host, port = port, key_file = key_file,
     152                                             cert_file = cert_file)

verify_callback is only used for the probing connection, it is not used for the actual server interaction.  This means pywbem has a time-of-check-time-of-use vulnerability and man-in-the-middle attacks on the second HTTPS connection are possible.

Comment 3 Murray McAllister 2013-12-19 02:29:13 UTC
Public now via a Fedora build. Note that the fix there may not be the correct one. Refer to http://seclists.org/oss-sec/2013/q4/524 for further details.

Comment 4 Murray McAllister 2014-01-16 23:53:27 UTC
Created attachment 851357 [details]
final fix

Final fix. This patch corrects CVE-2013-6418 (bug 1039801) and CVE-2013-6444 (bug 1044246)

Comment 5 Murray McAllister 2014-01-20 23:59:46 UTC
(In reply to Murray McAllister from comment #4)
> Created attachment 851357 [details]
> final fix
> 
> Final fix. This patch corrects CVE-2013-6418 (bug 1039801) and CVE-2013-6444
> (bug 1044246)

Upstream commit:

http://sourceforge.net/p/pywbem/code/627/

Comment 6 Murray McAllister 2014-01-21 11:03:05 UTC
> Upstream commit:
> 
> http://sourceforge.net/p/pywbem/code/627/

This one is also needed:

http://sourceforge.net/p/pywbem/code/622/

Comment 8 Stefan Cornelius 2014-02-14 13:20:16 UTC
Created pywbem tracking bugs for this issue:

Affects: epel-5 [bug 1065357]

Comment 11 Vincent Danen 2015-01-20 17:48:00 UTC
Statement:

Red Hat Product Security has rated this issue as having Moderate security impact. This issue is not currently planned to be addressed in future updates. For additional information, refer to the Issue Severity Classification: https://access.redhat.com/security/updates/classification/.