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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e09f6bc5-b5c4-5ab6-16c3-029b45810530@gmail.com>
Date:   Wed, 27 Jul 2022 11:22:38 +0300
From:   Leonard Crestez <cdleonard@...il.com>
To:     Eric Dumazet <edumazet@...gle.com>,
        David Ahern <dsahern@...nel.org>
Cc:     netdev@...r.kernel.org, eric.dumazet@...il.com,
        Brian Vazquez <brianvv@...gle.com>,
        Dmitry Safonov <dima@...sta.com>,
        Paolo Abeni <pabeni@...hat.com>,
        Jakub Kicinski <kuba@...nel.org>,
        "David S . Miller" <davem@...emloft.net>
Subject: Re: [PATCH net] tcp: md5: fix IPv4-mapped support



On 7/26/22 14:57, Eric Dumazet wrote:
> After the blamed commit, IPv4 SYN packets handled
> by a dual stack IPv6 socket are dropped, even if
> perfectly valid.
> 
> $ nstat | grep MD5
> TcpExtTCPMD5Failure             5                  0.0
> 
> For a dual stack listener, an incoming IPv4 SYN packet
> would call tcp_inbound_md5_hash() with @family == AF_INET,
> while tp->af_specific is pointing to tcp_sock_ipv6_specific.
> 
> Only later when an IPv4-mapped child is created, tp->af_specific
> is changed to tcp_sock_ipv6_mapped_specific.
> 
> Fixes: 7bbb765b7349 ("net/tcp: Merge TCP-MD5 inbound callbacks")
> Reported-by: Brian Vazquez <brianvv@...gle.com>
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> Cc: Dmitry Safonov <dima@...sta.com>
> Cc: David Ahern <dsahern@...nel.org>
> Cc: Leonard Crestez <cdleonard@...il.com>

I had a test in this area for AO and MD5 but it was incorrect (it did 
not actually use an ipv4-mapped-ipv6 address for the ipv6 socket, it 
used an ipv6 wildcard address).

After fixing the test I can confirm that this patch does in fact fix 
something.

https://github.com/cdleonard/tcp-authopt-test/commit/662a6a7e1a818f4581fc0055e821bc1b4c8d04e8

Tested-by: Leonard Crestez <cdleonard@...il.com>

> ---
>   net/ipv4/tcp.c | 15 ++++++++++++---
>   1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index 002a4a04efbe076ba603d7d42eb85e60d9bf4fb8..766881775abb795c884d048d51c361e805b91989 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -4459,9 +4459,18 @@ tcp_inbound_md5_hash(const struct sock *sk, const struct sk_buff *skb,
>   		return SKB_DROP_REASON_TCP_MD5UNEXPECTED;
>   	}
>   
> -	/* check the signature */
> -	genhash = tp->af_specific->calc_md5_hash(newhash, hash_expected,
> -						 NULL, skb);
> +	/* Check the signature.
> +	 * To support dual stack listeners, we need to handle
> +	 * IPv4-mapped case.
> +	 */
> +	if (family == AF_INET)
> +		genhash = tcp_v4_md5_hash_skb(newhash,
> +					      hash_expected,
> +					      NULL, skb);
> +	else
> +		genhash = tp->af_specific->calc_md5_hash(newhash,
> +							 hash_expected,
> +							 NULL, skb);
>   
>   	if (genhash || memcmp(hash_location, newhash, 16) != 0) {
>   		NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPMD5FAILURE);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ