[Openstack-security] [Bug 1516031] Fix merged to glance (master)

OpenStack Infra 1516031 at bugs.launchpad.net
Mon Feb 29 18:20:46 UTC 2016


Reviewed:  https://review.openstack.org/255584
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=95ca43f30f5bcc8107e0615b3861daa2c77a2aec
Submitter: Jenkins
Branch:    master

commit 95ca43f30f5bcc8107e0615b3861daa2c77a2aec
Author: Brianna Poulos <Brianna.Poulos at jhuapl.edu>
Date:   Tue Dec 8 17:24:11 2015 -0500

    Add sign-the-data signature verification
    
    Per discussion on the mailing list [1] and the related nova
    specification [2] it has been decided that the signature should be of
    the image data directly, rather than of the glance MD5 "checksum" hash
    of the image data.
    
    This patch adds the ability to verify a signature of the image data
    directly, using a verifier that is passed to the glance_store backend.
    It is dependent on a glance_store patch which updates this verifier
    object with the image data as it is creating the checksum (see
    Depends-On below).
    
    [1] http://bit.ly/1Q0M0C7
    [2] https://review.openstack.org/#/c/188874/19
    
    Depends-On: I43799e6a4a6643a23769af8d839a2beb4e0ff9bf
    Partial-Bug: #1516031
    Change-Id: If0c06b3094cecef6c8ca8a65753038b6b5a9d8fe

-- 
You received this bug notification because you are a member of OpenStack
Security, which is subscribed to OpenStack.
https://bugs.launchpad.net/bugs/1516031

Title:
  Use of MD5 in OpenStack Glance image signature (CVE-2015-8234)

Status in Glance:
  Triaged
Status in OpenStack Security Advisory:
  Won't Fix
Status in OpenStack Security Notes:
  Fix Released

Bug description:
  This have been reported by Daniel P. Berrange:
  "
  In the OpenStack Liberty release, the Glance project added support for image signature verification.

  http://specs.openstack.org/openstack/glance-specs/specs/liberty/image-
  signing-and-verification-support.html

  The verification code was added in the following git commit

  https://github.com/openstack/glance/commit/484ef1b40b738c87adb203bba6107ddb4b04ff6e

  
  Unfortunately the design of this signature verification method is flawed by design.

  The generalized approach to creating signatures of content is to apply
  a hash to the content and then encrypt it in some manner. Consider
  that the signature is defined to use hash=sha256 and cipher=rsa we can
  describe the signature computation as

  signature = rsa(sha256(content))

  In the case of verifying a disk image, the content we care about
  verifying is the complete disk image file. Unfortunately, the glance
  specification chose *not* to compute the signature against the disk
  image file. Glance already had an MD5 checksum calculated for the disk
  image file, so they instead chose to compute the signature against the
  MD5 checksum instead. ie glance is running

  signature = rsa(sha256(md5(disk-image-content)))

  This degrades the security of the system to that of the weakest hash,
  which is obviously MD5 here.

  The code where glance verifies the signature is in the
  glance/locations.py, the 'set_data' method where is does

   result = signature_utils.verify_signature(
   self.context, checksum, self.image.extra_properties)
   if result:
   LOG.info(_LI("Successfully verified signature for image %s"),
   self.image.image_id)

  The 'checksum' variable is populate by the glance_store driver, but it
  is hardcoded to always be md5 in all current glance storage backends:

   $ git grep hashlib glance_store/_drivers/ | grep checksum
   glance_store/_drivers/filesystem.py: checksum = hashlib.md5()
   glance_store/_drivers/rbd.py: checksum = hashlib.md5()
   glance_store/_drivers/s3.py: checksum = hashlib.md5()
   glance_store/_drivers/s3.py: checksum = hashlib.md5()
   glance_store/_drivers/sheepdog.py: checksum = hashlib.md5()
   glance_store/_drivers/swift/store.py: checksum =
   hashlib.md5()
   glance_store/_drivers/vmware_datastore.py: self.checksum =
   hashlib.md5()

  
  Since we will soon be shipping OpenStack Liberty release, we need to at least give a security notice to alert our customers to the fact that the signature verification is cryptographically weak/broken. IMHO, it quite likely deserves a CVE though

  NB, this is public knowledge as I first became aware of this flawed
  design in comments / discussion on a public specification proposed to
  implement the same approach in the Nova project.

  My suggested way to fix this is to simply abandon the current impl and
  re-do it such that it directly computes the signature against  the
  disk image, and does not use the existing md5 checksum in any way.

  Regards,
  Daniel
  "

  Mailing list thread for Nova impl: http://lists.openstack.org/pipermail/openstack-dev/2015-November/079348.html
  Nova Spec: https://review.openstack.org/#/c/188874/

To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/1516031/+subscriptions




More information about the Openstack-security mailing list