CyberSecBulletin
CVE-2024-42148NVD status: Modified

Linux: Improper Validation of Array Index

CVE-2024-42148 is a high-severity improper validation of array index vulnerability in Linux, with a CVSS 3.1 base score of 7.8 out of 10. It can be exploited with local access to the system by an attacker with a low-privileged account, without any action from a user. The record lists versions cfb04472ce33bee2579caf4dc9f4242522f6e26e, cbe53087026ad929cd3950508397e8892a6a2a0f, 8b17cec33892a66bbd71f8d9a70a45e2072ae84f as the first without the flaw, so updating Linux to one of those releases or later removes the exposure. There is no confirmed exploitation so far. EPSS estimates a 0.26% chance of exploitation within 30 days, which is low compared with other CVEs.

Next patch cycle

High severity with no evidence of exploitation so far.

What to do

  1. Update Linux to cfb04472ce33bee2579caf4dc9f4242522f6e26e or cbe53087026ad929cd3950508397e8892a6a2a0f or 8b17cec33892a66bbd71f8d9a70a45e2072ae84f or 0edae06b4c227bcfaf3ce21208d49191e1009d3b, whichever matches your release line, or a later version.
  2. Update Linux Kernel to 4.19.318 or 5.4.280 or 5.10.222 or 5.15.163, whichever matches your release line, or a later version.

Affected products and versions

VendorProductAffected versionsFixed in
LinuxLinux50f0a562f8cc9ed9d9f7f7380434c3c8646172d5 up to, but not including, cfb04472ce33bee2579caf4dc9f4242522f6e26e; 50f0a562f8cc9ed9d9f7f7380434c3c8646172d5 up to, but not including, cbe53087026ad929cd3950508397e8892a6a2a0f; 50f0a562f8cc9ed9d9f7f7380434c3c8646172d5 up to, but not including, 8b17cec33892a66bbd71f8d9a70a45e2072ae84f; 50f0a562f8cc9ed9d9f7f7380434c3c8646172d5 up to, but not including, 0edae06b4c227bcfaf3ce21208d49191e1009d3b; 50f0a562f8cc9ed9d9f7f7380434c3c8646172d5 up to, but not including, 9504a1550686f53b0bab4cab31d435383b1ee2ce; 50f0a562f8cc9ed9d9f7f7380434c3c8646172d5 up to, but not including, f1313ea92f82451923e28ab45a4aaa0e70e80b98; 50f0a562f8cc9ed9d9f7f7380434c3c8646172d5 up to, but not including, b9ea38e767459111a511ed4fb74abc37db95a59d; 50f0a562f8cc9ed9d9f7f7380434c3c8646172d5 up to, but not including, 134061163ee5ca4759de5c24ca3bd71608891ba7; and 1 more rangescfb04472ce33bee2579caf4dc9f4242522f6e26e, cbe53087026ad929cd3950508397e8892a6a2a0f, 8b17cec33892a66bbd71f8d9a70a45e2072ae84f, 0edae06b4c227bcfaf3ce21208d49191e1009d3b, 9504a1550686f53b0bab4cab31d435383b1ee2ce, f1313ea92f82451923e28ab45a4aaa0e70e80b98
LinuxLinux Kernel3.3 up to, but not including, 4.19.318; 4.20 up to, but not including, 5.4.280; 5.5 up to, but not including, 5.10.222; 5.11 up to, but not including, 5.15.163; 5.16 up to, but not including, 6.1.98; 6.2 up to, but not including, 6.6.39; 6.7 up to, but not including, 6.9.94.19.318, 5.4.280, 5.10.222, 5.15.163, 6.1.98, 6.6.39

Version data comes from the organisation that assigned the CVE. Confirm against the vendor advisory before deciding you are unaffected.

How the severity score breaks down

Attack vector
LocalThe attacker needs local access or must trick a user into running something.
Attack complexity
LowNo special conditions are needed; the attack works reliably.
Privileges required
LowA basic user account is enough.
User interaction
NoneNo action by a victim is required.
Scope
UnchangedImpact stays within the vulnerable component.
Confidentiality
HighAll data handled by the component can be read.
Integrity
HighData or code can be modified at will.
Availability
HighThe component can be taken down completely.

Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H. Scored by NVD.

Official description

In the Linux kernel, the following vulnerability has been resolved: bnx2x: Fix multiple UBSAN array-index-out-of-bounds Fix UBSAN warnings that occur when using a system with 32 physical cpu cores or more, or when the user defines a number of Ethernet queues greater than or equal to FP_SB_MAX_E1x using the num_queues module parameter. Currently there is a read/write out of bounds that occurs on the array "struct stats_query_entry query" present inside the "bnx2x_fw_stats_req" struct in "drivers/net/ethernet/broadcom/bnx2x/bnx2x.h". Looking at the definition of the "struct stats_query_entry query" array: struct stats_query_entry query[FP_SB_MAX_E1x+ BNX2X_FIRST_QUEUE_QUERY_IDX]; FP_SB_MAX_E1x is defined as the maximum number of fast path interrupts and has a value of 16, while BNX2X_FIRST_QUEUE_QUERY_IDX has a value of 3 meaning the array has a total size of 19. Since accesses to "struct stats_query_entry query" are offset-ted by BNX2X_FIRST_QUEUE_QUERY_IDX, that means that the total number of Ethernet queues should not exceed FP_SB_MAX_E1x (16). However one of these queues is reserved for FCOE and thus the number of Ethernet queues should be set to [FP_SB_MAX_E1x -1] (15) if FCOE is enabled or [FP_SB_MAX_E1x] (16) if it is not. This is also described in a comment in the source code in drivers/net/ethernet/broadcom/bnx2x/bnx2x.h just above the Macro definition of FP_SB_MAX_E1x. Below is the part of this explanation that it important for this patch /* * The total number of L2 queues, MSIX vectors and HW contexts (CIDs) is * control by the number of fast-path status blocks supported by the * device (HW/FW). Each fast-path status block (FP-SB) aka non-default * status block represents an independent interrupts context that can * serve a regular L2 networking queue. However special L2 queues such * as the FCoE queue do not require a FP-SB and other components like * the CNIC may consume FP-SB reducing the number of possible L2 queues * * If the maximum number of FP-SB available is X then: * a. If CNIC is supported it consumes 1 FP-SB thus the max number of * regular L2 queues is Y=X-1 * b. In MF mode the actual number of L2 queues is Y= (X-1/MF_factor) * c. If the FCoE L2 queue is supported the actual number of L2 queues * is Y+1 * d. The number of irqs (MSIX vectors) is either Y+1 (one extra for * slow-path interrupts) or Y+2 if CNIC is supported (one additional * FP interrupt context for the CNIC). * e. The number of HW context (CID count) is always X or X+1 if FCoE * L2 queue is supported. The cid for the FCoE L2 queue is always X. */ However this driver also supports NICs that use the E2 controller which can handle more queues due to having more FP-SB represented by FP_SB_MAX_E2. Looking at the commits when the E2 support was added, it was originally using the E1x parameters: commit f2e0899f0f27 ("bnx2x: Add 57712 support"). Back then FP_SB_MAX_E2 was set to 16 the same as E1x. However the driver was later updated to take full advantage of the E2 instead of having it be limited to the capabilities of the E1x. But as far as we can tell, the array "stats_query_entry query" was still limited to using the FP-SB available to the E1x cards as part of an oversignt when the driver was updated to take full advantage of the E2, and now with the driver being aware of the greater queue size supported by E2 NICs, it causes the UBSAN warnings seen in the stack traces below. This patch increases the size of the "stats_query_entry query" array by replacing FP_SB_MAX_E1x with FP_SB_MAX_E2 to be large enough to handle both types of NICs. Stack traces: UBSAN: array-index-out-of-bounds in drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c:1529:11 index 20 is out of range for type 'stats_query_entry [19]' CPU: 12 PID: 858 Comm: systemd-network Not tainted 6.9.0-060900rc7-generic #202405052133 Hardware name: HP ProLiant DL360 Gen9/ProLiant DL360 ---truncated---

Source: the CVE record as published by its numbering authority, via NVD and CVE.org.

The underlying weakness: Improper Validation of Array Index

The product uses untrusted input when calculating or using an array index, but the product does not validate or incorrectly validates the index to ensure the index references a valid position within the array.

How developers prevent this class of flaw

  • Use an input validation framework such as Struts or the OWASP ESAPI Validation API. Note that using a framework does not automatically address all input validation problems; be mindful of weaknesses that could arise from misusing the framework itself (CWE-1173).
  • Use a language that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid. For example, Ada allows the programmer to constrain the values of a variable and languages such as Java and Ruby will allow the programmer to handle exceptions when an out-of-bounds index is accessed.
  • Use a CPU and operating system that offers Data Execution Protection (using hardware NX or XD bits) or the equivalent techniques that simulate this feature in software, such as PaX. These techniques ensure that any instruction executed is exclusively at a memory address that is part of the code segment. For more information on these techniques see D3-PSEP (Process Segment Execution Prevention) from D3FEND.

More Improper Validation of Array Index vulnerabilities (CWE-129)

Timeline

  1. CVE record published.
  2. CISA published its SSVC assessment (exploitation: none, automatable: no, technical impact: partial).
  3. Record last changed materially (score, affected products, status or references).

References

Recent Improper Validation of Array Index vulnerabilities

Spotted an error? Tell us.