In the Linux kernel, the following vulnerability has been resolved:
HID: core: fix shift-out-of-bounds in hidreportraw_event
Syzbot reported shift-out-of-bounds in hidreportraw_event.
microsoft 0003:045E:07DA.0001: hidfieldextract() called with n (128) >
UBSAN: shift-out-of-bounds in drivers/hid/hid-core.c:1323:20 shift exponent 127 is too large for 32-bit type 'int' CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.1.0-rc4-syzkaller-00159-g4bbf3422df78 #0 Hardware name: Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Call Trace: <IRQ> _dumpstack lib/dumpstack.c:88 [inline] dumpstacklvl+0x1e3/0x2cb lib/dumpstack.c:106 ubsanepilogue lib/ubsan.c:151 [inline] _ubsanhandleshiftoutofbounds+0x3a6/0x420 lib/ubsan.c:322 snto32 drivers/hid/hid-core.c:1323 [inline] hidinputfetchfield drivers/hid/hid-core.c:1572 [inline] hidprocessreport drivers/hid/hid-core.c:1665 [inline] hidreportrawevent+0xd56/0x18b0 drivers/hid/hid-core.c:1998 hidinputreport+0x408/0x4f0 drivers/hid/hid-core.c:2066 hidirqin+0x459/0x690 drivers/hid/usbhid/hid-core.c:284 _usbhcdgivebackurb+0x369/0x530 drivers/usb/core/hcd.c:1671 dummytimer+0x86b/0x3110 drivers/usb/gadget/udc/dummyhcd.c:1988 calltimerfn+0xf5/0x210 kernel/time/timer.c:1474 expiretimers kernel/time/timer.c:1519 [inline] _runtimers+0x76a/0x980 kernel/time/timer.c:1790 runtimersoftirq+0x63/0xf0 kernel/time/timer.c:1803 _dosoftirq+0x277/0x75b kernel/softirq.c:571 _irqexitrcu+0xec/0x170 kernel/softirq.c:650 irqexit_rcu+0x5/0x20 kernel/softirq.c:662
If the size of the integer (unsigned n) is bigger than 32 in snto32(), shift exponent will be too large for 32-bit type 'int', resulting in a shift-out-of-bounds bug. Fix this by adding a check on the size of the integer (unsigned n) in snto32(). To add support for n greater than 32 bits, set n to 32, if n is greater than 32.
{ "vanir_signatures": [ { "deprecated": false, "id": "CVE-2022-48978-0b36fa98", "digest": { "function_hash": "113275835048468967675974213778156558300", "length": 313.0 }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@db1ed1b3fb4ec0d19080a102956255769bc45c79", "target": { "file": "drivers/hid/hid-core.c", "function": "snto32" }, "signature_version": "v1", "signature_type": "Function" }, { "deprecated": false, "id": "CVE-2022-48978-216a0c42", "digest": { "threshold": 0.9, "line_hashes": [ "333657907554334564406639608527502943487", "223181654510142301549033248284777075069", "78763469606407271670549820749429485586" ] }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@bc03f809da78fc79e4aee132d4e5c6a2b3aeec73", "target": { "file": "drivers/hid/hid-core.c" }, "signature_version": "v1", "signature_type": "Line" }, { "deprecated": false, "id": "CVE-2022-48978-376bc836", "digest": { "threshold": 0.9, "line_hashes": [ "333657907554334564406639608527502943487", "223181654510142301549033248284777075069", "78763469606407271670549820749429485586" ] }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@809783f8b4b600c7fb3bccb10fefef822601ea3b", "target": { "file": "drivers/hid/hid-core.c" }, "signature_version": "v1", "signature_type": "Line" }, { "deprecated": false, "id": "CVE-2022-48978-3b4fa160", "digest": { "threshold": 0.9, "line_hashes": [ "333657907554334564406639608527502943487", "223181654510142301549033248284777075069", "78763469606407271670549820749429485586" ] }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@151493fe5a6ed1a88decc929a7368a3f2a246914", "target": { "file": "drivers/hid/hid-core.c" }, "signature_version": "v1", "signature_type": "Line" }, { "deprecated": false, "id": "CVE-2022-48978-4448d1f6", "digest": { "function_hash": "305440201961194121012176681739200150702", "length": 313.0 }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@151493fe5a6ed1a88decc929a7368a3f2a246914", "target": { "file": "drivers/hid/hid-core.c", "function": "snto32" }, "signature_version": "v1", "signature_type": "Function" }, { "deprecated": false, "id": "CVE-2022-48978-60d07070", "digest": { "function_hash": "113275835048468967675974213778156558300", "length": 313.0 }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@8e14f20e12224ee2429f75a5c9418a700e26a8d3", "target": { "file": "drivers/hid/hid-core.c", "function": "snto32" }, "signature_version": "v1", "signature_type": "Function" }, { "deprecated": false, "id": "CVE-2022-48978-660d89ec", "digest": { "threshold": 0.9, "line_hashes": [ "333657907554334564406639608527502943487", "223181654510142301549033248284777075069", "78763469606407271670549820749429485586" ] }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@8e14f20e12224ee2429f75a5c9418a700e26a8d3", "target": { "file": "drivers/hid/hid-core.c" }, "signature_version": "v1", "signature_type": "Line" }, { "deprecated": false, "id": "CVE-2022-48978-950cc239", "digest": { "function_hash": "113275835048468967675974213778156558300", "length": 313.0 }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2b3b4d7aadaa1b6b58d0f34823bf86cfe8a31b4d", "target": { "file": "drivers/hid/hid-core.c", "function": "snto32" }, "signature_version": "v1", "signature_type": "Function" }, { "deprecated": false, "id": "CVE-2022-48978-9a9056da", "digest": { "threshold": 0.9, "line_hashes": [ "333657907554334564406639608527502943487", "223181654510142301549033248284777075069", "78763469606407271670549820749429485586" ] }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@db1ed1b3fb4ec0d19080a102956255769bc45c79", "target": { "file": "drivers/hid/hid-core.c" }, "signature_version": "v1", "signature_type": "Line" }, { "deprecated": false, "id": "CVE-2022-48978-a1ea6434", "digest": { "function_hash": "113275835048468967675974213778156558300", "length": 313.0 }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@809783f8b4b600c7fb3bccb10fefef822601ea3b", "target": { "file": "drivers/hid/hid-core.c", "function": "snto32" }, "signature_version": "v1", "signature_type": "Function" }, { "deprecated": false, "id": "CVE-2022-48978-ba0ebda9", "digest": { "function_hash": "113275835048468967675974213778156558300", "length": 313.0 }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ec61b41918587be530398b0d1c9a0d16619397e5", "target": { "file": "drivers/hid/hid-core.c", "function": "snto32" }, "signature_version": "v1", "signature_type": "Function" }, { "deprecated": false, "id": "CVE-2022-48978-be4482c7", "digest": { "function_hash": "113275835048468967675974213778156558300", "length": 313.0 }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f755d11c55b29049b77da5cd9ab2faae96eb33c3", "target": { "file": "drivers/hid/hid-core.c", "function": "snto32" }, "signature_version": "v1", "signature_type": "Function" }, { "deprecated": false, "id": "CVE-2022-48978-cb2fea2f", "digest": { "threshold": 0.9, "line_hashes": [ "333657907554334564406639608527502943487", "223181654510142301549033248284777075069", "78763469606407271670549820749429485586" ] }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@2b3b4d7aadaa1b6b58d0f34823bf86cfe8a31b4d", "target": { "file": "drivers/hid/hid-core.c" }, "signature_version": "v1", "signature_type": "Line" }, { "deprecated": false, "id": "CVE-2022-48978-d6cf99d1", "digest": { "threshold": 0.9, "line_hashes": [ "333657907554334564406639608527502943487", "223181654510142301549033248284777075069", "78763469606407271670549820749429485586" ] }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ec61b41918587be530398b0d1c9a0d16619397e5", "target": { "file": "drivers/hid/hid-core.c" }, "signature_version": "v1", "signature_type": "Line" }, { "deprecated": false, "id": "CVE-2022-48978-eacfb29a", "digest": { "function_hash": "113275835048468967675974213778156558300", "length": 313.0 }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@bc03f809da78fc79e4aee132d4e5c6a2b3aeec73", "target": { "file": "drivers/hid/hid-core.c", "function": "snto32" }, "signature_version": "v1", "signature_type": "Function" }, { "deprecated": false, "id": "CVE-2022-48978-f2044fb3", "digest": { "threshold": 0.9, "line_hashes": [ "333657907554334564406639608527502943487", "223181654510142301549033248284777075069", "78763469606407271670549820749429485586" ] }, "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f755d11c55b29049b77da5cd9ab2faae96eb33c3", "target": { "file": "drivers/hid/hid-core.c" }, "signature_version": "v1", "signature_type": "Line" } ] }