7.8 CVE-2024-40902

Enriched by CISA Buffer Overflow Patch
 

In the Linux kernel, the following vulnerability has been resolved: jfs: xattr: fix buffer overflow for invalid xattr When an xattr size is not what is expected, it is printed out to the kernel log in hex format as a form of debugging. But when that xattr size is bigger than the expected size, printing it out can cause an access off the end of the buffer. Fix this all up by properly restricting the size of the debug hex dump in the kernel log.
https://nvd.nist.gov/vuln/detail/CVE-2024-40902

Categories

CWE-120 : Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')
The product copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer. This term was frequently used by vulnerability researchers during approximately 1995 to 2005 to differentiate buffer copies without length checks (which had been known about for decades) from other emerging weaknesses that still involved invalid accesses of buffers, as vulnerability researchers began to develop advanced exploitation techniques. This weakness can be detected using dynamic tools and techniques that interact with the software using large test suites with many diverse inputs, such as fuzz testing (fuzzing), robustness testing, and fault injection. The software's operation may slow down, but it should not become unstable, crash, or generate incorrect results. Manual analysis can be useful for finding this weakness, but it might not achieve desired code coverage within limited time constraints. This becomes difficult for weaknesses that must be considered for all inputs, since the attack surface can be too large. Use tools that are integrated duringcompilation to insert runtime error-checking mechanismsrelated to memory safety errors, such as AddressSanitizer(ASan) for C/C++ [REF-1518]. For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side, in order to avoid CWE-602. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server. Most mitigating technologies at the compiler or OS level to date address only a subset of buffer overflow problems and rarely provide complete protection against even that subset. It is good practice to implement strategies to increase the workload of an attacker, such as leaving the attacker to guess an unknown value that changes every program execution. Replace unbounded copy functions with analogous functions that support length arguments, such as strcpy with strncpy. Create these if they are not available. When the set of acceptable objects, such as filenames or URLs, is limited or known, create a mapping from a set of fixed input values (such as numeric IDs) to the actual filenames or URLs, and reject all other inputs. Run your code using the lowest privileges that are required to accomplish the necessary tasks [REF-76]. If possible, create isolated accounts with limited privileges that are only used for a single task. That way, a successful attack will not immediately give the attacker access to the rest of the software or its environment. For example, database applications rarely need to run as the database administrator, especially in day-to-day operations. buffer overflow using command with long argument buffer overflow in local program using long environment variable buffer overflow in comment characters, when product increments a counter for a ">" but does not decrement for "<" By replacing a valid cookie value with an extremely long string of characters, an attacker may overflow the application's buffers. By replacing a valid cookie value with an extremely long string of characters, an attacker may overflow the application's buffers.

CWE-121 : Stack-based Buffer Overflow
A stack-based buffer overflow condition is a condition where the buffer being overwritten is allocated on the stack (i.e., is a local variable or, rarely, a parameter to a function). "Stack Overflow" is often used to mean the same thing as stack-based buffer overflow, however it is also used on occasion to mean stack exhaustion, usually a result from an excessively recursive function call. Due to the ambiguity of the term, use of stack overflow to describe either circumstance is discouraged. Fuzz testing (fuzzing) is a powerful technique for generating large numbers of diverse inputs - either randomly or algorithmically - and dynamically invoking the code with those inputs. Even with random inputs, it is often capable of generating unexpected results such as crashes, memory corruption, or resource consumption. Fuzzing effectively produces repeatable test cases that clearly indicate bugs, which helps developers to diagnose the issues. Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.) Use tools that are integrated duringcompilation to insert runtime error-checking mechanismsrelated to memory safety errors, such as AddressSanitizer(ASan) for C/C++ [REF-1518]. Use an abstraction library to abstract away risky APIs. Not a complete solution. Implement and perform bounds checking on input. Do not use dangerous functions such as gets. Use safer, equivalent functions which check for boundary errors. Stack-based buffer overflows in SFK for wifi chipset used for IoT/embedded devices, as exploited in the wild per CISA KEV.

References


 

AFFECTED (from MITRE)


Vendor Product Versions
Linux Linux
  • 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 < f0dedb5c511ed82cbaff4997a8decf2351ba549f [affected]
  • 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 < 1e84c9b1838152a87cf453270a5fa75c5037e83a [affected]
  • 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 < fc745f6e83cb650f9a5f2c864158e3a5ea76dad0 [affected]
  • 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 < 480e5bc21f2c42d90c2c16045d64d824dcdd5ec7 [affected]
  • 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 < 33aecc5799c93d3ee02f853cb94e201f9731f123 [affected]
  • 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 < 4598233d9748fe4db4e13b9f473588aa25e87d69 [affected]
  • 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 < b537cb2f4c4a1357479716a9c339c0bda03d873f [affected]
  • 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 < 7c55b78818cfb732680c4a72ab270cc2d2ee3d0f [affected]
Linux Linux
  • 2.6.12 [affected]
  • < 2.6.12 [unaffected]
  • 4.19.317 ≤ 4.19.* [unaffected]
  • 5.4.279 ≤ 5.4.* [unaffected]
  • 5.10.221 ≤ 5.10.* [unaffected]
  • 5.15.162 ≤ 5.15.* [unaffected]
  • 6.1.95 ≤ 6.1.* [unaffected]
  • 6.6.35 ≤ 6.6.* [unaffected]
  • 6.9.6 ≤ 6.9.* [unaffected]
  • 6.10 ≤ * [unaffected]
© 2022 The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation.

CPE

cpe start end
Configuration 1
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* < 4.19.317
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* >= 4.20 < 5.4.279
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* >= 5.5 < 5.10.221
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* >= 5.11 < 5.15.162
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* >= 5.16 < 6.1.95
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* >= 6.2 < 6.6.35
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* >= 6.7 < 6.9.6
cpe:2.3:o:linux:linux_kernel:6.10:rc1:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.10:rc2:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.10:rc3:*:*:*:*:*:*


REMEDIATION


Patch

Url
https://git.kernel.org/stable/c/1e84c9b1838152a87cf453270a5fa75c5037e83a
https://git.kernel.org/stable/c/33aecc5799c93d3ee02f853cb94e201f9731f123
https://git.kernel.org/stable/c/4598233d9748fe4db4e13b9f473588aa25e87d69
https://git.kernel.org/stable/c/480e5bc21f2c42d90c2c16045d64d824dcdd5ec7
https://git.kernel.org/stable/c/7c55b78818cfb732680c4a72ab270cc2d2ee3d0f
https://git.kernel.org/stable/c/b537cb2f4c4a1357479716a9c339c0bda03d873f
https://git.kernel.org/stable/c/f0dedb5c511ed82cbaff4997a8decf2351ba549f
https://git.kernel.org/stable/c/fc745f6e83cb650f9a5f2c864158e3a5ea76dad0
https://git.kernel.org/stable/c/1e84c9b1838152a87cf453270a5fa75c5037e83a
https://git.kernel.org/stable/c/33aecc5799c93d3ee02f853cb94e201f9731f123
https://git.kernel.org/stable/c/4598233d9748fe4db4e13b9f473588aa25e87d69
https://git.kernel.org/stable/c/480e5bc21f2c42d90c2c16045d64d824dcdd5ec7
https://git.kernel.org/stable/c/7c55b78818cfb732680c4a72ab270cc2d2ee3d0f
https://git.kernel.org/stable/c/b537cb2f4c4a1357479716a9c339c0bda03d873f
https://git.kernel.org/stable/c/f0dedb5c511ed82cbaff4997a8decf2351ba549f
https://git.kernel.org/stable/c/fc745f6e83cb650f9a5f2c864158e3a5ea76dad0


EXPLOITS


Exploit-db.com

id description date
No known exploits

POC Github

Url
No known exploits

Other Nist (github, ...)

Url
No known exploits


CAPEC


Common Attack Pattern Enumerations and Classifications

id description severity
10 Buffer Overflow via Environment Variables
High
100 Overflow Buffers
Very High
14 Client-side Injection-induced Buffer Overflow
High
24 Filter Failure through Buffer Overflow
High
42 MIME Conversion
High
44 Overflow Binary Resource File
Very High
45 Buffer Overflow via Symbolic Links
High
46 Overflow Variables and Tags
High
47 Buffer Overflow via Parameter Expansion
High
67 String Format Overflow in syslog()
Very High
8 Buffer Overflow in an API Call
High
9 Buffer Overflow in Local Command-Line Utilities
High
92 Forced Integer Overflow
High