CVE-2021-47337
IBM VSCSI Bad Pointer Dereference Vulnerability
Description
In the Linux kernel, the following vulnerability has been resolved: scsi: core: Fix bad pointer dereference when ehandler kthread is invalid Commit 66a834d09293 ("scsi: core: Fix error handling of scsi_host_alloc()") changed the allocation logic to call put_device() to perform host cleanup with the assumption that IDA removal and stopping the kthread would properly be performed in scsi_host_dev_release(). However, in the unlikely case that the error handler thread fails to spawn, shost->ehandler is set to ERR_PTR(-ENOMEM). The error handler cleanup code in scsi_host_dev_release() will call kthread_stop() if shost->ehandler != NULL which will always be the case whether the kthread was successfully spawned or not. In the case that it failed to spawn this has the nasty side effect of trying to dereference an invalid pointer when kthread_stop() is called. The following splat provides an example of this behavior in the wild: scsi host11: error handler thread failed to spawn, error = -4 Kernel attempted to read user page (10c) - exploit attempt? (uid: 0) BUG: Kernel NULL pointer dereference on read at 0x0000010c Faulting instruction address: 0xc00000000818e9a8 Oops: Kernel access of bad area, sig: 11 [#1] LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries Modules linked in: ibmvscsi(+) scsi_transport_srp dm_multipath dm_mirror dm_region hash dm_log dm_mod fuse overlay squashfs loop CPU: 12 PID: 274 Comm: systemd-udevd Not tainted 5.13.0-rc7 #1 NIP: c00000000818e9a8 LR: c0000000089846e8 CTR: 0000000000007ee8 REGS: c000000037d12ea0 TRAP: 0300 Not tainted (5.13.0-rc7) MSR: 800000000280b033 <SF,VEC,VSX,EE,FP,ME,IR,DR,RI,LE> CR: 28228228 XER: 20040001 CFAR: c0000000089846e4 DAR: 000000000000010c DSISR: 40000000 IRQMASK: 0 GPR00: c0000000089846e8 c000000037d13140 c000000009cc1100 fffffffffffffffc GPR04: 0000000000000001 0000000000000000 0000000000000000 c000000037dc0000 GPR08: 0000000000000000 c000000037dc0000 0000000000000001 00000000fffff7ff GPR12: 0000000000008000 c00000000a049000 c000000037d13d00 000000011134d5a0 GPR16: 0000000000001740 c0080000190d0000 c0080000190d1740 c000000009129288 GPR20: c000000037d13bc0 0000000000000001 c000000037d13bc0 c0080000190b7898 GPR24: c0080000190b7708 0000000000000000 c000000033bb2c48 0000000000000000 GPR28: c000000046b28280 0000000000000000 000000000000010c fffffffffffffffc NIP [c00000000818e9a8] kthread_stop+0x38/0x230 LR [c0000000089846e8] scsi_host_dev_release+0x98/0x160 Call Trace: [c000000033bb2c48] 0xc000000033bb2c48 (unreliable) [c0000000089846e8] scsi_host_dev_release+0x98/0x160 [c00000000891e960] device_release+0x60/0x100 [c0000000087e55c4] kobject_release+0x84/0x210 [c00000000891ec78] put_device+0x28/0x40 [c000000008984ea4] scsi_host_alloc+0x314/0x430 [c0080000190b38bc] ibmvscsi_probe+0x54/0xad0 [ibmvscsi] [c000000008110104] vio_bus_probe+0xa4/0x4b0 [c00000000892a860] really_probe+0x140/0x680 [c00000000892aefc] driver_probe_device+0x15c/0x200 [c00000000892b63c] device_driver_attach+0xcc/0xe0 [c00000000892b740] __driver_attach+0xf0/0x200 [c000000008926f28] bus_for_each_dev+0xa8/0x130 [c000000008929ce4] driver_attach+0x34/0x50 [c000000008928fc0] bus_add_driver+0x1b0/0x300 [c00000000892c798] driver_register+0x98/0x1a0 [c00000000810eb60] __vio_register_driver+0x80/0xe0 [c0080000190b4a30] ibmvscsi_module_init+0x9c/0xdc [ibmvscsi] [c0000000080121d0] do_one_initcall+0x60/0x2d0 [c000000008261abc] do_init_module+0x7c/0x320 [c000000008265700] load_module+0x2350/0x25b0 [c000000008265cb4] __do_sys_finit_module+0xd4/0x160 [c000000008031110] system_call_exception+0x150/0x2d0 [c00000000800d35c] system_call_common+0xec/0x278 Fix this be nulling shost->ehandler when the kthread fails to spawn.
INFO
Published Date :
May 21, 2024, 3:15 p.m.
Last Modified :
Dec. 24, 2024, 4:15 p.m.
Source :
416baaa9-dc9f-4396-8d5f-8c081fb06d67
Remotely Exploitable :
No
Impact Score :
3.6
Exploitability Score :
1.8
References to Advisories, Solutions, and Tools
Here, you will find a curated list of external links that provide in-depth
information, practical solutions, and valuable tools related to
CVE-2021-47337
.
We scan GitHub repositories to detect new proof-of-concept exploits. Following list is a collection of public exploits and proof-of-concepts, which have been published on GitHub (sorted by the most recently updated).
Results are limited to the first 15 repositories due to potential performance issues.
The following list is the news that have been mention
CVE-2021-47337
vulnerability anywhere in the article.
The following table lists the changes that have been made to the
CVE-2021-47337
vulnerability over time.
Vulnerability history details can be useful for understanding the evolution of a vulnerability, and for identifying the most recent changes that may impact the vulnerability's severity, exploitability, or other characteristics.
-
Initial Analysis by [email protected]
Dec. 24, 2024
Action Type Old Value New Value Added CVSS V3.1 NIST AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H Added CWE NIST CWE-476 Added CPE Configuration OR *cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* versions from (including) 4.9.273 up to (excluding) 4.9.276 *cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* versions from (including) 4.14.237 up to (excluding) 4.14.240 *cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* versions from (including) 4.19.195 up to (excluding) 4.19.198 *cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* versions from (including) 5.4.126 up to (excluding) 5.4.134 *cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* versions from (including) 5.10.44 up to (excluding) 5.10.52 *cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* versions from (including) 5.12.11 up to (excluding) 5.12.19 *cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* versions from (including) 5.13 up to (excluding) 5.13.4 *cpe:2.3:o:linux:linux_kernel:5.14:rc1:*:*:*:*:*:* Changed Reference Type https://git.kernel.org/stable/c/887bfae2732b5b02a86a859fd239d34f7ff93c05 No Types Assigned https://git.kernel.org/stable/c/887bfae2732b5b02a86a859fd239d34f7ff93c05 Patch Changed Reference Type https://git.kernel.org/stable/c/887bfae2732b5b02a86a859fd239d34f7ff93c05 No Types Assigned https://git.kernel.org/stable/c/887bfae2732b5b02a86a859fd239d34f7ff93c05 Patch Changed Reference Type https://git.kernel.org/stable/c/8e4212ecf0713dd57d0e3209a66201da582149b1 No Types Assigned https://git.kernel.org/stable/c/8e4212ecf0713dd57d0e3209a66201da582149b1 Patch Changed Reference Type https://git.kernel.org/stable/c/8e4212ecf0713dd57d0e3209a66201da582149b1 No Types Assigned https://git.kernel.org/stable/c/8e4212ecf0713dd57d0e3209a66201da582149b1 Patch Changed Reference Type https://git.kernel.org/stable/c/93aa71ad7379900e61c8adff6a710a4c18c7c99b No Types Assigned https://git.kernel.org/stable/c/93aa71ad7379900e61c8adff6a710a4c18c7c99b Patch Changed Reference Type https://git.kernel.org/stable/c/93aa71ad7379900e61c8adff6a710a4c18c7c99b No Types Assigned https://git.kernel.org/stable/c/93aa71ad7379900e61c8adff6a710a4c18c7c99b Patch Changed Reference Type https://git.kernel.org/stable/c/c1671d2d2ef8a84837eea1b4d99ca0c6a66fb691 No Types Assigned https://git.kernel.org/stable/c/c1671d2d2ef8a84837eea1b4d99ca0c6a66fb691 Patch Changed Reference Type https://git.kernel.org/stable/c/c1671d2d2ef8a84837eea1b4d99ca0c6a66fb691 No Types Assigned https://git.kernel.org/stable/c/c1671d2d2ef8a84837eea1b4d99ca0c6a66fb691 Patch Changed Reference Type https://git.kernel.org/stable/c/d2f0b960d07e52bb664471b4de0ed8b08c636b3a No Types Assigned https://git.kernel.org/stable/c/d2f0b960d07e52bb664471b4de0ed8b08c636b3a Patch Changed Reference Type https://git.kernel.org/stable/c/d2f0b960d07e52bb664471b4de0ed8b08c636b3a No Types Assigned https://git.kernel.org/stable/c/d2f0b960d07e52bb664471b4de0ed8b08c636b3a Patch Changed Reference Type https://git.kernel.org/stable/c/e1bd3fac2baa3d5c04375980c1d5263a3335af92 No Types Assigned https://git.kernel.org/stable/c/e1bd3fac2baa3d5c04375980c1d5263a3335af92 Patch Changed Reference Type https://git.kernel.org/stable/c/e1bd3fac2baa3d5c04375980c1d5263a3335af92 No Types Assigned https://git.kernel.org/stable/c/e1bd3fac2baa3d5c04375980c1d5263a3335af92 Patch Changed Reference Type https://git.kernel.org/stable/c/ea518b70ed5e4598c8d706f37fc16f7b06e440bd No Types Assigned https://git.kernel.org/stable/c/ea518b70ed5e4598c8d706f37fc16f7b06e440bd Patch Changed Reference Type https://git.kernel.org/stable/c/ea518b70ed5e4598c8d706f37fc16f7b06e440bd No Types Assigned https://git.kernel.org/stable/c/ea518b70ed5e4598c8d706f37fc16f7b06e440bd Patch Changed Reference Type https://git.kernel.org/stable/c/f3d0a109240c9bed5c60d819014786be3a2fe515 No Types Assigned https://git.kernel.org/stable/c/f3d0a109240c9bed5c60d819014786be3a2fe515 Patch Changed Reference Type https://git.kernel.org/stable/c/f3d0a109240c9bed5c60d819014786be3a2fe515 No Types Assigned https://git.kernel.org/stable/c/f3d0a109240c9bed5c60d819014786be3a2fe515 Patch -
CVE Modified by af854a3a-2127-422b-91ae-364da2661108
Nov. 21, 2024
Action Type Old Value New Value Added Reference https://git.kernel.org/stable/c/887bfae2732b5b02a86a859fd239d34f7ff93c05 Added Reference https://git.kernel.org/stable/c/8e4212ecf0713dd57d0e3209a66201da582149b1 Added Reference https://git.kernel.org/stable/c/93aa71ad7379900e61c8adff6a710a4c18c7c99b Added Reference https://git.kernel.org/stable/c/c1671d2d2ef8a84837eea1b4d99ca0c6a66fb691 Added Reference https://git.kernel.org/stable/c/d2f0b960d07e52bb664471b4de0ed8b08c636b3a Added Reference https://git.kernel.org/stable/c/e1bd3fac2baa3d5c04375980c1d5263a3335af92 Added Reference https://git.kernel.org/stable/c/ea518b70ed5e4598c8d706f37fc16f7b06e440bd Added Reference https://git.kernel.org/stable/c/f3d0a109240c9bed5c60d819014786be3a2fe515 -
CVE Modified by 416baaa9-dc9f-4396-8d5f-8c081fb06d67
May. 28, 2024
Action Type Old Value New Value -
CVE Received by 416baaa9-dc9f-4396-8d5f-8c081fb06d67
May. 21, 2024
Action Type Old Value New Value Added Description In the Linux kernel, the following vulnerability has been resolved: scsi: core: Fix bad pointer dereference when ehandler kthread is invalid Commit 66a834d09293 ("scsi: core: Fix error handling of scsi_host_alloc()") changed the allocation logic to call put_device() to perform host cleanup with the assumption that IDA removal and stopping the kthread would properly be performed in scsi_host_dev_release(). However, in the unlikely case that the error handler thread fails to spawn, shost->ehandler is set to ERR_PTR(-ENOMEM). The error handler cleanup code in scsi_host_dev_release() will call kthread_stop() if shost->ehandler != NULL which will always be the case whether the kthread was successfully spawned or not. In the case that it failed to spawn this has the nasty side effect of trying to dereference an invalid pointer when kthread_stop() is called. The following splat provides an example of this behavior in the wild: scsi host11: error handler thread failed to spawn, error = -4 Kernel attempted to read user page (10c) - exploit attempt? (uid: 0) BUG: Kernel NULL pointer dereference on read at 0x0000010c Faulting instruction address: 0xc00000000818e9a8 Oops: Kernel access of bad area, sig: 11 [#1] LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries Modules linked in: ibmvscsi(+) scsi_transport_srp dm_multipath dm_mirror dm_region hash dm_log dm_mod fuse overlay squashfs loop CPU: 12 PID: 274 Comm: systemd-udevd Not tainted 5.13.0-rc7 #1 NIP: c00000000818e9a8 LR: c0000000089846e8 CTR: 0000000000007ee8 REGS: c000000037d12ea0 TRAP: 0300 Not tainted (5.13.0-rc7) MSR: 800000000280b033 <SF,VEC,VSX,EE,FP,ME,IR,DR,RI,LE> CR: 28228228 XER: 20040001 CFAR: c0000000089846e4 DAR: 000000000000010c DSISR: 40000000 IRQMASK: 0 GPR00: c0000000089846e8 c000000037d13140 c000000009cc1100 fffffffffffffffc GPR04: 0000000000000001 0000000000000000 0000000000000000 c000000037dc0000 GPR08: 0000000000000000 c000000037dc0000 0000000000000001 00000000fffff7ff GPR12: 0000000000008000 c00000000a049000 c000000037d13d00 000000011134d5a0 GPR16: 0000000000001740 c0080000190d0000 c0080000190d1740 c000000009129288 GPR20: c000000037d13bc0 0000000000000001 c000000037d13bc0 c0080000190b7898 GPR24: c0080000190b7708 0000000000000000 c000000033bb2c48 0000000000000000 GPR28: c000000046b28280 0000000000000000 000000000000010c fffffffffffffffc NIP [c00000000818e9a8] kthread_stop+0x38/0x230 LR [c0000000089846e8] scsi_host_dev_release+0x98/0x160 Call Trace: [c000000033bb2c48] 0xc000000033bb2c48 (unreliable) [c0000000089846e8] scsi_host_dev_release+0x98/0x160 [c00000000891e960] device_release+0x60/0x100 [c0000000087e55c4] kobject_release+0x84/0x210 [c00000000891ec78] put_device+0x28/0x40 [c000000008984ea4] scsi_host_alloc+0x314/0x430 [c0080000190b38bc] ibmvscsi_probe+0x54/0xad0 [ibmvscsi] [c000000008110104] vio_bus_probe+0xa4/0x4b0 [c00000000892a860] really_probe+0x140/0x680 [c00000000892aefc] driver_probe_device+0x15c/0x200 [c00000000892b63c] device_driver_attach+0xcc/0xe0 [c00000000892b740] __driver_attach+0xf0/0x200 [c000000008926f28] bus_for_each_dev+0xa8/0x130 [c000000008929ce4] driver_attach+0x34/0x50 [c000000008928fc0] bus_add_driver+0x1b0/0x300 [c00000000892c798] driver_register+0x98/0x1a0 [c00000000810eb60] __vio_register_driver+0x80/0xe0 [c0080000190b4a30] ibmvscsi_module_init+0x9c/0xdc [ibmvscsi] [c0000000080121d0] do_one_initcall+0x60/0x2d0 [c000000008261abc] do_init_module+0x7c/0x320 [c000000008265700] load_module+0x2350/0x25b0 [c000000008265cb4] __do_sys_finit_module+0xd4/0x160 [c000000008031110] system_call_exception+0x150/0x2d0 [c00000000800d35c] system_call_common+0xec/0x278 Fix this be nulling shost->ehandler when the kthread fails to spawn. Added Reference kernel.org https://git.kernel.org/stable/c/d2f0b960d07e52bb664471b4de0ed8b08c636b3a [No types assigned] Added Reference kernel.org https://git.kernel.org/stable/c/f3d0a109240c9bed5c60d819014786be3a2fe515 [No types assigned] Added Reference kernel.org https://git.kernel.org/stable/c/e1bd3fac2baa3d5c04375980c1d5263a3335af92 [No types assigned] Added Reference kernel.org https://git.kernel.org/stable/c/887bfae2732b5b02a86a859fd239d34f7ff93c05 [No types assigned] Added Reference kernel.org https://git.kernel.org/stable/c/ea518b70ed5e4598c8d706f37fc16f7b06e440bd [No types assigned] Added Reference kernel.org https://git.kernel.org/stable/c/8e4212ecf0713dd57d0e3209a66201da582149b1 [No types assigned] Added Reference kernel.org https://git.kernel.org/stable/c/c1671d2d2ef8a84837eea1b4d99ca0c6a66fb691 [No types assigned] Added Reference kernel.org https://git.kernel.org/stable/c/93aa71ad7379900e61c8adff6a710a4c18c7c99b [No types assigned]
CWE - Common Weakness Enumeration
While CVE identifies
specific instances of vulnerabilities, CWE categorizes the common flaws or
weaknesses that can lead to vulnerabilities. CVE-2021-47337
is
associated with the following CWEs:
Common Attack Pattern Enumeration and Classification (CAPEC)
Common Attack Pattern Enumeration and Classification
(CAPEC)
stores attack patterns, which are descriptions of the common attributes and
approaches employed by adversaries to exploit the CVE-2021-47337
weaknesses.