Thread View: linux.kernel.netdev
3 messages
3 total messages
Started by Xin Long
Sat, 24 Oct 2026 21:46
Re: [BUG] SCTP: KASAN use-after-free in sctp_unpack_cookie with fail_skb_realloc (7.3.0)
Author: Xin Long
Date: Sat, 24 Oct 2026 21:46
Date: Sat, 24 Oct 2026 21:46
522 lines
33143 bytes
33143 bytes
On Sat, Oct 24, 2026 at 10:07 AM 铮 <fengaojigui88@gmail.com> wrote:
>
> Hi Marcelo and Xin,
>
> I observed a KASAN slab-use-after-free in sctp_unpack_cookie() while fuzzing
> SCTP with syzkaller. I reproduced it on Linux 7.1.3 and on Linux 7.3.0. On
> 7.3.0, the crash was observed during replay of a 42-program execution sequence;
> the standalone three-call reproducer did not trigger in two attempts.
>
> The issue occurs while processing a COOKIE-ECHO through
> sctp_sf_do_5_2_4_dupcook(). With the upstream skb fault-injection option
> CONFIG_FAIL_SKB_REALLOC enabled and fail_nth: 43 on sendto(), the pskb_pull()
> inside sctp_sf_do_5_2_4_dupcook() triggers pskb_expand_head() (through
> skb_might_realloc()), which frees the old skb head buffer;
> sctp_unpack_cookie() then reads (size 2) from the freed buffer.
>
> Environment
> -----------
> - Kernel A (found and reproduced): 7.1.3-kernsight-kasan #13 SMP PREEMPT_DYNAMIC,
> built 2026-10-13, x86_64. Built with KASAN/KCOV and
> CONFIG_FAIL_SKB_REALLOC=y. No SCTP changes were made for this testing.
> - Kernel B (reproduced 2026-10-24): 7.3.0-kernsight-kasan #1 SMP
> PREEMPT_DYNAMIC, built 2026-10-20, x86_64. Vanilla 7.3.0 source tarball
> (sha256 87363c24f10e06321eb362765521094e94471f6bff8bce2d6b3e40f39f004953),
> built with KASAN/KCOV and CONFIG_FAIL_SKB_REALLOC=y. No SCTP source changes
> (net/sctp/ matches vanilla apart from build artifacts).
> - Both kernels: CONFIG_KASAN=y, CONFIG_KCOV=y, CONFIG_FAULT_INJECTION=y,
> CONFIG_FAIL_SKB_REALLOC=y. CONFIG_FAIL_SKB_REALLOC and
> net/core/skb_fault_injection.c are upstream (present in the vanilla 7.3.0
> tarball).
> - Guest: QEMU 6.2.0, 4 vCPU, 6 GiB, KVM, x86_64. A fresh VM was booted for
> every run.
> - Syzkaller: revision 853b104bb454141a5b0fc0e4218ec78e9f34ffb1+ (2026-09-18).
> The "+" denotes local KernSight integration changes (seed ordering/state
> feedback: pkg/kernsight, prog/kernsight_*, syz-manager/kernsight_*,
> pkg/execbackend, snapshot support in vm/qemu). They do not change the SCTP
> syscall descriptions or the executor's fault-injection semantics.
> - Kernel modifications / additional modules: none relevant to this report
> beyond the KASAN/KCOV/fault-injection build options above.
> - Reproduction rate: 7.1.3: verified syz and C reproducer. 7.3.0: 1/1 with the
> stored 42-program sequence; the standalone three-call program did not
> reproduce in 2 attempts. (1/1 does not establish stability.)
> - Kernel command line (7.1.3; 7.3.0 is identical, see repository):
> root=/dev/sda console=ttyS0 fstab=no rw earlyprintk=serial net.ifnames=0 oops=panic panic_on_warn=1 panic=86400 hung_task_panic=1 softlockup_panic=1 nmi_watchdog=panic sysctl.kernel.hung_task_all_cpu_backtrace=1 sysctl.kernel.panic_on_rcu_stall=1 sysctl.kernel.max_rcu_stall_to_panic=1 rcupdate.rcu_expedited=1 rcupdate.rcu_cpu_stall_cputime=1 no_hash_pointers page_owner=on sysctl.vm.nr_hugepages=4 sysctl.vm.nr_overcommit_hugepages=4 secretmem.enable=1 msr.allow_writes=off coredump_filter=0xffff vsyscall=native kvm-intel.nested=1 spec_store_bypass_disable=prctl nopcid vivid.n_devs=64 vivid.multiplanar=1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2 netrom.nr_ndevs=32 rose.rose_ndevs=32 smp.csd_lock_timeout=100000 watchdog_thresh=55 workqueue.watchdog_thresh=140 sysctl.net.core.netdev_unregister_timeout_secs=140 dummy_hcd.num=16 max_loop=32 nbd.nbds_max=32 comedi.comedi_num_legacy_minors=4 kunit.autorun=0 vcan.echo=1
>
> Reproduction on 7.1.3
> ---------------------
> Fresh KVM guest, kernel as above. Run from the guest's /tmp:
>
> scp syz-execprog syz-executor repro.prog root@guest:/tmp/
> ssh root@guest
> cd /tmp && chmod +x syz-execprog syz-executor
> ./syz-execprog -procs=1 -repeat=1 -disable=swap -executor ./syz-executor ./repro.prog
>
> Execution settings: sandbox=none, threaded executor, procs=1, repeat=1, no
> additional syzkaller features; a single program.
>
> The minimised program (repro.prog) is:
>
> r0 = socket$inet6_sctp(0xa, 0x5, 0x84)
> setsockopt$inet6_sctp_SCTP_SOCKOPT_BINDX_ADD(r0, 0x84, 0x64, &(0x7f0000000080)=[@in6={0xa, 0x4e21, 0x5, @loopback, 0x9}], 0x1c)
> sendto$inet6(r0, &(0x7f0000000000)='M', 0x1, 0x20004845, &(0x7f0000000040)={0xa, 0x4e21, 0xffffff00, @loopback, 0x2}, 0x1c) (fail_nth: 43)
>
> The C reproducer also works on 7.1.3:
>
> gcc -x c -O2 -pthread -o repro repro.cprog && ./repro
>
> Its console shows the same report:
> BUG: KASAN: slab-use-after-free in sctp_unpack_cookie+0xa56/0xdc0
>
> Reproduction on 7.3.0
> ---------------------
> Same procedure with the 7.3.0 kernel and the state-construction sequence
> instead of the single program:
>
> scp syz-execprog syz-executor repro.kernsight.prog root@guest:/tmp/
> ssh root@guest
> cd /tmp && chmod +x syz-execprog syz-executor
> ./syz-execprog -procs=1 -repeat=1 -disable=swap -executor ./syz-executor ./repro.kernsight.prog
>
> The sequence contains 42 programs replayed by a single executor process
> (procs=1) one at a time in file order (repeat=1, sandbox=none, threaded
> executor). The executor does not run programs in parallel, but a program can
> leave kernel-side asynchronous work behind (timers, workqueues, networking),
> so earlier programs' effects may still be active while later ones run. The
> SCTP trigger is program #40 and appears again inside the final program #41.
>
> Materials (programs, full logs, reports, kernel configs, command lines,
> sha256 manifest, and a verify.sh that re-checks the numbers quoted here):
> https://github.com/Zheng-zheng-codes/sctp-unpack-cookie-repro
>
> For reference, in our runs the sequence log contains exactly one KASAN report,
> first printed at t=212.7 s; the two standalone 7.3.0 runs contain zero.
>
> The standalone three-call program did not trigger in two runs on a fresh 7.3.0
> guest. The preceding execution sequence may affect reproducibility, but I have
> not isolated which preceding operations or environmental conditions matter.
>
> Fault injection was enabled for this reproduction
> -------------------------------------------------
> The sendto() call is annotated with fail_nth: 43. During this execution, the
> kernel logged a fail_skb_realloc injection, followed by the KASAN report:
>
> FAULT_INJECTION: forcing a failure.
> name fail_skb_realloc, interval 1, probability 0, space 0, times 1
>
> No additional fail_skb_realloc debugfs configuration was required.
>
> KASAN report (7.3.0, latest verification)
> -----------------------------------------
> BUG: KASAN: slab-use-after-free in sctp_unpack_cookie+0xb57/0xf30
> Read of size 2 at addr ff1100017d7658e6 by task syz.0.57/11114
>
> CPU: 3 UID: 0 PID: 11114 Comm: syz.0.57 Not tainted 7.3.0-kernsight-kasan #1 PREEMPT(full)
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
> Call Trace:
> <TASK>
> dump_stack_lvl+0x116/0x1b0
> print_report+0xf1/0x5c0
> ? __virt_addr_valid+0x23d/0x430
> ? sctp_unpack_cookie+0xb57/0xf30
> kasan_report+0x96/0xd0
> ? sctp_unpack_cookie+0xb57/0xf30
> sctp_unpack_cookie+0xb57/0xf30
> ? pskb_expand_head+0x591/0x10b0
> ? __pfx_sctp_unpack_cookie+0x10/0x10
> ? __pfx_pskb_expand_head+0x10/0x10
> ? dump_stack_lvl+0x15f/0x1b0
> ? should_fail_ex+0x35d/0x650
> sctp_sf_do_5_2_4_dupcook+0x2e2/0x3320
> ? __pfx_sctp_sf_do_5_2_4_dupcook+0x10/0x10
> ? sctp_sm_lookup_event+0x183/0x580
> ? kasan_save_track+0x14/0x30
> ? __kasan_slab_free+0x43/0x70
> ? kmem_cache_free+0x292/0x6a0
> ? sctp_chunk_put+0x20b/0x2c0
> ? sctp_inq_pop+0x691/0x10f0
> ? sctp_assoc_bh_rcv+0x113/0x700
> ? sctp_inq_push+0x262/0x310
> ? __pfx_sctp_cname+0x10/0x10
> sctp_do_sm+0x177/0x55a0
> ? rcu_is_watching+0x13/0xc0
> ? preempt_count_sub+0xfc/0x1a0
> ? __pfx_sctp_do_sm+0x10/0x10
> ? debug_check_no_obj_freed+0x293/0x520
> ? __lock_acquire+0x509/0x2110
> ? lockdep_hardirqs_on+0x7d/0x110
> ? kvm_clock_get_cycles+0x41/0x70
> sctp_assoc_bh_rcv+0x38f/0x700
> sctp_inq_push+0x262/0x310
> sctp_backlog_rcv+0x16c/0x5a0
> ? __pfx_sctp_backlog_rcv+0x10/0x10
> ? __pfx_sctp_backlog_rcv+0x10/0x10
> __release_sock+0x3a0/0x440
> release_sock+0x1ea/0x280
> sctp_sendmsg+0x8e4/0x1dd0
> ? __pfx_sctp_sendmsg+0x10/0x10
> ? aa_sock_msg_perm+0x127/0x200
> ? __pfx_sctp_sendmsg+0x10/0x10
> ? __pfx_inet_sendmsg+0x10/0x10
> inet_sendmsg+0x126/0x150
> __sys_sendto+0x474/0x520
> ? __pfx___sys_sendto+0x10/0x10
> ? fput+0x7d/0xe0
> ? fput+0x7d/0xe0
> ? fput+0x7d/0xe0
> ? trace_preempt_on+0x122/0x170
> ? fput+0x7d/0xe0
> ? preempt_count_sub+0xfc/0x1a0
> ? fput+0xa2/0xe0
> ? ksys_write+0x1a8/0x240
> ? __pfx_ksys_write+0x10/0x10
> __x64_sys_sendto+0xe5/0x1c0
> ? lockdep_hardirqs_on+0x7d/0x110
> do_syscall_64+0x12e/0x7a0
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
> RIP: 0033:0x7f166adb2b7d
> Code: 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
> RSP: 002b:00007f166bd5cf98 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
> RAX: ffffffffffffffda RBX: 00007f166b045fa0 RCX: 00007f166adb2b7d
> RDX: 0000000000000001 RSI: 0000200000000000 RDI: 0000000000000003
> RBP: 00007f166bd5d010 R08: 0000200000000040 R09: 000000000000001c
> R10: 0000000020004845 R11: 0000000000000246 R12: 0000000000000002
> R13: 00007f166b046038 R14: 00007f166b045fa0 R15: 00007f166bd3d000
> </TASK>
>
> Allocated by task 11114:
> kasan_save_stack+0x24/0x50
> kasan_save_track+0x14/0x30
> __kasan_kmalloc+0x7f/0x90
> __kmalloc_node_track_caller_noprof+0x339/0x800
> kmalloc_reserve+0xeb/0x350
> __alloc_skb+0x197/0x740
> sctp_packet_transmit+0x1eb/0x3210
> sctp_outq_flush_transports+0x39d/0x7e0
> sctp_outq_uncork+0x18d/0x200
> sctp_do_sm+0x23d4/0x55a0
> sctp_assoc_bh_rcv+0x38f/0x700
> sctp_inq_push+0x262/0x310
> sctp_backlog_rcv+0x16c/0x5a0
> __release_sock+0x3a0/0x440
> release_sock+0x1ea/0x280
> sctp_sendmsg+0x8e4/0x1dd0
> inet_sendmsg+0x126/0x150
> __sys_sendto+0x474/0x520
> __x64_sys_sendto+0xe5/0x1c0
> do_syscall_64+0x12e/0x7a0
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> Freed by task 11114:
> kasan_save_stack+0x24/0x50
> kasan_save_track+0x14/0x30
> kasan_save_free_info+0x3b/0x60
> __kasan_slab_free+0x43/0x70
> kfree+0x27b/0x660
> skb_free_head+0xb9/0x150
> pskb_expand_head+0x3b3/0x10b0
> skb_might_realloc+0xb6/0xd0
> sctp_sf_do_5_2_4_dupcook+0x206/0x3320
> sctp_do_sm+0x177/0x55a0
> sctp_assoc_bh_rcv+0x38f/0x700
> sctp_inq_push+0x262/0x310
> sctp_backlog_rcv+0x16c/0x5a0
> __release_sock+0x3a0/0x440
> release_sock+0x1ea/0x280
> sctp_sendmsg+0x8e4/0x1dd0
> inet_sendmsg+0x126/0x150
> __sys_sendto+0x474/0x520
> __x64_sys_sendto+0xe5/0x1c0
> do_syscall_64+0x12e/0x7a0
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> The buggy address belongs to the object at ff1100017d765800
> which belongs to the cache kmalloc-1k of size 1024
> The buggy address is located 230 bytes inside of
> freed 1024-byte region [ff1100017d765800, ff1100017d765c00)
>
> The buggy address belongs to the physical page:
> page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x17d760
> head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
> flags: 0x17ff00000000040(head|node=0|zone=2|lastcpupid=0x7ff)
> page_type: f5(slab)
> raw: 017ff00000000040 ff11000100038dc0 dead000000000100 dead000000000122
> raw: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000
> head: 017ff00000000040 ff11000100038dc0 dead000000000100 dead000000000122
> head: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000
> head: 017ff00000000003 fffffffffffffe01 00000000ffffffff 00000000ffffffff
> head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008
> page dumped because: kasan: bad access detected
> page_owner tracks the page as allocated
> page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 9374, tgid 9374 ((spawn)), ts 163178481859
> post_alloc_hook+0xff/0x130
> get_page_from_freelist+0xdd0/0x2b70
> __alloc_frozen_pages_noprof+0x2bd/0x2e10
> new_slab+0xb5/0x6a0
> refill_objects+0x113/0x3d0
> __pcs_replace_empty_main+0x35f/0x680
> __kmalloc_noprof+0x5c5/0x7f0
> load_elf_phdrs+0x107/0x210
> load_elf_binary+0x233/0x4fc0
> bprm_execve+0x8d7/0x1930
> do_execveat_common.isra.0+0x48d/0x5e0
> __x64_sys_execve+0x98/0xd0
> do_syscall_64+0x12e/0x7a0
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
> page last free pid 9372 tgid 9372 ts 163145729632 stack trace:
> __free_frozen_pages+0x870/0x1170
> qlist_free_all+0x4c/0xf0
> kasan_quarantine_reduce+0x195/0x1e0
> __kasan_slab_alloc+0x49/0x70
> kmem_cache_alloc_noprof+0x23a/0x680
> do_getname+0x39/0x3e0
> do_sys_openat2+0xa7/0x250
> __x64_sys_openat+0x144/0x200
> do_syscall_64+0x12e/0x7a0
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
>
> Memory state around the buggy address:
> ff1100017d765780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
> ff1100017d765800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> >ff1100017d765880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ^
> ff1100017d765900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ff1100017d765980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
> ==================================================================
> Kernel panic - not syncing: KASAN: panic_on_warn set ...
> CPU: 3 UID: 0 PID: 11114 Comm: syz.0.57 Not tainted 7.3.0-kernsight-kasan #1 PREEMPT(full)
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
> Call Trace:
> <TASK>
> dump_stack_lvl+0x3d/0x1b0
> vpanic+0x7f8/0xa80
> ? __pfx_vpanic+0x10/0x10
> ? __pfx_vprintk_emit+0x10/0x10
> ? sctp_unpack_cookie+0xb57/0xf30
> panic+0xc7/0xd0
> ? __pfx_panic+0x10/0x10
> ? _raw_spin_unlock_irqrestore+0x46/0x80
> ? sctp_unpack_cookie+0xb57/0xf30
> ? rcu_is_watching+0x13/0xc0
> ? _raw_spin_unlock_irqrestore+0x46/0x80
> check_panic_on_warn+0xb6/0xc0
> end_report+0x12c/0x180
> ? sctp_unpack_cookie+0xb57/0xf30
> kasan_report+0xa4/0xd0
> ? sctp_unpack_cookie+0xb57/0xf30
> sctp_unpack_cookie+0xb57/0xf30
> ? pskb_expand_head+0x591/0x10b0
> ? __pfx_sctp_unpack_cookie+0x10/0x10
> ? __pfx_pskb_expand_head+0x10/0x10
> ? dump_stack_lvl+0x15f/0x1b0
> ? should_fail_ex+0x35d/0x650
> sctp_sf_do_5_2_4_dupcook+0x2e2/0x3320
> ? __pfx_sctp_sf_do_5_2_4_dupcook+0x10/0x10
> ? sctp_sm_lookup_event+0x183/0x580
> ? kasan_save_track+0x14/0x30
> ? __kasan_slab_free+0x43/0x70
> ? kmem_cache_free+0x292/0x6a0
> ? sctp_chunk_put+0x20b/0x2c0
> ? sctp_inq_pop+0x691/0x10f0
> ? sctp_assoc_bh_rcv+0x113/0x700
> ? sctp_inq_push+0x262/0x310
> ? __pfx_sctp_cname+0x10/0x10
> sctp_do_sm+0x177/0x55a0
> ? rcu_is_watching+0x13/0xc0
> ? preempt_count_sub+0xfc/0x1a0
> ? __pfx_sctp_do_sm+0x10/0x10
> ? debug_check_no_obj_freed+0x293/0x520
> ? __lock_acquire+0x509/0x2110
> ? lockdep_hardirqs_on+0x7d/0x110
> ? kvm_clock_get_cycles+0x41/0x70
> sctp_assoc_bh_rcv+0x38f/0x700
> sctp_inq_push+0x262/0x310
> sctp_backlog_rcv+0x16c/0x5a0
> ? __pfx_sctp_backlog_rcv+0x10/0x10
> ? __pfx_sctp_backlog_rcv+0x10/0x10
> __release_sock+0x3a0/0x440
> release_sock+0x1ea/0x280
> sctp_sendmsg+0x8e4/0x1dd0
> ? __pfx_sctp_sendmsg+0x10/0x10
> ? aa_sock_msg_perm+0x127/0x200
> ? __pfx_sctp_sendmsg+0x10/0x10
> ? __pfx_inet_sendmsg+0x10/0x10
> inet_sendmsg+0x126/0x150
> __sys_sendto+0x474/0x520
> ? __pfx___sys_sendto+0x10/0x10
> ? fput+0x7d/0xe0
> ? fput+0x7d/0xe0
> ? fput+0x7d/0xe0
> ? trace_preempt_on+0x122/0x170
> ? fput+0x7d/0xe0
> ? preempt_count_sub+0xfc/0x1a0
> ? fput+0xa2/0xe0
> ? ksys_write+0x1a8/0x240
> ? __pfx_ksys_write+0x10/0x10
> __x64_sys_sendto+0xe5/0x1c0
> ? lockdep_hardirqs_on+0x7d/0x110
> do_syscall_64+0x12e/0x7a0
> entry_SYSCALL_64_after_hwframe+0x77/0x7f
> RIP: 0033:0x7f166adb2b7d
> Code: 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
> RSP: 002b:00007f166bd5cf98 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
> RAX: ffffffffffffffda RBX: 00007f166b045fa0 RCX: 00007f166adb2b7d
> RDX: 0000000000000001 RSI: 0000200000000000 RDI: 0000000000000003
> RBP: 00007f166bd5d010 R08: 0000200000000040 R09: 000000000000001c
> R10: 0000000020004845 R11: 0000000000000246 R12: 0000000000000002
> R13: 00007f166b046038 R14: 00007f166b045fa0 R15: 00007f166bd3d000
> </TASK>
> Kernel Offset: disabled
> Rebooting in 86400 seconds..
>
> The 7.1.3 report is included in the repository
> (logs/cebee8cfa01b-kasan-7.1.3.txt). It has the same paths: access in
> sctp_unpack_cookie+0xa56/0xdc0 (net/sctp/sm_make_chunk.c:1744); allocation in
> __alloc_skb() from sctp_packet_transmit() (net/sctp/output.c:598); free in
> pskb_expand_head() -> skb_free_head(), reached through skb_might_realloc()
> (net/core/skb_fault_injection.c) from pskb_pull() in
> sctp_sf_do_5_2_4_dupcook() (net/sctp/sm_statefuns.c:2235); the subsequent call
> that enters sctp_unpack_cookie() is at net/sctp/sm_statefuns.c:2244.
>
> Analysis and related report
> ---------------------------
> The report suggests that pointers into the skb data buffer become stale after
> pskb_pull() triggers skb reallocation in sctp_sf_do_5_2_4_dupcook(). A
> subsequent access in sctp_unpack_cookie() then reads from the old buffer.
>
> I found the following related report concerning the HEARTBEAT path:
> https://lists.openwall.net/netdev/2026/04/15/25
>
> I also read Xin's response regarding skb linearization in the receive path:
> https://lists.openwall.net/netdev/2026/04/15/178
>
> My report concerns the COOKIE-ECHO path rather than the HEARTBEAT path. I have
> not established whether this reallocation is reachable without fault injection,
> or whether this should be treated as an issue with the fault-injection coverage
> of an already-linearized skb. On 7.3.0 the minimised program alone did not
> trigger while the 42-program sequence did; the preceding operations may matter,
> but I have not isolated them.
>
> Could you help determine whether this is an SCTP pointer-lifetime issue that
> needs a fix, a related instance of the earlier report, or an artifact of forced
> skb reallocation?
>
> Attachments / repository contents
> ---------------------------------
> repro/repro.prog syz program, includes fail_nth: 43 (7.1.3)
> repro/repro.cprog C reproducer with fail-nth setup (7.1.3)
> repro/repro.kernsight.prog 42-program execution sequence (7.3.0)
> logs/cebee8cfa01b-kasan-7.1.3.txt full 7.1.3 KASAN report
> logs/cebee8cfa01b-kasan-7.3.txt full 7.3.0 KASAN report (also inline)
> logs/serial-7.3.log full 7.3.0 console (sequence replay)
> logs/serial-7.3-minimal-no-trigger.log 7.3.0 standalone run 1 (no trigger)
> logs/serial-7.3-minimal2-no-trigger.log 7.3.0 standalone run 2 (no trigger)
> logs/serial-7.1.3-c-repro.log 7.1.3 C-reproducer console
> kernel/kernel-7.1.3.config, kernel/kernel-7.3.config
> cmdline/cmdline-7.1.3.txt, cmdline/cmdline-7.3.0.txt
> verify.sh re-checks the numbers quoted in this mail
> MANIFEST.sha256 sha256 of every file
>
> I am happy to provide additional information and test proposed patches.
>
> Best regards,
> Zheng Zheng
Thanks, Zheng, for the report.
This issue should not occur in a real-world environment without
CONFIG_FAIL_SKB_REALLOC enabled. Since commit 28cd77527345 ("[SCTP]: Always
linearise packet on input"), packets have always been linearized before
entering the SCTP stack.
We should revert the commit that introduced pskb_pull():
commit 62b08083ec3dbfd7e533c8d230dd1d8191a6e813
Author: Sridhar Samudrala <sri@us.ibm.com>
Date: Fri May 5 17:04:43 2006 -0700
[SCTP]: Fix panic's when receiving fragmented SCTP control chunks.
Could you test the kernel with this commit reverted?
Note that you may need to revert it manually due to differences in the
surrounding code.
Thanks.
Re: [BUG] SCTP: KASAN use-after-free in sctp_unpack_cookie with fail_skb_realloc (7.3.0)
Author: 铮
Date: Sun, 25 Oct 2026 10:56
Date: Sun, 25 Oct 2026 10:56
77 lines
14694 bytes
14694 bytes
Hi Marcelo and Xin, Thanks for the analysis; that matches what we observe. We reverted 62b08083ec3d by hand on top of 7.3.0 (the surrounding code has changed since 2006, so we dropped the goto nomem error checks). The three sites are sctp_sf_do_5_1D_ce(), sctp_sf_beat_8_3() and sctp_sf_do_5_2_4_dupcook(), replacing the pskb_pull()+goto nomem with skb_pull(): --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c @@ -751,9 +751,8 @@ */ chunk->subh.cookie_hdr = (struct sctp_signed_cookie *)chunk->skb->data; - if (!pskb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) - - sizeof(struct sctp_chunkhdr))) - goto nomem; + skb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) - + sizeof(struct sctp_chunkhdr)); /* 5.1 D) Upon reception of the COOKIE ECHO chunk, Endpoint * "Z" will reply with a COOKIE ACK chunk after building a TCB @@ -1211,8 +1210,7 @@ return sctp_sf_violation_paramlen(net, ep, asoc, type, arg, param_hdr, commands); - if (!pskb_pull(chunk->skb, paylen)) - goto nomem; + skb_pull(chunk->skb, paylen); reply = sctp_make_heartbeat_ack(asoc, chunk, param_hdr, paylen); if (!reply) @@ -2253,9 +2251,8 @@ * are in good shape. */ chunk->subh.cookie_hdr = (struct sctp_signed_cookie *)chunk->skb->data; - if (!pskb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) - - sizeof(struct sctp_chunkhdr))) - goto nomem; + skb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) - + sizeof(struct sctp_chunkhdr)); /* In RFC 2960 5.2.4 3, if both Verification Tags in the State Cookie * of a duplicate COOKIE ECHO match the Verification Tags of the We rebuilt 7.3.0 with the same configuration (7.3.0-kernsight-kasan #2, gcc 11.4.0 Ubuntu 22.04, KASAN/KCOV, CONFIG_FAIL_SKB_REALLOC=y) and re-ran the same 42-program sequence that triggered the UAF on the unmodified 7.3.0. Results: - Unmodified 7.3.0: the previously recorded run triggered the UAF (1/1), with the first report at t=212.7 s. - 7.3.0 with the manual revert: both runs completed without panic (2/2), and neither serial log contains the KASAN UAF report. The same input sequence and fail_nth annotations were used. However, removing these pskb_pull() calls changes the fault-injection sequence: the reverted runs logged failslab injections instead of the original fail_skb_realloc injection. Therefore, these results show that the original reproducer no longer triggers the reported UAF after the revert; they do not establish equivalent injection coverage. As you noted, this issue requires CONFIG_FAIL_SKB_REALLOC; our tests enable it. The revert patch, the two serial/console logs and the syz-execprog outputs are in the repository: https://github.com/Zheng-zheng-codes/sctp-unpack-cookie-repro (see revert-test/) I can also test the other two paths (5.1D COOKIE_ECHO / HEARTBEAT) or 7.1.3 if useful. Best regards, Zheng Zheng
Re: [BUG] SCTP: KASAN use-after-free in sctp_unpack_cookie with fail_skb_realloc (7.3.0)
Author: Xin Long
Date: Mon, 26 Oct 2026 14:47
Date: Mon, 26 Oct 2026 14:47
92 lines
15394 bytes
15394 bytes
Thanks for the test. net-next is closed now, i will prepare a patch for this once it's open. Thanks. On Sun, Oct 25, 2026 at 6:56 AM 铮 <fengaojigui88@gmail.com> wrote: > > Hi Marcelo and Xin, > > Thanks for the analysis; that matches what we observe. > > We reverted 62b08083ec3d by hand on top of 7.3.0 (the surrounding code has > changed since 2006, so we dropped the goto nomem error checks). The three > sites are sctp_sf_do_5_1D_ce(), sctp_sf_beat_8_3() and > sctp_sf_do_5_2_4_dupcook(), replacing the pskb_pull()+goto nomem with > skb_pull(): > > --- a/net/sctp/sm_statefuns.c > +++ b/net/sctp/sm_statefuns.c > @@ -751,9 +751,8 @@ > */ > chunk->subh.cookie_hdr = > (struct sctp_signed_cookie *)chunk->skb->data; > - if (!pskb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) - > - sizeof(struct sctp_chunkhdr))) > - goto nomem; > + skb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) - > + sizeof(struct sctp_chunkhdr)); > > /* 5.1 D) Upon reception of the COOKIE ECHO chunk, Endpoint > * "Z" will reply with a COOKIE ACK chunk after building a TCB > @@ -1211,8 +1210,7 @@ > return sctp_sf_violation_paramlen(net, ep, asoc, type, arg, > param_hdr, commands); > > - if (!pskb_pull(chunk->skb, paylen)) > - goto nomem; > + skb_pull(chunk->skb, paylen); > > reply = sctp_make_heartbeat_ack(asoc, chunk, param_hdr, paylen); > if (!reply) > @@ -2253,9 +2251,8 @@ > * are in good shape. > */ > chunk->subh.cookie_hdr = (struct sctp_signed_cookie *)chunk->skb->data; > - if (!pskb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) - > - sizeof(struct sctp_chunkhdr))) > - goto nomem; > + skb_pull(chunk->skb, ntohs(chunk->chunk_hdr->length) - > + sizeof(struct sctp_chunkhdr)); > > /* In RFC 2960 5.2.4 3, if both Verification Tags in the State Cookie > * of a duplicate COOKIE ECHO match the Verification Tags of the > > We rebuilt 7.3.0 with the same configuration (7.3.0-kernsight-kasan #2, > gcc 11.4.0 Ubuntu 22.04, KASAN/KCOV, CONFIG_FAIL_SKB_REALLOC=y) and re-ran the > same 42-program sequence that triggered the UAF on the unmodified 7.3.0. > > Results: > - Unmodified 7.3.0: the previously recorded run triggered the UAF > (1/1), with the first report at t=212.7 s. > - 7.3.0 with the manual revert: both runs completed without panic > (2/2), and neither serial log contains the KASAN UAF report. > > The same input sequence and fail_nth annotations were used. However, > removing these pskb_pull() calls changes the fault-injection sequence: > the reverted runs logged failslab injections instead of the original > fail_skb_realloc injection. Therefore, these results show that the > original reproducer no longer triggers the reported UAF after the > revert; they do not establish equivalent injection coverage. > > As you noted, this issue requires CONFIG_FAIL_SKB_REALLOC; our tests enable it. > > The revert patch, the two serial/console logs and the syz-execprog outputs are > in the repository: > https://github.com/Zheng-zheng-codes/sctp-unpack-cookie-repro > (see revert-test/) > > I can also test the other two paths (5.1D COOKIE_ECHO / HEARTBEAT) or 7.1.3 if > useful. > > Best regards, > Zheng Zheng
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads