From nobody Sat Feb 04 18:14:44 2023 X-Original-To: wireless@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 4P8LK04VDmz3nhRq for ; Sat, 4 Feb 2023 18:14:44 +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 4P8LK01v3Hz3DTm for ; Sat, 4 Feb 2023 18:14:44 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675534484; 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=r2fWHiePc4tX8lJDikASlKpHoLZRHuMK0lNylWFS+Q4=; b=BKX9RIiocgczBuxLIYRePCb1Jmrt6pl1bn3RavWJASI+5Sb+WSt9ec4xwE7hiqlOvDhFZg ZR87RSuZzmEy4pkJHtefvpIBqydcc8fj4ND53pEP7rDXxXgw1yU7arTBFxdWdPG2cR1uDH JBmlOeWiiIcF0KbU+sNf7z3HlFn6lvLpvCdpJ1XS9RijwWSIHroPdQ9rM8praKqGMUyY9w eX3Ws8WExoY6fRKHEa06SoDto7FCKU/wUU+7RcoNa9vDjqk0Oxps2MommW0q0SyIrKt5B3 84tjFQ6g5uOVk9r0Ic9A/3sENJyf3HY8cWPl2HxKylZNpMcC1B01PqoXvgCpZQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675534484; a=rsa-sha256; cv=none; b=JK8sDVPsGiamx9H4vBPGJq2gSIrP17g/8boy66VDEDytDxbubnaInz70x2mndFAUcj+XxB 81W3aSz+3m85KrrDpVdMxcn0zAOs5jq8SknXKi882gqhnYnUozj71tHwL2lilbG3jQ8GxC 5eJgfTc3xjvmIJe0bdm8RPckJCKnxeBNOGIkybx0u8I1/CvADVucbKnlrMZpo6b6YI94f5 mITVYxeYh7qk5bLWa6dAcA3OlHup0Wzp4uLHB4B3DEVEnI2DzR4VgzCNNu1WTa8CA4ediN gP7OX1Ma7s7lcnJgShg5uF2AIsCW5N03HpzQr1bekq+CO/X2DcDUXuatnXKMEg== 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 4P8LK00dN2zP55 for ; Sat, 4 Feb 2023 18:14:44 +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 314IEhAM098383 for ; Sat, 4 Feb 2023 18:14:43 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 314IEhwp098382 for wireless@FreeBSD.org; Sat, 4 Feb 2023 18:14:43 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: wireless@FreeBSD.org Subject: [Bug 269322] ieee80211_scanreq() should validate ssid len passed to ioctl() Date: Sat, 04 Feb 2023 18:14:44 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: wireless 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: wireless@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: Discussions List-Archive: https://lists.freebsd.org/archives/freebsd-wireless List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-wireless@freebsd.org X-BeenThere: freebsd-wireless@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D269322 Bug ID: 269322 Summary: ieee80211_scanreq() should validate ssid len passed to ioctl() Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: wireless Assignee: wireless@FreeBSD.org Reporter: rtm@lcs.mit.edu Attachment #239906 text/plain mime type: Created attachment 239906 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D239906&action= =3Dedit crash the 80211 scan code with a negative ssid len ieee80211_scanreq() says: for (i =3D 0; i < sr->sr_nssid; i++) if (sr->sr_ssid[i].len > IEEE80211_NWID_LEN) return EINVAL; len is an int, so this code will accept a negative len passed to ioctl SIOCS80211 / IEEE80211_IOC_SCAN_REQ. Later on, ieee80211_add_ssid() passes len to memcpy(), which causes a crash if it's negative. I've attached a demo: # cc wlanctl2b.c # ./a.out panic: Fatal page fault at 0xffffffc00065ff3a: 0xffffffc11352d006 cpuid =3D 0 time =3D 1675517224 KDB: stack backtrace: db_trace_self() at db_trace_self db_trace_self_wrapper() at db_trace_self_wrapper+0x38 kdb_backtrace() at kdb_backtrace+0x2c vpanic() at vpanic+0x170 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 0xffffffc11352d006 memcpy() at memcpy+0x8e ieee80211_add_ssid() at ieee80211_add_ssid+0x28 ieee80211_probereq_ie() at ieee80211_probereq_ie+0xac ieee80211_send_probereq() at ieee80211_send_probereq+0x126 ieee80211_swscan_probe_curchan() at ieee80211_swscan_probe_curchan+0x58 ieee80211_probe_curchan() at ieee80211_probe_curchan+0x30 scan_curchan() at scan_curchan+0x70 scan_curchan_task() at scan_curchan_task+0x292 scan_start() at scan_start+0x18a taskqueue_run_locked() at taskqueue_run_locked+0x96 taskqueue_thread_loop() at taskqueue_thread_loop+0x62 fork_exit() at fork_exit+0x80 fork_trampoline() at fork_trampoline+0xa --=20 You are receiving this mail because: You are the assignee for the bug.=