From: Wei Gao via ltp <ltp@lists.linux.it>
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] cve: add CVE-2025-38236 test
Date: Tue, 12 Aug 2025 09:43:29 +0000 [thread overview]
Message-ID: <aJsMwaWb2kIQKEtF@localhost> (raw)
In-Reply-To: <20250812-cve_2025_38236-v1-1-e3617ada69c6@suse.com>
On Tue, Aug 12, 2025 at 10:45:59AM +0200, Andrea Cervesato wrote:
> From: Andrea Cervesato <andrea.cervesato@suse.com>
>
> Test for CVE-2025-38236 fixed in kernel v6.16-rc4:
> af_unix: Don't leave consecutive consumed OOB skbs.
>
> The bug is triggered by sending multiple out-of-band data to a socket and
> reading it back from it. According to the MSG_OOB implementation, this
> shouldn't be possible. When system is affected by CVE-2025-38236, instead,
> skb queue holds MSG_OOB data, breaking recv() and causing a use-after-free
> condition.
>
> Even if MSG_OOB is mostly used inside Oracle's product, it is enabled by
> default in linux kernel via CONFIG_AF_UNIX_OOB. This is accessible via
> Chrome's renderer sandbox, which might cause an attacker to escalate and to
> obtain privileges in the system.
>
> Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
> ---
> testcases/cve/.gitignore | 1 +
> testcases/cve/cve-2025-38236.c | 101 +++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 102 insertions(+)
>
> diff --git a/testcases/cve/.gitignore b/testcases/cve/.gitignore
> index 3a2b2bed619c99a592f51afe50b7196c593f1f45..8eb17ce56b01070e47917f9bb44cf146c0c5b338 100644
> --- a/testcases/cve/.gitignore
> +++ b/testcases/cve/.gitignore
> @@ -13,3 +13,4 @@ cve-2017-17053
> cve-2022-4378
> icmp_rate_limit01
> tcindex01
> +cve-2025-38236
> diff --git a/testcases/cve/cve-2025-38236.c b/testcases/cve/cve-2025-38236.c
> new file mode 100644
> index 0000000000000000000000000000000000000000..68cb3d3ee2b624df2a6de2ce07da1d1e3efc8bb8
> --- /dev/null
> +++ b/testcases/cve/cve-2025-38236.c
> @@ -0,0 +1,101 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (C) 2025 SUSE LLC Andrea Cervesato <andrea.cervesato@suse.com>
> + */
> +
> +/*\
> + * Test for CVE-2025-38236 fixed in kernel v6.16-rc4:
> + * af_unix: Don't leave consecutive consumed OOB skbs.
> + *
> + * The bug is triggered by sending multiple out-of-band data to a socket and
> + * reading it back from it. According to the MSG_OOB implementation, this
> + * shouldn't be possible. When system is affected by CVE-2025-38236, instead,
> + * skb queue holds MSG_OOB data, breaking recv() and causing a use-after-free
> + * condition.
> + *
> + * Even if MSG_OOB is mostly used inside Oracle's product, it is enabled by
> + * default in linux kernel via CONFIG_AF_UNIX_OOB. This is accessible via
> + * Chrome's renderer sandbox, which might cause an attacker to escalate and to
> + * obtain privileges in the system.
> + */
> +
> +#include "tst_test.h"
> +
> +static const struct timeval sock_timeout = {
> + .tv_sec = 1,
> +};
> +
> +static char dummy;
> +static int sock[2];
> +
> +static void run(void)
> +{
> + int ret;
> +
> + dummy = '\0';
> +
> + tst_res(TINFO, "#1 send and receive out-of-band data");
> + SAFE_SEND(0, sock[1], "A", 1, MSG_OOB);
> + SAFE_RECV(0, sock[0], &dummy, 1, MSG_OOB);
> +
> + tst_res(TINFO, "#2 send and receive out-of-band data");
> + SAFE_SEND(0, sock[1], "A", 1, MSG_OOB);
> + SAFE_RECV(0, sock[0], &dummy, 1, MSG_OOB);
> +
> + tst_res(TINFO, "Send out-of-band data");
> + SAFE_SEND(0, sock[1], "A", 1, MSG_OOB);
Thanks for your patch. I have some minor comments:
1) I suggest check dummy value after each SAFE_RECV above also
2) Better send different char for different sent such as A,B,C
3) Is the second send operation necessary?
> +
> + tst_res(TINFO, "Receive data from normal stream");
> +
> + ret = recv(sock[0], &dummy, 1, 0);
> + if (ret == -1) {
> + if (errno == EWOULDBLOCK)
> + tst_res(TPASS, "Can't read out-of-band data from normal stream");
> + else
> + tst_brk(TBROK | TERRNO, "recv error");
> + } else {
> + const char *msg = "We are able to read out-of-band data from normal stream";
> +
> + if (dummy == 'A') {
> + tst_res(TFAIL, "%s", msg);
> + } else {
> + tst_res(TFAIL, "%s, but data doesn't match: '%c' != 'A'",
> + msg, dummy);
> + }
> +
> + SAFE_RECV(0, sock[0], &dummy, 1, MSG_OOB);
4) I think we need check dummy == 'A' here and then report TFAIL with
use-after-free
> +
> + tst_res(TFAIL, "We are able to access data from skb queue (use-after-free)");
> + }
> +}
> +
> +static void setup(void)
> +{
> + SAFE_SOCKETPAIR(AF_UNIX, SOCK_STREAM, 0, sock);
> + SAFE_SETSOCKOPT(sock[0], SOL_SOCKET, SO_RCVTIMEO,
> + &sock_timeout, sizeof(struct timeval));
> +}
> +
> +static void cleanup(void)
> +{
> + if (sock[0] != -1)
> + SAFE_CLOSE(sock[0]);
> +
> + if (sock[1] != -1)
> + SAFE_CLOSE(sock[1]);
> +}
> +
> +static struct tst_test test = {
> + .test_all = run,
> + .setup = setup,
> + .cleanup = cleanup,
> + .needs_kconfigs = (const char *[]) {
> + "CONFIG_AF_UNIX_OOB=y",
> + NULL
> + },
> + .tags = (const struct tst_tag[]) {
> + {"linux-git", "32ca245464e1"},
> + {"CVE", "2025-38236"},
> + {}
> + }
> +};
>
> ---
> base-commit: e2c58cfcb82be0b376098a67c8f45264282be67a
> change-id: 20250812-cve_2025_38236-7cb0cd4fdbf5
>
> Best regards,
> --
> Andrea Cervesato <andrea.cervesato@suse.com>
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2025-08-12 9:43 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-12 8:45 [LTP] [PATCH] cve: add CVE-2025-38236 test Andrea Cervesato
2025-08-12 9:43 ` Wei Gao via ltp [this message]
2025-08-12 10:57 ` Andrea Cervesato via ltp
2025-08-12 11:09 ` Petr Vorel
2025-08-12 10:12 ` Petr Vorel
2025-08-12 11:09 ` Cyril Hrubis
2025-08-12 11:45 ` [LTP] [doc, runtest] [was: Re: [PATCH] cve: add CVE-2025-38236 test] Petr Vorel
2025-08-12 12:09 ` Cyril Hrubis
2025-08-18 6:08 ` Petr Vorel
2025-08-12 10:51 ` [LTP] [PATCH] cve: add CVE-2025-38236 test Petr Vorel
2025-08-12 10:55 ` Andrea Cervesato via ltp
2025-08-12 11:14 ` Cyril Hrubis
2025-08-12 11:17 ` Andrea Cervesato via ltp
2025-08-12 11:50 ` Petr Vorel
2025-08-12 11:25 ` Petr Vorel
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=aJsMwaWb2kIQKEtF@localhost \
--to=ltp@lists.linux.it \
--cc=andrea.cervesato@suse.de \
--cc=wegao@suse.com \
/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.