From nobody Mon Oct 31 17:33:25 2022 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4N1Kxd56zqz4gm7B for ; Mon, 31 Oct 2022 17:33:25 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4N1Kxd2qCTz3l8Y for ; Mon, 31 Oct 2022 17:33:25 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4N1Kxd1ZpGzlGH for ; Mon, 31 Oct 2022 17:33:25 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 29VHXPM2060689 for ; Mon, 31 Oct 2022 17:33:25 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 29VHXP22060688 for bugs@FreeBSD.org; Mon, 31 Oct 2022 17:33:25 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 267476] SctpAlias() can pass a NULL assoc which ProcessSctpMsg() dereferences Date: Mon, 31 Oct 2022 17:33:25 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: rtm@lcs.mit.edu X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.mimetype attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667237605; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IT7ViDz/x8DqDzaTTcwWdvtgfX2SY+x5dKhcSeAPvqI=; b=T+aE1tRHE9Rwd6+lriWgwJPZrEQCbYx3BSoFhRUGcjNigP1e9gMN/W/BqR7l6+9LX4i9cc T9J0gv0mcjYi3eGEgIpck1iJ14wshGdk12WrhYkI1ySAo9UNBIqy1b3uNjrv25nPfF5GUs zzT8UoTrlkngke8IeNP9nOlo1tpY2FeDn7qvCkysJv7Y46peuCNci8toCXWSvkoyCvJqMD 6rqWGKl5eR1mkiPxVJmIFTs+J0RuPrOUbuFDG817dvgjfdbpwe7VIesgM6H2MWmVYAaYMO J3+Y+pLkoZFZG7w1Bnj4nGShbNuNS7QU2y08E6FdtjmRYoF0S5yfOOT+t2X7KA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1667237605; a=rsa-sha256; cv=none; b=c4tgSFGvacAoOckn71Y1XM6gqyceUpBT+kkRMxa9P48USRCspjhv5yEa3Ui7ceMVmStE6f ogg4o7lLvRhkb8Xss7hYya8l4weg1vsJSEUgNEE+XaN272fjtWgXTMg1/L77lI4DAZQTxt LzrAwE2XMnWyPg2QPQ4OlS4qhhisWZLye+VjsuncUmpg1g7lQ5VPgbjv6vofd/JAtcuTuQ 8t1HUBjSS8nCH4W4HZYwGQ/yTp/avzbAgrZkleT+2fyr51ZLcdfp2TOXU0prdyzJ2JsKrf odp2EfYXN0jKXnyDxGyX64SJvoy4CaNxnUad05atWbBGxtzEnSHklU9Rt1ibGQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D267476 Bug ID: 267476 Summary: SctpAlias() can pass a NULL assoc which ProcessSctpMsg() dereferences Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: rtm@lcs.mit.edu Attachment #237765 text/plain mime type: Created attachment 237765 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D237765&action= =3Dedit trigger NULL dereference in kernel LibAlias's SctpAlias() In sys/netinet/libalias/alias_sctp.c, if SctpAlias()'s call to sctp_PktParser() returns SN_PARSE_ERROR_CHHL, and the IP_MF bit is set, then SctpAlias() ignores the error. However, sctp_PktParser() doesn't always set assoc in this situation, in which case SctpAlias() passes the NULL assoc to ProcessSctpMsg(), which tries to dereference it. Here's a demo, via netgraph's ng_nat: # cc ng50a.c -lnetgraph # ./a.out panic: Fatal page fault at 0xffffffc0004fbf7e: 0x00000000000018 panic() at panic+0x2a page_fault_handler() at page_fault_handler+0x1d6 do_trap_supervisor() at do_trap_supervisor+0x74 cpu_exception_handler_supervisor() at cpu_exception_handler_supervisor+0x70 --- exception 13, tval =3D 0x18 ProcessSctpMsg() at ProcessSctpMsg+0xc SctpAlias() at SctpAlias+0x158 LibAliasOutLocked() at LibAliasOutLocked+0x176 LibAliasOut() at LibAliasOut+0x42 ng_nat_rcvdata() at ng_nat_rcvdata+0x220 ng_apply_item() at ng_apply_item+0x130 ng_snd_item() at ng_snd_item+0x1bc ngd_send() at ngd_send+0xf8 sosend_generic() at sosend_generic+0x384 sosend() at sosend+0x68 kern_sendit() at kern_sendit+0x170 sendit() at sendit+0x9c sys_sendto() at sys_sendto+0x40 syscallenter() at syscallenter+0xec ecall_handler() at ecall_handler+0x18 do_trap_user() at do_trap_user+0xf6 cpu_exception_handler_user() at cpu_exception_handler_user+0x72 --- syscall (133, FreeBSD ELF64, sys_sendto) --=20 You are receiving this mail because: You are the assignee for the bug.=