🇰🇷 한글 설명
Linux 커널의 SCTP 프로토콜 구현에서 Stale Cookie 오류 처리 시 발생하는 Use-After-Free 취약점입니다. 오래된 쿠키를 처리하며 연결 상태를 되돌리는 과정에서 기존 스트림 테이블은 해제되지만 스케줄러의 포인터가 갱신되지 않아, 이후 잘못된 메모리 참조로 인해 시스템 충돌이 발생할 수 있습니다.
💡 쉬운 설명
인터넷 연결을 설정하는 과정에서 잘못된 정보를 보냈을 때, 컴퓨터가 이미 삭제한 메모리 주소를 다시 사용하려고 시도하여 시스템이 멈추거나 오류가 발생하는 문제입니다. 이로 인해 공격자가 시스템을 강제로 종료시킬 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
sctp: purge outqueue on stale COOKIE-ECHO handling
sctp_stream_update() is only invoked when the association is moved into
COOKIE_WAIT during association setup/reconfiguration. In this path, the
outbound stream scheduler state (stream->out_curr) is expected to be
clean, since no user data should have been transmitted yet unless the
state machine has already partially progressed.
However, a corner case exists in sctp_sf_do_5_2_6_stale(): when a
Stale Cookie ERROR is received, the association is rolled back from
COOKIE_ECHOED to COOKIE_WAIT. In this scenario, user data may already
have been queued and even bundled with the COOKIE-ECHO chunk.
During the rollback, sctp_stream_update() frees the old stream table
and installs a new one, but it does not invalidate stream->out_curr.
As a result, out_curr may still point to a freed sctp_stream_out
entry from the previous stream state.
Later, SCTP scheduler dequeue paths (FCFS, RR, PRIO, etc.) rely on
stream->out_curr->ext, which can lead to use-after-free once the old
stream state has been released via sctp_stream_free().
This results in crashes such as (reported by Yuqi):
BUG: KASAN: slab-use-after-free in sctp_sched_fcfs_dequeue+0x13a/0x140
Read of size 8 at addr ff1100004d4d3208 by task mini_poc/9312
CPU: 1 UID: 1001 PID: 9312 Comm: mini_poc Not tainted
7.1.0-rc1-00305-gbd3a4795d574 #5 PREEMPT(full)
sctp_sched_fcfs_dequeue+0x13a/0x140
sctp_outq_flush+0x1603/0x33e0
sctp_do_sm+0x31c9/0x5d30
sctp_assoc_bh_rcv+0x392/0x6f0
sctp_inq_push+0x1db/0x270
sctp_rcv+0x138d/0x3c10
Fix this by fully purging the association outqueue when handling the
Stale Cookie case. This ensures all pending transmit and retransmit
state is dropped, and any scheduler cached pointers are invalidated,
making it safe to rebuild stream state during COOKIE_WAIT restart.
Updating only stream->out_curr would be insufficient, since queued
and retransmittable data would still reference the old stream state and
trigger later use-after-free in dequeue paths.
📍 영향받는 시스템
Linux Kernel (SCTP 프로토콜을 사용하는 모든 버전)
⚔️ 공격 벡터
조작된 Stale Cookie ERROR를 전송하여 SCTP 연결 상태를 강제로 롤백 유도
🛡️ 대응 방법
Stale Cookie 처리 시 연결의 아웃큐(outqueue)를 완전히 비워 모든 전송 상태와 스케줄러 포인터를 무효화하도록 커널 패치 적용
🔧 검증 코드
출력된 커널 버전이 취약점이 해결된 최신 보안 패치 버전인지 확인