lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 18 Mar 2024 09:54:13 +0100
From: Eric Dumazet <edumazet@...gle.com>
To: Kuniyuki Iwashima <kuniyu@...zon.com>
Cc: "David S. Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, 
	Paolo Abeni <pabeni@...hat.com>, Martin KaFai Lau <martin.lau@...nel.org>, 
	Kuniyuki Iwashima <kuni1840@...il.com>, netdev@...r.kernel.org, 
	syzkaller <syzkaller@...glegroups.com>
Subject: Re: [PATCH v1 net] tcp: Clear req->syncookie in reqsk_alloc().

On Fri, Mar 15, 2024 at 11:47 PM Kuniyuki Iwashima <kuniyu@...zon.com> wrote:
>
> syzkaller reported a read of uninit req->syncookie. [0]
>
> Originally, req->syncookie was used only in tcp_conn_request()
> to indicate if we need to encode SYN cookie in SYN+ACK, so the
> field remains uninitialised in other places.
>
> The commit 695751e31a63 ("bpf: tcp: Handle BPF SYN Cookie in
> cookie_v[46]_check().") added another meaning in ACK path;
> req->syncookie is set true if SYN cookie is validated by BPF
> kfunc.
>
> After the change, cookie_v[46]_check() always read req->syncookie,
> but it is not initialised in the normal SYN cookie case as reported
> by KMSAN.
>
> Let's make sure we always initialise req->syncookie in reqsk_alloc().
>
> [0]:
> BUG: KMSAN: uninit-value in cookie_v4_check+0x22b7/0x29e0
>  net/ipv4/syncookies.c:477
>  cookie_v4_check+0x22b7/0x29e0 net/ipv4/syncookies.c:477
>  tcp_v4_cookie_check net/ipv4/tcp_ipv4.c:1855 [inline]
>  tcp_v4_do_rcv+0xb17/0x10b0 net/ipv4/tcp_ipv4.c:1914
>  tcp_v4_rcv+0x4ce4/0x5420 net/ipv4/tcp_ipv4.c:2322
>  ip_protocol_deliver_rcu+0x2a3/0x13d0 net/ipv4/ip_input.c:205
>  ip_local_deliver_finish+0x332/0x500 net/ipv4/ip_input.c:233
>  NF_HOOK include/linux/netfilter.h:314 [inline]
>  ip_local_deliver+0x21f/0x490 net/ipv4/ip_input.c:254
>  dst_input include/net/dst.h:460 [inline]
>  ip_rcv_finish+0x4a2/0x520 net/ipv4/ip_input.c:449
>  NF_HOOK include/linux/netfilter.h:314 [inline]
>  ip_rcv+0xcd/0x380 net/ipv4/ip_input.c:569
>  __netif_receive_skb_one_core net/core/dev.c:5538 [inline]
>  __
> Fixes: 695751e31a63 ("bpf: tcp: Handle BPF SYN Cookie in cookie_v[46]_check().")
> Reported-by: syzkaller <syzkaller@...glegroups.com>
> Reported-by: Eric Dumazet <edumazet@...gle.com>
> Closes: https://lore.kernel.org/bpf/CANn89iKdN9c+C_2JAUbc+VY3DDQjAQukMtiBbormAmAk9CdvQA@mail.gmail.com/
> Signed-off-by: Kuniyuki Iwashima <kuniyu@...zon.com>
> ---

Reviewed-by: Eric Dumazet <edumazet@...gle.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ