From: Jakub Kicinski <kuba@kernel.org>
To: Savy <savy@syst3mfailure.io>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"will@willsroot.io" <will@willsroot.io>,
"borisp@nvidia.com" <borisp@nvidia.com>,
"john.fastabend@gmail.com" <john.fastabend@gmail.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"edumazet@google.com" <edumazet@google.com>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"horms@kernel.org" <horms@kernel.org>
Subject: Re: [BUG] net/tls: UAF and BUG_ON via tcp_recvmsg/tcp_zerocopy_receive
Date: Wed, 6 Aug 2025 10:47:46 -0700 [thread overview]
Message-ID: <20250806104746.0937caae@kernel.org> (raw)
In-Reply-To: <tFjq_kf7sWIG3A7CrCg_egb8CVsT_gsmHAK0_wxDPJXfIzxFAMxqmLwp3MlU5EHiet0AwwJldaaFdgyHpeIUCS-3m3llsmRzp9xIOBR4lAI=@syst3mfailure.io>
On Tue, 05 Aug 2025 16:30:37 +0000 Savy wrote:
> This UAF read can probably be transformed into a privilege escalation,
> as the UAF read can be turned into a UAF write if the anchor undergoes the clone path.
> However, the conditions for that is pretty restrictive,
> and may require features such as TLS hardware offload for us to hit such paths.
>
> For the getsockopt(TCP_ZEROCOPY_RECEIVE) version of the bug,
> we suggest the following check to fix the issue, as the SOCK_SUPPORT_ZC bit
> is already cleared in __tcp_set_ulp() [2]:
>
> static int tcp_zerocopy_receive(struct sock *sk,
> struct tcp_zerocopy_receive *zc,
> struct scm_timestamping_internal *tss)
> {
> // [...]
>
> + /* ZC support has been cleared by ULP */
> + if (!test_bit(SOCK_SUPPORT_ZC, &sk->sk_socket->flags))
> + return -EOPNOTSUPP;
>
> // [...]
> }
>
> For the tcp_recvmsg() version, we could check if there are any processes
> waiting for data on the socket before installing the ULP.
Thanks for the high quality bug report! I think that we're better off
checking if the copied_seq moved since we looked at the queue.
It should cover all cases at once. I'll share the proposed fix soon.
prev parent reply other threads:[~2025-08-06 17:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-05 16:30 [BUG] net/tls: UAF and BUG_ON via tcp_recvmsg/tcp_zerocopy_receive Savy
2025-08-06 17:47 ` Jakub Kicinski [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250806104746.0937caae@kernel.org \
--to=kuba@kernel.org \
--cc=borisp@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=savy@syst3mfailure.io \
--cc=will@willsroot.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.