[Openstack-security] [Bug 1368073] Re: [Security-NIST]SimpleDH in nova/virt/xenapi/agent.py does not fit the NIST

Thierry Carrez thierry.carrez+lp at gmail.com
Fri Sep 19 13:47:58 UTC 2014


** Tags added: security

** Information type changed from Public Security to Public

** Changed in: ossa
       Status: Incomplete => Won't Fix

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

Title:
  [Security-NIST]SimpleDH in nova/virt/xenapi/agent.py does not fit
  the NIST

Status in OpenStack Compute (Nova):
  Confirmed
Status in OpenStack Security Advisories:
  Won't Fix

Bug description:
  class SimpleDH(object):
      """This class wraps all the functionality needed to implement
      basic Diffie-Hellman-Merkle key exchange in Python. It features
      intelligent defaults for the prime and base numbers needed for the
      calculation, while allowing you to supply your own. It requires that
      the openssl binary be installed on the system on which this is run,
      as it uses that to handle the encryption and decryption. If openssl
      is not available, a RuntimeError will be raised.
      """
      def __init__(self):
          self._prime = 162259276829213363391578010288127
          self._base = 5
          self._public = None
          self._shared = None
          self.generate_private()

      def generate_private(self):
          self._private = int(binascii.hexlify(os.urandom(10)), 16)
          return self._private

      def get_public(self):
          self._public = pow(self._base, self._private, self._prime)
          return self._public

      def compute_shared(self, other):
          self._shared = pow(other, self._private, self._prime)
          return self._shared

      def _run_ssl(self, text, decrypt=False):
          cmd = ['openssl', 'aes-128-cbc', '-A', '-a', '-pass',
                 'pass:%s' % self._shared, '-nosalt']
          if decrypt:
              cmd.append('-d')
          out, err = utils.execute(*cmd, process_input=text)
          if err:
              raise RuntimeError(_('OpenSSL error: %s') % err)
          return out

      def encrypt(self, text):
          return self._run_ssl(text).strip('\n')

      def decrypt(self, text):
          return self._run_ssl(text, decrypt=True)

          
  Nova use the SimpleDH to call the xen agent to set the root password of the instance.
   
  In NIST,  the DH algorithm need |p| = 2048 bit, and |q| = 224 or 256 bits
  In the SimpleDH, |q| = int(binascii.hexlify(os.urandom(10)), 16)
  It was only 24*4 = 96bit
  p = 162259276829213363391578010288127 is far less than 2048 bit
  So the SimpleDH is not fit the NIST

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




More information about the Openstack-security mailing list