Skip to contentSkip to conversation

Fix transport message length check

PATCH In review Chris Branch 2 participants 2 messages Sep 25, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix transport message length check

wireguard-go has a bad length check in its transport message handling. Although it cannot be exploited because of another length check earlier in the function, this should be fixed regardless.

---
 receive.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
receive.go +1 -1
index 6b6543c..cbc3fd1 100644
@@ -146,7 +146,7 @@ func (device *Device) RoutineReceiveIncoming(IP int, bind Bind) {
 
 			// check size
 
-			if len(packet) < MessageTransportType {
+			if len(packet) < MessageTransportSize {
 				continue
 			}
 
Signature · 6 lines
2.11.0

_______________________________________________
WireGuard mailing list
[email protected]
https://lists.zx2c4.com/mailman/listinfo/wireguard
#1 lore raw

Hey Chris,

Quoted 14 lines · Chris Branch

wireguard-go has a bad length check in its transport message handling. Although it cannot be exploited because of another length check earlier in the function, this should be fixed regardless.

---
  receive.go | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
receive.go +0 -0
index 6b6543c..cbc3fd1 100644

receive.go func (device *Device) RoutineReceiveIncoming(IP int, bind Bind) { · line 152

Quoted 8 lines
receive.go +1 -1
@@ -146,7 +146,7 @@ func (device *Device) RoutineReceiveIncoming(IP int, bind Bind) {
 
  			// check size
 
-			if len(packet) < MessageTransportType {
+			if len(packet) < MessageTransportSize {
  				continue
  			}
 

Nice catch! Fixed in master. I'll probably have a new snapshot out not before too long.

Jason
_______________________________________________
WireGuard mailing list
[email protected]
https://lists.zx2c4.com/mailman/listinfo/wireguard