Lucene search

K
cveLinuxCVE-2022-48822
HistoryJul 16, 2024 - 12:15 p.m.

CVE-2022-48822

2024-07-1612:15:06
CWE-416
Linux
web.nvd.nist.gov
32
linux kernel
usb
f_fs
use-after-free
vulnerability
resolved
fix
race
epfiles
spinlock
concurrent accesses
cve-2022-48822

CVSS3

7.8

Attack Vector

LOCAL

Attack Complexity

LOW

Privileges Required

LOW

User Interaction

NONE

Scope

UNCHANGED

Confidentiality Impact

HIGH

Integrity Impact

HIGH

Availability Impact

HIGH

CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

AI Score

6.6

Confidence

Low

EPSS

0

Percentile

5.0%

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

usb: f_fs: Fix use-after-free for epfile

Consider a case where ffs_func_eps_disable is called from
ffs_func_disable as part of composition switch and at the
same time ffs_epfile_release get called from userspace.
ffs_epfile_release will free up the read buffer and call
ffs_data_closed which in turn destroys ffs->epfiles and
mark it as NULL. While this was happening the driver has
already initialized the local epfile in ffs_func_eps_disable
which is now freed and waiting to acquire the spinlock. Once
spinlock is acquired the driver proceeds with the stale value
of epfile and tries to free the already freed read buffer
causing use-after-free.

Following is the illustration of the race:

  CPU1                                  CPU2

ffs_func_eps_disable
epfiles (local copy)
ffs_epfile_release
ffs_data_closed
if (last file closed)
ffs_data_reset
ffs_data_clear
ffs_epfiles_destroy
spin_lock
dereference epfiles

Fix this races by taking epfiles local copy & assigning it under
spinlock and if epfiles(local) is null then update it in ffs->epfiles
then finally destroy it.
Extending the scope further from the race, protecting the ep related
structures, and concurrent accesses.

Affected configurations

Nvd
Vulners
Node
linuxlinux_kernelRange4.94.14.267
OR
linuxlinux_kernelRange4.154.19.230
OR
linuxlinux_kernelRange4.205.4.180
OR
linuxlinux_kernelRange5.55.10.101
OR
linuxlinux_kernelRange5.115.15.24
OR
linuxlinux_kernelRange5.165.16.10
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": [
      "drivers/usb/gadget/function/f_fs.c"
    ],
    "versions": [
      {
        "version": "a9e6f83c2df1",
        "lessThan": "32048f4be071",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "a9e6f83c2df1",
        "lessThan": "cfe5f6fd335d",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "a9e6f83c2df1",
        "lessThan": "c9fc422c9a43",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "a9e6f83c2df1",
        "lessThan": "0042178a69eb",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "a9e6f83c2df1",
        "lessThan": "72a8aee863af",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "a9e6f83c2df1",
        "lessThan": "3e078b187536",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "a9e6f83c2df1",
        "lessThan": "ebe2b1add105",
        "status": "affected",
        "versionType": "git"
      }
    ]
  },
  {
    "product": "Linux",
    "vendor": "Linux",
    "defaultStatus": "affected",
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "programFiles": [
      "drivers/usb/gadget/function/f_fs.c"
    ],
    "versions": [
      {
        "version": "4.9",
        "status": "affected"
      },
      {
        "version": "0",
        "lessThan": "4.9",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "4.14.267",
        "lessThanOrEqual": "4.14.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "4.19.230",
        "lessThanOrEqual": "4.19.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "5.4.180",
        "lessThanOrEqual": "5.4.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "5.10.101",
        "lessThanOrEqual": "5.10.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "5.15.24",
        "lessThanOrEqual": "5.15.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "5.16.10",
        "lessThanOrEqual": "5.16.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "5.17",
        "lessThanOrEqual": "*",
        "status": "unaffected",
        "versionType": "original_commit_for_fix"
      }
    ]
  }
]

CVSS3

7.8

Attack Vector

LOCAL

Attack Complexity

LOW

Privileges Required

LOW

User Interaction

NONE

Scope

UNCHANGED

Confidentiality Impact

HIGH

Integrity Impact

HIGH

Availability Impact

HIGH

CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

AI Score

6.6

Confidence

Low

EPSS

0

Percentile

5.0%