In the Linux kernel, the following vulnerability has been resolved:
sctp: fix a TOCTOU race in SCTP_CMD_TIMER_START
The SCTP_CMD_TIMER_START handler checks timer_pending() before calling
timer_reduce(). The timer can expire and detach between these operations,
causing timer_reduce() to rearm the timer without taking the association
reference required for the newly armed timer.
The timer callback later unconditionally drops its association reference,
which can leave the association reference count unbalanced and result in
use-after-free during association teardown.
Use the return value of timer_reduce() to determine whether the timer was
actually armed. Take the association reference only when timer_reduce()
successfully starts a new timer, closing the race between checking the
timer state and rearming it.
This issue was reported by Nico Yip (@cyeaa) working with TrendAI Zero
Day Initiative.
CVSS Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
CVSS Score: 8.1
AV:N - A remote SCTP peer's restart COOKIE-ECHO goes through sctp_sf_do_5_2_4_dupcook()/sctp_sf_do_dupcook_a() in SHUTDOWN_SENT and on to sctp_sf_do_9_2_start_shutdown(). That queues SCTP_CMD_TIMER_START for T2-shutdown while T2 is already armed, which reaches the racy timer_pending()/timer_reduce() pair in sctp_cmd_interpreter(). SCTP runs over routable IP.
AC:H - The peer must time its COOKIE-ECHO so that T2 expires on another CPU in the window between timer_pending() and timer_reduce(), which is two adjacent statements. The attacker can retry by timing packets around T2 retransmissions, but cannot control when the kernel timer fires relative to softirq processing. The target association must also be in SHUTDOWN_SENT with its socket closing.
PR:N - SCTP association setup and the restart COOKIE-ECHO path in sctp_sf_do_dupcook_a() need no authentication. The attacker is just the unauthenticated peer of the association.
UI:N - No victim action is needed beyond the SCTP service normally closing an association, which puts it in SHUTDOWN_SENT. The attacker sends all the triggering packets.
S:U - The corruption is confined to the kernel's own sctp_association object. No security boundary such as a VM or IOMMU is crossed.
C:H - Re-arming the timer without sctp_association_hold() lets sctp_generate_timeout_event() call sctp_association_put() one time too many. The association is then freed while still referenced, a use-after-free of a large slab object whose reclaimed contents can be used to leak kernel memory.
I:H - The freed sctp_association holds function-relevant state such as timers, transports and the outqueue. Later timer callbacks and teardown writes into reclaimed memory give a write primitive that could be used to hijack control flow.
A:H - The unbalanced refcount causes a refcount underflow or use-after-free during association teardown or a later timer callback, crashing the kernel.
| Attack Vector |
Network |
Scope |
Unchanged |
| Attack Complexity |
High |
Confidentiality Impact |
High |
| Privileges Required |
None |
Integrity Impact |
High |
| User Interaction |
None |
Availability Impact |
High |
AV:N - A remote SCTP peer's restart COOKIE-ECHO goes through sctp_sf_do_5_2_4_dupcook()/sctp_sf_do_dupcook_a() in SHUTDOWN_SENT and on to sctp_sf_do_9_2_start_shutdown(). That queues SCTP_CMD_TIMER_START for T2-shutdown while T2 is already armed, which reaches the racy timer_pending()/timer_reduce() pair in sctp_cmd_interpreter(). SCTP runs over routable IP.
AC:H - The peer must time its COOKIE-ECHO so that T2 expires on another CPU in the window between timer_pending() and timer_reduce(), which is two adjacent statements. The attacker can retry by timing packets around T2 retransmissions, but cannot control when the kernel timer fires relative to softirq processing. The target association must also be in SHUTDOWN_SENT with its socket closing.
PR:N - SCTP association setup and the restart COOKIE-ECHO path in sctp_sf_do_dupcook_a() need no authentication. The attacker is just the unauthenticated peer of the association.
UI:N - No victim action is needed beyond the SCTP service normally closing an association, which puts it in SHUTDOWN_SENT. The attacker sends all the triggering packets.
S:U - The corruption is confined to the kernel's own sctp_association object. No security boundary such as a VM or IOMMU is crossed.
C:H - Re-arming the timer without sctp_association_hold() lets sctp_generate_timeout_event() call sctp_association_put() one time too many. The association is then freed while still referenced, a use-after-free of a large slab object whose reclaimed contents can be used to leak kernel memory.
I:H - The freed sctp_association holds function-relevant state such as timers, transports and the outqueue. Later timer callbacks and teardown writes into reclaimed memory give a write primitive that could be used to hijack control flow.
A:H - The unbalanced refcount causes a refcount underflow or use-after-free during association teardown or a later timer callback, crashing the kernel.
CVSS 3.1