]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
sctp: validate Adaptation Indication parameter length
authorCharles Vosburgh <trilobyte777@gmail.com>
Mon, 27 Jul 2026 23:17:30 +0000 (19:17 -0400)
committerJakub Kicinski <kuba@kernel.org>
Wed, 29 Jul 2026 23:51:28 +0000 (16:51 -0700)
The Adaptation Layer Indication parameter contains a fixed 32-bit
Adaptation Code Point after its parameter header. However,
sctp_verify_param() accepts a header-only parameter because the generic
parameter walker only requires the header to be present.

sctp_process_param() then reads adaptation_ind beyond the declared
parameter. When the malformed parameter is last in an INIT, the read
starts at the receive skb tail, and the value is copied into the state
cookie returned in the INIT ACK. This may disclose four receive-buffer
tail bytes.

Require the declared parameter length to match the fixed structure size
and abort the association through the existing invalid parameter length
path otherwise.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Charles Vosburgh <trilobyte777@gmail.com>
Acked-by: Xin Long <lucien.xin@gmail.com>
Link: https://patch.msgid.link/20260727-sctp-adaptation-length-v1-1-0ab58b2810a5@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/sctp/sm_make_chunk.c

index a1c0334a1038abdaa0feb70db8735c8027fb2faa..0ae30c3c8913a8ec56d0e50c3191f3bbd6f3cc81 100644 (file)
@@ -2171,7 +2171,13 @@ static enum sctp_ierror sctp_verify_param(struct net *net,
        case SCTP_PARAM_HEARTBEAT_INFO:
        case SCTP_PARAM_UNRECOGNIZED_PARAMETERS:
        case SCTP_PARAM_ECN_CAPABLE:
+               break;
        case SCTP_PARAM_ADAPTATION_LAYER_IND:
+               if (ntohs(param.p->length) != sizeof(*param.aind)) {
+                       sctp_process_inv_paramlength(asoc, param.p,
+                                                    chunk, err_chunk);
+                       retval = SCTP_IERROR_ABORT;
+               }
                break;
 
        case SCTP_PARAM_SUPPORTED_EXT: