CVE-2022-24448 - Missing Initialization of Resource

Severity

32%

Complexity

18%

Confidentiality

23%

An issue was discovered in fs/nfs/dir.c in the Linux kernel before 5.16.5. If an application sets the O_DIRECTORY flag, and tries to open a regular file, nfs_atomic_open() performs a regular lookup. If a regular file is found, ENOTDIR should occur, but the server instead returns uninitialized data in the file descriptor.

CVSS 3.1 Base Score 3.3. CVSS Attack Vector: local. CVSS Attack Complexity: low. CVSS Vector: (CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N).

CVSS 2.0 Base Score 1.9. CVSS Attack Vector: local. CVSS Attack Complexity: medium. CVSS Vector: (AV:L/AC:M/Au:N/C:P/I:N/A:N).

Demo Examples

Missing Initialization of Resource

CWE-909

Here, a boolean initiailized field is consulted to ensure that initialization tasks are only completed once. However, the field is mistakenly set to true during static initialization, so the initialization code is never reached.


               
}
initialized = true;// perform initialization tasks

Missing Initialization of Resource

CWE-909

The following code intends to limit certain operations to the administrator only.


               
}
$uid = ExtractUserID($state);
# do stuff
DoAdminThings();

If the application is unable to extract the state information - say, due to a database timeout - then the $uid variable will not be explicitly set by the programmer. This will cause $uid to be regarded as equivalent to "0" in the conditional, allowing the original user to perform administrator actions. Even if the attacker cannot directly influence the state data, unexpected errors could cause incorrect privileges to be assigned to a user just by accident.

Missing Initialization of Resource

CWE-909

The following code intends to concatenate a string to a variable and print the string.


               
printf("%s", str);

This might seem innocent enough, but str was not initialized, so it contains random memory. As a result, str[0] might not contain the null terminator, so the copy might start at an offset other than 0. The consequences can vary, depending on the underlying memory.

If a null terminator is found before str[8], then some bytes of random garbage will be printed before the "hello world" string. The memory might contain sensitive information from previous uses, such as a password (which might occur as a result of CWE-14 or CWE-244). In this example, it might not be a big deal, but consider what could happen if large amounts of memory are printed out before the null terminator is found.

If a null terminator isn't found before str[8], then a buffer overflow could occur, since strcat will first look for the null terminator, then copy 12 bytes starting with that location. Alternately, a buffer over-read might occur (CWE-126) if a null terminator isn't found before the end of the memory segment is reached, leading to a segmentation fault and crash.

Overview

Type

Linux

First reported 3 years ago

2022-02-04 20:15:00

Last updated 3 years ago

2022-05-12 20:03:00

Affected Software

Linux Kernel

Debian Linux 9.0

9.0

References

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=ac795161c93699d600db16c1a8cc23a65a1eceaf

https://www.spinics.net/lists/stable/msg531976.html

https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.16.5

https://github.com/torvalds/linux/commit/ac795161c93699d600db16c1a8cc23a65a1eceaf

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=ac795161c93699d600db16c1a8cc23a65a1eceaf

Mailing List, Patch, Vendor Advisory

https://www.spinics.net/lists/stable/msg531976.html

Mailing List, Patch, Third Party Advisory

https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.16.5

Mailing List, Patch, Release Notes, Vendor Advisory

https://github.com/torvalds/linux/commit/ac795161c93699d600db16c1a8cc23a65a1eceaf

Patch, Third Party Advisory

DSA-5096

[debian-lts-announce] 20220309 [SECURITY] [DLA 2941-1] linux-4.19 security update

[debian-lts-announce] 20220309 [SECURITY] [DLA 2940-1] linux security update

DSA-5092

DSA-5096

Third Party Advisory

[debian-lts-announce] 20220309 [SECURITY] [DLA 2941-1] linux-4.19 security update

Mailing List, Third Party Advisory

[debian-lts-announce] 20220309 [SECURITY] [DLA 2940-1] linux security update

Mailing List, Third Party Advisory

DSA-5092

Third Party Advisory

https://github.com/torvalds/linux/commit/ab0fc21bc7105b54bafd85bd8b82742f9e68898a

https://lore.kernel.org/all/[email protected]/T/

https://github.com/torvalds/linux/commit/ab0fc21bc7105b54bafd85bd8b82742f9e68898a

Patch, Third Party Advisory

https://lore.kernel.org/all/[email protected]/T/

Issue Tracking, Mailing List, Vendor Advisory

Stay updated

ExploitPedia is constantly evolving. Sign up to receive a notification when we release additional functionality.

Get in touch

If you'd like to report a bug or have any suggestions for improvements then please do get in touch with us using this form. We will get back to you as soon as we can.