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] [day] [month] [year] [list]
Date:   Thu, 6 Jan 2022 22:53:45 +0100
From:   Pablo Neira Ayuso <pablo@...filter.org>
To:     zhang kai <zhangkaiheb@....com>
Cc:     kadlec@...filter.org, fw@...len.de, davem@...emloft.net,
        kuba@...nel.org, netfilter-devel@...r.kernel.org,
        coreteam@...filter.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] netfilter: seqadj: check seq offset before update

On Fri, Dec 24, 2021 at 10:37:13AM +0800, zhang kai wrote:
> if seq/ack offset is zero, don't update

Please, provide more details: explain the scenario that triggers and
seq/ack offset adjustment of zero, describe the scenario that triggers
the bug, etc.

> Signed-off-by: zhang kai <zhangkaiheb@....com>
> ---
>  net/netfilter/nf_conntrack_seqadj.c | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/net/netfilter/nf_conntrack_seqadj.c b/net/netfilter/nf_conntrack_seqadj.c
> index 3066449f8bd8..d35e272a2e36 100644
> --- a/net/netfilter/nf_conntrack_seqadj.c
> +++ b/net/netfilter/nf_conntrack_seqadj.c
> @@ -186,11 +186,13 @@ int nf_ct_seq_adjust(struct sk_buff *skb,
>  	else
>  		seqoff = this_way->offset_before;
>  
> -	newseq = htonl(ntohl(tcph->seq) + seqoff);
> -	inet_proto_csum_replace4(&tcph->check, skb, tcph->seq, newseq, false);
> -	pr_debug("Adjusting sequence number from %u->%u\n",
> -		 ntohl(tcph->seq), ntohl(newseq));
> -	tcph->seq = newseq;
> +	if (seqoff) {
> +		newseq = htonl(ntohl(tcph->seq) + seqoff);
> +		inet_proto_csum_replace4(&tcph->check, skb, tcph->seq, newseq, false);
> +		pr_debug("Adjusting sequence number from %u->%u\n",
> +			 ntohl(tcph->seq), ntohl(newseq));
> +		tcph->seq = newseq;
> +	}
>  
>  	if (!tcph->ack)
>  		goto out;
> @@ -201,6 +203,9 @@ int nf_ct_seq_adjust(struct sk_buff *skb,
>  	else
>  		ackoff = other_way->offset_before;
>  
> +	if (!ackoff)
> +		goto out;
> +
>  	newack = htonl(ntohl(tcph->ack_seq) - ackoff);
>  	inet_proto_csum_replace4(&tcph->check, skb, tcph->ack_seq, newack,
>  				 false);
> -- 
> 2.17.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ