SNMP4J v3.13.2 has been released today with workarounds for a JDK 9-28 bug affecting the robustness of DTLSTM. The workarounds avoid the DoS vulnerability present in these JDKs.
CHANGES
- SECURITY: The SunJSSE DTLS handshake reassembly (JDK 9 up to at least JDK 28) needs CPU time that is quadratic in the number of missing byte ranges of a fragmented handshake message for every received fragment (CWE-407).
With one byte fragments at alternating offsets, a peer could keep aDTLSTMhandshake thread busy for minutes with a few hundred kilobytes of input. Certificate and ClientKeyExchange fragments were accepted by SunJSSE even before the cookie exchange, thus from spoofed source addresses. An authenticated peer could also send such fragments on an established session and thereby stall the single listen thread for all other peers. Because a singleSSLEngine.unwrap(..)call cannot be interrupted, theDTLSTMhandshake timeout did not limit this either.
DTLSTM now inspects the plaintext DTLS record and handshake fragment headers before passing a datagram to the SSLEngine and silently drops datagrams that- contain malformed, empty or out of range fragments or fragments of messages longer than
DTLSTM.getMaxHandshakeMessageLength()(default32768), - contain a fragment other than the first or the last fragment of a message that is shorter than
DTLSTM.getMinHandshakeFragmentLength()(default128); the first fragment is exempt, because OpenSSL (e.g. net-snmp) starts a message in the space left in the current datagram with fragments of a few bytes only, - contain more than
DTLSTM.getMaxHandshakeFragmentsPerRecord()(default8) fragments in a record, - exceed
DTLSTM.getMaxHandshakeFragments()(default512) fragments per handshake, - contain handshake messages other than ClientHello before the server has sent its ServerHello (i.e. before the cookie exchange has been completed), or messages other than HelloVerifyRequest and ServerHello before a client has received a ServerHello,
- contain handshake records after the handshake has been finished, unless within the handshake timeout and the
DTLSTM.getMaxPostHandshakeRecords()(default16) limit, which allows the retransmission of a lost final flight. The number of dropped datagrams is available fromDTLSTM.getDroppedInboundPacketCount(). In addition, the handshake timeout is now checked before everySSLEngine.unwrap(..)call, also when records of an already received datagram are buffered, and aDTLSTMthat is not listening accepts handshake datagrams only from the peer it is connecting to.
- contain malformed, empty or out of range fragments or fragments of messages longer than
- Fixed: Since 3.13.0,
TSMdiscarded every response received by aDTLSTMcommand generator without aTlsTmSecurityCallbackwith “Rejecting message from unauthenticated transport peer … with emptytmSecurityName”, becauseDTLSTMdid not assign a security name to messages received on a session it had opened as client. Such messages now get thetmSecurityNamethe session has been opened for (RFC 6353 §5.1.2), which also takes precedence over a security name returned by a client sideTlsTmSecurityCallback.