WireGuard Archive on lore.kernel.org
 help / color / 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, back to index

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

WireGuard Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/wireguard/0 wireguard/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 wireguard wireguard/ https://lore.kernel.org/wireguard \
		wireguard@lists.zx2c4.com zx2c4-wireguard@archiver.kernel.org
	public-inbox-index wireguard


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/com.zx2c4.lists.wireguard


AGPL code for this site: git clone https://public-inbox.org/ public-inbox