1. 19 Aug, 2016 2 commits
    • Matt Caswell's avatar
      Fix DTLS replay protection · b77ab018
      Matt Caswell authored
      
      
      The DTLS implementation provides some protection against replay attacks
      in accordance with RFC6347 section 4.1.2.6.
      
      A sliding "window" of valid record sequence numbers is maintained with
      the "right" hand edge of the window set to the highest sequence number we
      have received so far. Records that arrive that are off the "left" hand
      edge of the window are rejected. Records within the window are checked
      against a list of records received so far. If we already received it then
      we also reject the new record.
      
      If we have not already received the record, or the sequence number is off
      the right hand edge of the window then we verify the MAC of the record.
      If MAC verification fails then we discard the record. Otherwise we mark
      the record as received. If the sequence number was off the right hand edge
      of the window, then we slide the window along so that the right hand edge
      is in line with the newly received sequence number.
      
      Records may arrive for future epochs, i.e. a record from after a CCS being
      sent, can arrive before the CCS does if the packets get re-ordered. As we
      have not yet received the CCS we are not yet in a position to decrypt or
      validate the MAC of those records. OpenSSL places those records on an
      unprocessed records queue. It additionally updates the window immediately,
      even though we have not yet verified the MAC. This will only occur if
      currently in a handshake/renegotiation.
      
      This could be exploited by an attacker by sending a record for the next
      epoch (which does not have to decrypt or have a valid MAC), with a very
      large sequence number. This means the right hand edge of the window is
      moved very far to the right, and all subsequent legitimate packets are
      dropped causing a denial of service.
      
      A similar effect can be achieved during the initial handshake. In this
      case there is no MAC key negotiated yet. Therefore an attacker can send a
      message for the current epoch with a very large sequence number. The code
      will process the record as normal. If the hanshake message sequence number
      (as opposed to the record sequence number that we have been talking about
      so far) is in the future then the injected message is bufferred to be
      handled later, but the window is still updated. Therefore all subsequent
      legitimate handshake records are dropped. This aspect is not considered a
      security issue because there are many ways for an attacker to disrupt the
      initial handshake and prevent it from completing successfully (e.g.
      injection of a handshake message will cause the Finished MAC to fail and
      the handshake to be aborted). This issue comes about as a result of trying
      to do replay protection, but having no integrity mechanism in place yet.
      Does it even make sense to have replay protection in epoch 0? That
      issue isn't addressed here though.
      
      This addressed an OCAP Audit issue.
      
      CVE-2016-2181
      
      Reviewed-by: default avatarRichard Levitte <levitte@openssl.org>
      b77ab018
    • Matt Caswell's avatar
      Fix DTLS unprocessed records bug · fa755697
      Matt Caswell authored
      
      
      During a DTLS handshake we may get records destined for the next epoch
      arrive before we have processed the CCS. In that case we can't decrypt or
      verify the record yet, so we buffer it for later use. When we do receive
      the CCS we work through the queue of unprocessed records and process them.
      
      Unfortunately the act of processing wipes out any existing packet data
      that we were still working through. This includes any records from the new
      epoch that were in the same packet as the CCS. We should only process the
      buffered records if we've not got any data left.
      
      Reviewed-by: default avatarRichard Levitte <levitte@openssl.org>
      fa755697
  2. 16 Aug, 2016 1 commit
  3. 15 Aug, 2016 3 commits
  4. 05 Aug, 2016 2 commits
  5. 04 Aug, 2016 3 commits
  6. 03 Aug, 2016 1 commit
  7. 02 Aug, 2016 3 commits
  8. 22 Jul, 2016 1 commit
    • Dr. Stephen Henson's avatar
      Fix OOB read in TS_OBJ_print_bio(). · 6adf409c
      Dr. Stephen Henson authored
      
      
      TS_OBJ_print_bio() misuses OBJ_txt2obj: it should print the result
      as a null terminated buffer. The length value returned is the total
      length the complete text reprsentation would need not the amount of
      data written.
      
      CVE-2016-2180
      
      Thanks to Shi Lei for reporting this bug.
      
      Reviewed-by: default avatarMatt Caswell <matt@openssl.org>
      (cherry picked from commit 0ed26acc)
      6adf409c
  9. 30 Jun, 2016 1 commit
  10. 29 Jun, 2016 3 commits
  11. 27 Jun, 2016 1 commit
  12. 07 Jun, 2016 1 commit
  13. 06 Jun, 2016 1 commit
    • Cesar Pereida's avatar
      Fix DSA, preserve BN_FLG_CONSTTIME · d168705e
      Cesar Pereida authored
      
      
      Operations in the DSA signing algorithm should run in constant time in
      order to avoid side channel attacks. A flaw in the OpenSSL DSA
      implementation means that a non-constant time codepath is followed for
      certain operations. This has been demonstrated through a cache-timing
      attack to be sufficient for an attacker to recover the private DSA key.
      
      CVE-2016-2178
      
      Reviewed-by: default avatarRichard Levitte <levitte@openssl.org>
      Reviewed-by: default avatarMatt Caswell <matt@openssl.org>
      (cherry picked from commit 621eaf49)
      d168705e
  14. 03 Jun, 2016 1 commit
  15. 01 Jun, 2016 1 commit
    • Matt Caswell's avatar
      Avoid some undefined pointer arithmetic · 6f35f6de
      Matt Caswell authored
      
      
      A common idiom in the codebase is:
      
      if (p + len > limit)
      {
          return; /* Too long */
      }
      
      Where "p" points to some malloc'd data of SIZE bytes and
      limit == p + SIZE
      
      "len" here could be from some externally supplied data (e.g. from a TLS
      message).
      
      The rules of C pointer arithmetic are such that "p + len" is only well
      defined where len <= SIZE. Therefore the above idiom is actually
      undefined behaviour.
      
      For example this could cause problems if some malloc implementation
      provides an address for "p" such that "p + len" actually overflows for
      values of len that are too big and therefore p + len < limit!
      
      Issue reported by Guido Vranken.
      
      CVE-2016-2177
      
      Reviewed-by: default avatarRich Salz <rsalz@openssl.org>
      6f35f6de
  16. 26 May, 2016 2 commits
  17. 23 May, 2016 1 commit
  18. 19 May, 2016 1 commit
  19. 11 May, 2016 2 commits
  20. 09 May, 2016 1 commit
  21. 06 May, 2016 3 commits
  22. 05 May, 2016 2 commits
  23. 04 May, 2016 3 commits