Lucene search

K
cveLinuxCVE-2024-42105
HistoryJul 30, 2024 - 8:15 a.m.

CVE-2024-42105

2024-07-3008:15:03
Linux
web.nvd.nist.gov
35
linux kernel
nullfs2
inode number
range checks
vulnerability
patch series
use-after-free issue
super block
reserved inodes
metadata files
bit-shift calculations
c specification
type casting

AI Score

6.7

Confidence

High

EPSS

0

Percentile

13.5%

In the Linux kernel, the following vulnerability has been resolved:

nilfs2: fix inode number range checks

Patch series “nilfs2: fix potential issues related to reserved inodes”.

This series fixes one use-after-free issue reported by syzbot, caused by
nilfs2’s internal inode being exposed in the namespace on a corrupted
filesystem, and a couple of flaws that cause problems if the starting
number of non-reserved inodes written in the on-disk super block is
intentionally (or corruptly) changed from its default value.

This patch (of 3):

In the current implementation of nilfs2, “nilfs->ns_first_ino”, which
gives the first non-reserved inode number, is read from the superblock,
but its lower limit is not checked.

As a result, if a number that overlaps with the inode number range of
reserved inodes such as the root directory or metadata files is set in the
super block parameter, the inode number test macros (NILFS_MDT_INODE and
NILFS_VALID_INODE) will not function properly.

In addition, these test macros use left bit-shift calculations using with
the inode number as the shift count via the BIT macro, but the result of a
shift calculation that exceeds the bit width of an integer is undefined in
the C specification, so if “ns_first_ino” is set to a large value other
than the default value NILFS_USER_INO (=11), the macros may potentially
malfunction depending on the environment.

Fix these issues by checking the lower bound of “nilfs->ns_first_ino” and
by preventing bit shifts equal to or greater than the NILFS_USER_INO
constant in the inode number test macros.

Also, change the type of “ns_first_ino” from signed integer to unsigned
integer to avoid the need for type casting in comparisons such as the
lower bound check introduced this time.

Affected configurations

Vulners
Node
linuxlinux_kernelRange4.19.04.19.318
OR
linuxlinux_kernelRange4.20.05.4.280
OR
linuxlinux_kernelRange5.5.05.10.222
OR
linuxlinux_kernelRange5.11.05.15.163
OR
linuxlinux_kernelRange5.16.06.1.98
OR
linuxlinux_kernelRange6.2.06.6.39
OR
linuxlinux_kernelRange6.7.06.9.9
OR
linuxlinux_kernelRange6.10.0
VendorProductVersionCPE
linuxlinux_kernel*cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*

CNA Affected

[
  {
    "product": "Linux",
    "vendor": "Linux",
    "defaultStatus": "unaffected",
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "programFiles": [
      "fs/nilfs2/nilfs.h",
      "fs/nilfs2/the_nilfs.c",
      "fs/nilfs2/the_nilfs.h"
    ],
    "versions": [
      {
        "version": "1da177e4c3f4",
        "lessThan": "57235c3c88bb",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "1da177e4c3f4",
        "lessThan": "08cab183a624",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "1da177e4c3f4",
        "lessThan": "731011ac6c37",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "1da177e4c3f4",
        "lessThan": "3be4dcc8d7be",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "1da177e4c3f4",
        "lessThan": "fae1959d6ab2",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "1da177e4c3f4",
        "lessThan": "9194f8ca5752",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "1da177e4c3f4",
        "lessThan": "1c91058425a0",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "1da177e4c3f4",
        "lessThan": "e2fec219a36e",
        "status": "affected",
        "versionType": "git"
      }
    ]
  },
  {
    "product": "Linux",
    "vendor": "Linux",
    "defaultStatus": "affected",
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "programFiles": [
      "fs/nilfs2/nilfs.h",
      "fs/nilfs2/the_nilfs.c",
      "fs/nilfs2/the_nilfs.h"
    ],
    "versions": [
      {
        "version": "4.19.318",
        "lessThanOrEqual": "4.19.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "5.4.280",
        "lessThanOrEqual": "5.4.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "5.10.222",
        "lessThanOrEqual": "5.10.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "5.15.163",
        "lessThanOrEqual": "5.15.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "6.1.98",
        "lessThanOrEqual": "6.1.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "6.6.39",
        "lessThanOrEqual": "6.6.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "6.9.9",
        "lessThanOrEqual": "6.9.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "6.10",
        "lessThanOrEqual": "*",
        "status": "unaffected",
        "versionType": "original_commit_for_fix"
      }
    ]
  }
]