SNMP4J 3.13.2 Release

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 a DTLSTM handshake 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 single SSLEngine.unwrap(..) call cannot be interrupted, the DTLSTM handshake 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() (default 32768),
    • contain a fragment other than the first or the last fragment of a message that is shorter than DTLSTM.getMinHandshakeFragmentLength() (default 128); 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() (default 8) fragments in a record,
    • exceed DTLSTM.getMaxHandshakeFragments() (default 512) 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() (default 16) limit, which allows the retransmission of a lost final flight. The number of dropped datagrams is available from DTLSTM.getDroppedInboundPacketCount(). In addition, the handshake timeout is now checked before every SSLEngine.unwrap(..) call, also when records of an already received datagram are buffered, and a DTLSTM that is not listening accepts handshake datagrams only from the peer it is connecting to.
  • Fixed: Since 3.13.0, TSM discarded every response received by a DTLSTM command generator without a TlsTmSecurityCallback with “Rejecting message from unauthenticated transport peer … with empty tmSecurityName”, because DTLSTM did not assign a security name to messages received on a session it had opened as client. Such messages now get the tmSecurityName the session has been opened for (RFC 6353 §5.1.2), which also takes precedence over a security name returned by a client side TlsTmSecurityCallback.