Headline
CVE-2022-29189: Add limit to fragmentBuffer · pion/dtls@a6397ff
Pion DTLS is a Go implementation of Datagram Transport Layer Security. Prior to version 2.1.4, a buffer that was used for inbound network traffic had no upper limit. Pion DTLS would buffer all network traffic from the remote user until the handshake completes or timed out. An attacker could exploit this to cause excessive memory usage. Version 2.1.4 contains a patch for this issue. There are currently no known workarounds available.
@@ -1,6 +1,7 @@ package dtls
import ( “errors” “reflect” “testing” ) @@ -57,7 +58,7 @@ func TestFragmentBuffer(t *testing.T) { Epoch: 0, }, { Name: "Multiple Handshakes in Signle Fragment", Name: "Multiple Handshakes in Single Fragment", In: [][]byte{ { 0x16, 0xfe, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x30, /* record header */ @@ -113,3 +114,18 @@ func TestFragmentBuffer(t *testing.T) { } } }
func TestFragmentBuffer_Overflow(t *testing.T) { fragmentBuffer := newFragmentBuffer()
// Push a buffer that doesn’t exceed size limits if _, err := fragmentBuffer.push([]byte{0x16, 0xfe, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x00}); err != nil { t.Fatal(err) }
// Allocate a buffer that exceeds cache size largeBuffer := make([]byte, fragmentBufferMaxSize) if _, err := fragmentBuffer.push(largeBuffer); !errors.Is(err, errFragmentBufferOverflow) { t.Fatalf("Pushing a large buffer returned (%s) expected(%s)", err, errFragmentBufferOverflow) } }
Related news
### Impact A buffer that was used for inbound network traffic had no upper limit. Pion DTLS would buffer all network traffic from the remote user until the handshake completes or times out. An attacker could exploit this to cause excessive memory usage. ### Patches Upgrade to Pion DTLS v2.1.4 ### Workarounds No workarounds available, upgrade to Pion DTLS v2.1.4 ### References Thank you to [Juho Nurminen](https://github.com/jupenur) and the Mattermost team for discovering and reporting this. ### For more information If you have any questions or comments about this advisory: * Open an issue in [Pion DTLS](http://github.com/pion/dtls) * Email us at [[email protected]](mailto:[email protected])