Skip to contentSkip to conversation

Add reproducer for sctphantom CVE

PATCH Applied Andrea Cervesato 4 participants 9 messages Aug 10 – Aug 18

lore
Share & tools
lore
#0 lore raw

cover Add reproducer for sctphantom CVE

This reproducer has been created using Kimi K3 and tweaked by human to match LTP standards. The link which has been used to generate the test is the following:

https://matrix.tencent.com/en/2026/08/06/sctphantom-CVE-2026-64564

---
Andrea Cervesato (2):
sctp: add lapi fallback definitions cve/sctphantom: Add reproducer for CVE-2026-64564

 include/lapi/sctp.h        |  65 +++++
 runtest/cve                |   1 +
 testcases/cve/.gitignore   |   1 +
 testcases/cve/sctphantom.c | 594 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 661 insertions(+)

---
base-commit: 13c2bbab1d71384c10c368c2c2b6e5747eeb5018
change-id: 20260810-sctphantom-d5aa24983fe7

Best regards,

Signature · 5 lines
Andrea Cervesato <[email protected]>


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

PATCH 1/2 sctp: add lapi fallback definitions

From: Andrea Cervesato <[email protected]>

---
 include/lapi/sctp.h | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)
include/lapi/sctp.h +65 -0
index c4c1cc91f..67c4d9e09 100644
@@ -14,4 +14,69 @@
 # define SCTP_SOCKOPT_BINDX_ADD	100
 #endif
 
+#ifndef IPPROTO_SCTP
+# define IPPROTO_SCTP	132
+#endif
+
+#ifndef SCTP_PEER_ADDR_PARAMS
+# define SCTP_PEER_ADDR_PARAMS	9
+#endif
+
+#ifndef SCTP_STATUS
+# define SCTP_STATUS	14
+#endif
+
+#ifndef SCTP_GET_PEER_ADDR_INFO
+# define SCTP_GET_PEER_ADDR_INFO	15
+#endif
+
+#ifndef SPP_HB_ENABLE
+# define SPP_HB_ENABLE	(1 << 0)
+#endif
+
+#ifndef SPP_HB_DISABLE
+# define SPP_HB_DISABLE	(1 << 1)
+#endif
+
+#ifndef SPP_HB_DEMAND
+# define SPP_HB_DEMAND	(1 << 2)
+#endif
+
+#ifndef SCTP_ACTIVE
+# define SCTP_ACTIVE	2
+#endif
+
+/* SCTP wire format values, see include/linux/sctp.h in the kernel */
+#ifndef SCTP_CID_INIT
+# define SCTP_CID_INIT		1
+#endif
+
+#ifndef SCTP_CID_INIT_ACK
+# define SCTP_CID_INIT_ACK	2
+#endif
+
+#ifndef SCTP_CID_ASCONF_ACK
+# define SCTP_CID_ASCONF_ACK	0x80
+#endif
+
+#ifndef SCTP_CID_ASCONF
+# define SCTP_CID_ASCONF		0xc1
+#endif
+
+#ifndef SCTP_PARAM_IPV4_ADDRESS
+# define SCTP_PARAM_IPV4_ADDRESS	5
+#endif
+
+#ifndef SCTP_PARAM_DEL_IP
+# define SCTP_PARAM_DEL_IP	0xc002
+#endif
+
+#ifndef SCTP_PARAM_ERR_CAUSE
+# define SCTP_PARAM_ERR_CAUSE	0xc003
+#endif
+
+#ifndef SCTP_ERROR_REQ_REFUSED
+# define SCTP_ERROR_REQ_REFUSED	0x00a4
+#endif
+
 #endif	/* LAPI_SCTP_H__ */
Signature · 5 lines
2.51.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw

Re: [LTP] sctp: add lapi fallback definitions

Hi Andrea,

Quoted 1 line · Andrea Cervesato

sctp: add lapi fallback definitions

Verdict - Reviewed

---
Note:

The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v1 1/2
#3 lore raw

Re: [LTP] [PATCH 1/2] sctp: add lapi fallback definitions

In reply to Andrea Cervesato

Hi: Andrea,

Quoted 1 line

+/* SCTP wire format values, see include/linux/sctp.h in the kernel */

+1 for that comment.

Quoted 16 lines
include/lapi/sctp.h +16 -0
+#ifndef SCTP_CID_INIT
+# define SCTP_CID_INIT		1
+#endif
+
+#ifndef SCTP_CID_INIT_ACK
+# define SCTP_CID_INIT_ACK	2
+#endif
+
+#ifndef SCTP_CID_ASCONF_ACK
+# define SCTP_CID_ASCONF_ACK	0x80
+#endif
+
+#ifndef SCTP_CID_ASCONF
+# define SCTP_CID_ASCONF		0xc1
+#endif
+

include/lapi/sctp.h line 75

Quoted 10 lines
include/lapi/sctp.h +10 -0
+#ifndef SCTP_PARAM_IPV4_ADDRESS
+# define SCTP_PARAM_IPV4_ADDRESS	5
+#endif
+
+#ifndef SCTP_PARAM_DEL_IP
+# define SCTP_PARAM_DEL_IP	0xc002
+#endif
+
+#ifndef SCTP_PARAM_ERR_CAUSE
+# define SCTP_PARAM_ERR_CAUSE	0xc003

I hope cpu_to_be16(0xc003) is really on all supported archs 0xc003 :).

Anyway, the rest LGTM.

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#4 lore raw

PATCH 2/2 cve/sctphantom: Add reproducer for CVE-2026-64564

In reply to Andrea Cervesato

From: Andrea Cervesato <[email protected]>

Add a reproducer for CVE-2026-64564, a use-after-free in the SCTP Dynamic Address Reconfiguration (RFC 5061) DEL-IP processing.

This vulnerability was fixed upstream by commit 9b2854f86f0b ("sctp:
don't free the ASCONF's own transport in DEL-IP processing").

---
 runtest/cve                |   1 +
 testcases/cve/.gitignore   |   1 +
 testcases/cve/sctphantom.c | 594 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 596 insertions(+)
runtest/cve +1 -0
index 426b203e9..b096bacef 100644
@@ -102,3 +102,4 @@ cve-2026-43494 io_uring04
 cve-2026-46300 xfrm02
 cve-2026-46300-skb-segment xfrm03
 cve-2026-46331 cve-2026-46331
+cve-2026-64564 sctphantom
testcases/cve/.gitignore +1 -0
index 5aa038cd5..a167a8743 100644
@@ -17,3 +17,4 @@ cve-2025-38236
 cve-2025-21756
 cve-2026-46331
 refluxfs
+sctphantom
testcases/cve/sctphantom.c new file +594 -0

594 lines not on this page · raw message

Signature · 5 lines
2.51.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Acked-by Tested-by on v1 2/2
#5 lore raw

Re: [LTP] [PATCH 2/2] cve/sctphantom: Add reproducer for CVE-2026-64564

Hi Andrea,

Quoted 8 lines

Add a reproducer for CVE-2026-64564, a use-after-free in the SCTP Dynamic Address Reconfiguration (RFC 5061) DEL-IP processing.

This vulnerability was fixed upstream by commit 9b2854f86f0b ("sctp:
don't free the ASCONF's own transport in DEL-IP processing").

Nice reproducer, full of magic. Generally LGTM, few notes bellow?

testcases/cve/sctphantom.c line 203

Quoted 8 lines
testcases/cve/sctphantom.c new file +8 -0
+static void setup(void)
+{
+	int fd;
+	const struct tst_path_val sysctls[] = {
+		{"/proc/sys/net/sctp/addip_enable", "1", TST_SR_TCONF},
+		{"/proc/sys/net/sctp/addip_noauth_enable", "1", TST_SR_TCONF},
+		{}
+	};

Can't this be part of .save_restore in struct tst_test?

Quoted 3 lines
testcases/cve/sctphantom.c new file +3 -0
+	const struct tst_path_val *sysctl;
+
+	tst_modprobe("sctp", NULL);

...

Quoted 8 lines
testcases/cve/sctphantom.c new file +8 -0
+
+/*
+ * The freed transport is released by an RCU callback; once it is gone,
+ * reading the association status dereferences the stale primary_path,
+ * which KASAN reports as a use-after-free.
+ */
+static void probe_uaf(void)
+{

testcases/cve/sctphantom.c line 538

Quoted 10 lines
testcases/cve/sctphantom.c new file +10 -0
+	uint8_t buf[512];
+	long delay = 1;
+	int i;
+
+	tst_res(TINFO, "probing the stale primary path via SCTP_STATUS");
+
+	for (i = 0; i < 12; i++) {
+		socklen_t len = sizeof(buf);
+
+		TEST(getsockopt(cli_fd, SOL_SCTP, SCTP_STATUS, buf, &len));

What is the point of using TEST() macro here. Why not run getsockopt() directly?

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#6 lore raw

Re: [LTP] [PATCH 2/2] cve/sctphantom: Add reproducer for CVE-2026-64564

Hi Petr,

Quoted 4 lines

Nice reproducer, full of magic. Generally LGTM, few notes bellow?

Quoted 9 lines

testcases/cve/sctphantom.c line 203

Quoted 8 lines
testcases/cve/sctphantom.c new file +8 -0
+static void setup(void)
+{
+	int fd;
+	const struct tst_path_val sysctls[] = {
+		{"/proc/sys/net/sctp/addip_enable", "1", TST_SR_TCONF},
+		{"/proc/sys/net/sctp/addip_noauth_enable", "1", TST_SR_TCONF},
+		{}
+	};

Can't this be part of .save_restore in struct tst_test?

I had to move it inside setup/cleanup because we need to load sctp module _before_ setting the addip_enable, which is available only after loading the module.

Quoted 17 lines
Quoted 4 lines
testcases/cve/sctphantom.c new file +3 -0
+	const struct tst_path_val *sysctl;
+
+	tst_modprobe("sctp", NULL);

...

Quoted 11 lines
testcases/cve/sctphantom.c new file +11 -0
+
+/*
+ * The freed transport is released by an RCU callback; once it is gone,
+ * reading the association status dereferences the stale primary_path,
+ * which KASAN reports as a use-after-free.
+ */
+static void probe_uaf(void)
+{
+	uint8_t buf[512];
+	long delay = 1;
+	int i;
Quoted 8 lines

testcases/cve/sctphantom.c line 538

Quoted 7 lines
testcases/cve/sctphantom.c new file +7 -0
+
+	tst_res(TINFO, "probing the stale primary path via SCTP_STATUS");
+
+	for (i = 0; i < 12; i++) {
+		socklen_t len = sizeof(buf);
+
+		TEST(getsockopt(cli_fd, SOL_SCTP, SCTP_STATUS, buf, &len));

What is the point of using TEST() macro here. Why not run getsockopt() directly?

Yeah I also removed it, but then messed up with undo history :-) I will remove it again.

Regards,
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#7 lore raw

Re: [LTP] [PATCH 2/2] cve/sctphantom: Add reproducer for CVE-2026-64564

Quoted 16 lines

Hi Petr,

Quoted 4 lines

Nice reproducer, full of magic. Generally LGTM, few notes bellow?

Quoted 9 lines

testcases/cve/sctphantom.c line 203

Quoted 8 lines
testcases/cve/sctphantom.c new file +8 -0
+static void setup(void)
+{
+	int fd;
+	const struct tst_path_val sysctls[] = {
+		{"/proc/sys/net/sctp/addip_enable", "1", TST_SR_TCONF},
+		{"/proc/sys/net/sctp/addip_noauth_enable", "1", TST_SR_TCONF},
+		{}
+	};

Can't this be part of .save_restore in struct tst_test?

Quoted 3 lines

I had to move it inside setup/cleanup because we need to load sctp module _before_ setting the addip_enable, which is available only after loading the module.

Thanks for info!

Quoted 25 lines
Quoted 16 lines
Quoted 3 lines
testcases/cve/sctphantom.c new file +3 -0
+	const struct tst_path_val *sysctl;
+
+	tst_modprobe("sctp", NULL);

...

Quoted 11 lines
testcases/cve/sctphantom.c new file +11 -0
+
+/*
+ * The freed transport is released by an RCU callback; once it is gone,
+ * reading the association status dereferences the stale primary_path,
+ * which KASAN reports as a use-after-free.
+ */
+static void probe_uaf(void)
+{
+	uint8_t buf[512];
+	long delay = 1;
+	int i;
Quoted 8 lines

testcases/cve/sctphantom.c line 538

Quoted 7 lines
testcases/cve/sctphantom.c new file +7 -0
+
+	tst_res(TINFO, "probing the stale primary path via SCTP_STATUS");
+
+	for (i = 0; i < 12; i++) {
+		socklen_t len = sizeof(buf);
+
+		TEST(getsockopt(cli_fd, SOL_SCTP, SCTP_STATUS, buf, &len));

What is the point of using TEST() macro here. Why not run getsockopt() directly?

Quoted 2 lines

Yeah I also removed it, but then messed up with undo history :-) I will remove it again.

Good, it can be removed before merge.

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#8 lore raw

Re: [LTP] [PATCH 2/2] cve/sctphantom: Add reproducer for CVE-2026-64564

Quoted 1 line

Good, it can be removed before merge.

Merged, Thanks!

Removed TEST() as suggested.

--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp