REDHAT-BUG-2532290: Use After Free
In the Linux kernel, the following vulnerability has been resolved:
sctp: stop processing a packet once its association is deleted
sctpendpointbhrcv() looks the association up only when chunk->asoc is NULL, and caches the result in chunk->asoc and chunk->transport without taking a reference.
A packet that matches no association is handed to the endpoint, so a peer can bundle COOKIE ECHO, SHUTDOWN and SHUTDOWN ACK in one packet. The COOKIE ECHO creates the association, the SHUTDOWN chunk caches it, and with the outqueue empty the SHUTDOWN ACK reaches sctpsfdo92final(), so the association and its transports are freed.
The endpoint loop has no counterpart to the asoc->base.dead check in sctpassocbhrcv(). The next chunk writes to lasttimeheard in the freed transport and is then passed to sctpdosm() with the freed association. The transport is freed through RCU, so this needs the packet to come off the socket backlog, where the loop runs in task context.
The endpoint loop cannot do the same check: it holds no reference on the association, so reading asoc->base.dead would itself be a use-after-free. Mark the packet for discard in the command interpreter, just before it deletes the association. That is also before sctpinqfree() releases the chunk on the association receive path.
sctpsfdo524dupcook() issues SCTPCMDDELETETCB for the temporary association, while the one the packet belongs to stays alive. A restarting peer can bundle DATA behind its COOKIE ECHO, so compare against chunk->asoc and leave that case alone.
Affected Software
Event History
Frequently Asked Questions
What conditions are required to trigger the use-after-free?
An attacker needs to send a specially bundled SCTP packet that includes COOKIE ECHO, SHUTDOWN, SHUTDOWN ACK, and a subsequent chunk. The packet must be processed from the socket backlog, where the endpoint receive loop runs in task context and the transport is freed through RCU.
Which systems are exposed?
Systems using the Linux kernel with SCTP packet processing are relevant. The issue involves packets that initially match no association and are handed to an SCTP endpoint.
What is the remediation described by the fix?
The fix marks the packet for discard in the command interpreter before association teardown can leave later bundled chunks operating on freed association or transport state.