Lucene search

K
vulnrichmentLinuxVULNRICHMENT:CVE-2024-26981
HistoryMay 01, 2024 - 5:27 a.m.

CVE-2024-26981 nilfs2: fix OOB in nilfs_set_de_type

2024-05-0105:27:06
Linux
github.com
7
linux kernel
nilfs2
oob error
patch
nilfs_set_de_type
array
s_ifmt
s_shift

AI Score

6.5

Confidence

Low

SSVC

Exploitation

none

Automatable

no

Technical Impact

partial

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

nilfs2: fix OOB in nilfs_set_de_type

The size of the nilfs_type_by_mode array in the fs/nilfs2/dir.c file is
defined as “S_IFMT >> S_SHIFT”, but the nilfs_set_de_type() function,
which uses this array, specifies the index to read from the array in the
same way as “(mode & S_IFMT) >> S_SHIFT”.

static void nilfs_set_de_type(struct nilfs_dir_entry *de, struct inode
*inode)
{
umode_t mode = inode->i_mode;

de->file_type = nilfs_type_by_mode[(mode & S_IFMT)>>S_SHIFT]; // oob

}

However, when the index is determined this way, an out-of-bounds (OOB)
error occurs by referring to an index that is 1 larger than the array size
when the condition “mode & S_IFMT == S_IFMT” is satisfied. Therefore, a
patch to resize the nilfs_type_by_mode array should be applied to prevent
OOB errors.

CNA Affected

[
  {
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "vendor": "Linux",
    "product": "Linux",
    "versions": [
      {
        "status": "affected",
        "version": "2ba466d74ed7",
        "lessThan": "054f29e9ca05",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "2ba466d74ed7",
        "lessThan": "90f43980ea6b",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "2ba466d74ed7",
        "lessThan": "7061c7efbb9e",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "2ba466d74ed7",
        "lessThan": "bdbe483da21f",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "2ba466d74ed7",
        "lessThan": "897ac5306bbe",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "2ba466d74ed7",
        "lessThan": "2382eae66b19",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "2ba466d74ed7",
        "lessThan": "90823f8d9ecc",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "2ba466d74ed7",
        "lessThan": "c4a7dc9523b5",
        "versionType": "git"
      }
    ],
    "programFiles": [
      "fs/nilfs2/dir.c"
    ],
    "defaultStatus": "unaffected"
  },
  {
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "vendor": "Linux",
    "product": "Linux",
    "versions": [
      {
        "status": "affected",
        "version": "2.6.30"
      },
      {
        "status": "unaffected",
        "version": "0",
        "lessThan": "2.6.30",
        "versionType": "custom"
      },
      {
        "status": "unaffected",
        "version": "4.19.313",
        "versionType": "custom",
        "lessThanOrEqual": "4.19.*"
      },
      {
        "status": "unaffected",
        "version": "5.4.275",
        "versionType": "custom",
        "lessThanOrEqual": "5.4.*"
      },
      {
        "status": "unaffected",
        "version": "5.10.216",
        "versionType": "custom",
        "lessThanOrEqual": "5.10.*"
      },
      {
        "status": "unaffected",
        "version": "5.15.157",
        "versionType": "custom",
        "lessThanOrEqual": "5.15.*"
      },
      {
        "status": "unaffected",
        "version": "6.1.88",
        "versionType": "custom",
        "lessThanOrEqual": "6.1.*"
      },
      {
        "status": "unaffected",
        "version": "6.6.29",
        "versionType": "custom",
        "lessThanOrEqual": "6.6.*"
      },
      {
        "status": "unaffected",
        "version": "6.8.8",
        "versionType": "custom",
        "lessThanOrEqual": "6.8.*"
      },
      {
        "status": "unaffected",
        "version": "6.9",
        "versionType": "original_commit_for_fix",
        "lessThanOrEqual": "*"
      }
    ],
    "programFiles": [
      "fs/nilfs2/dir.c"
    ],
    "defaultStatus": "affected"
  }
]

AI Score

6.5

Confidence

Low

SSVC

Exploitation

none

Automatable

no

Technical Impact

partial