Development discussion of WireGuard
 help / color / mirror / Atom feed
* [PATCH] Fix transport message length check
@ 2018-09-20 12:28 Chris Branch
  2018-09-25  3:20 ` Jason A. Donenfeld
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Branch @ 2018-09-20 12:28 UTC (permalink / raw)
  To: wireguard

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(-)

diff --git a/receive.go b/receive.go
index 6b6543c..cbc3fd1 100644
--- a/receive.go
+++ b/receive.go
@@ -146,7 +146,7 @@ func (device *Device) RoutineReceiveIncoming(IP int, bind Bind) {
 
 			// check size
 
-			if len(packet) < MessageTransportType {
+			if len(packet) < MessageTransportSize {
 				continue
 			}
 
-- 
2.11.0

_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix transport message length check
  2018-09-20 12:28 [PATCH] Fix transport message length check Chris Branch
@ 2018-09-25  3:20 ` Jason A. Donenfeld
  0 siblings, 0 replies; 2+ messages in thread
From: Jason A. Donenfeld @ 2018-09-25  3:20 UTC (permalink / raw)
  To: Chris Branch, wireguard

Hey Chris,

On 9/20/18 2:28 PM, Chris Branch wrote:
> 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(-)
> 
> diff --git a/receive.go b/receive.go
> index 6b6543c..cbc3fd1 100644
> --- a/receive.go
> +++ b/receive.go
> @@ -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
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-09-25  3:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-20 12:28 [PATCH] Fix transport message length check Chris Branch
2018-09-25  3:20 ` Jason A. Donenfeld

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).