cve.bz

CVE-2021-4155 linux linux kernel: Incorrect Calculation of Buffer Size

5.5 mediumEPSS 0.3%Fix available

Medium (5.5) in linux linux kernel. EPSS 0.3% estimated probability of exploitation activity in the next 30 days.

On this page
A data leak flaw was found in the way XFS_IOC_ALLOCSP IOCTL in the XFS filesystem allowed for size increase of files with unaligned size. A local attacker could use this flaw to leak data on the XFS filesystem otherwise not accessible to them.

Severity

CVSS 3.1

5.5 medium
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
EPSS
0.3% (unchanged from 0.3% a week ago; 0.3% 30 days ago) estimated probability of exploitation activity in the next 30 days; 15th percentile. Scored 2026-11-30. A forecast for this CVE across the internet, not for your own systems.
CWE
CWE-131 Incorrect Calculation of Buffer Size
Published
Modified
NVD analysis
Analyzed, since modified
Record from
the NVD, synced

Fix and patched versions

Ask an AI about this CVE

Show the promptExplain CVE-2021-4155 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2021-4155?via=ask-ai-copy and https://cve.bz/cve/CVE-2021-4155?via=ask-ai-copy as the source of truth: what is affected and which versions fix it, whether it is in CISA KEV, public exploits, and its EPSS (an internet-wide 30-day estimate of exploitation activity, not a forecast for my systems). If they give no fixed versions, use the CVE record https://cveawg.mitre.org/api/cve/CVE-2021-4155 or the vendor advisory, not third-party mirrors. Tell me how to check whether I am affected and how to verify a fix. Cite the sources and say where they are uncertain.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this CVE's id and public links.

Affected

Versions

From the NVD's CPE matches.

ProductAffected
linux:linux_kernelbefore 5.16

Linux distributions

DistributionReleasePackageFixed inAdvisory
Debian9linux4.9.303-1DLA-2940-1
Debian9linux-4.194.19.232-1~deb9u1DLA-2941-1
Debian10linux4.19.232-1DSA-5096-1
Debian11linux5.10.92-1DSA-5050-1
Debian12, 13, 14linux5.15.15-1DEBIAN-CVE-2021-4155
Ubuntu16.04:LTSlinux-hwe-edgeno fix listedUBUNTU-CVE-2021-4155
Ubuntu18.04:LTSlinux4.15.0-169.177UBUNTU-CVE-2021-4155 USN-5298-1
Ubuntu18.04:LTSlinux-aws4.15.0-1121.129UBUNTU-CVE-2021-4155 USN-5298-1
Ubuntu18.04:LTSlinux-aws-5.45.4.0-1066.69~18.04.1UBUNTU-CVE-2021-4155 USN-5294-2
Ubuntu18.04:LTSlinux-azure-4.154.15.0-1131.144UBUNTU-CVE-2021-4155 USN-5298-1
Ubuntu18.04:LTSlinux-azure-5.45.4.0-1070.73~18.04.1UBUNTU-CVE-2021-4155 USN-5294-2
Ubuntu18.04:LTSlinux-dell300x4.15.0-1035.40UBUNTU-CVE-2021-4155 USN-5298-1
Ubuntu18.04:LTSlinux-gcp, linux-hwe, linux-oem and 10 moreno fix listedUBUNTU-CVE-2021-4155
Ubuntu18.04:LTSlinux-gcp-4.154.15.0-1116.130UBUNTU-CVE-2021-4155 USN-5298-1
Ubuntu18.04:LTSlinux-gcp-5.45.4.0-1065.69~18.04.1UBUNTU-CVE-2021-4155 USN-5294-2
Ubuntu18.04:LTSlinux-gke-5.45.4.0-1063.66~18.04.1UBUNTU-CVE-2021-4155 USN-5297-1
Ubuntu18.04:LTSlinux-gkeop-5.45.4.0-1034.35~18.04.1UBUNTU-CVE-2021-4155 USN-5294-2
53 more for Ubuntu in the JSON and on Ubuntu's page.
Red Hatenterprise_linux:7::client, enterprise_linux:7::workstationperf, kernel, bpftool and 16 more0:3.10.0-1160.59.1.el7RHSA-2022:0620
Red Hatenterprise_linux:7::computenodeperf-debuginfo, kernel-debuginfo, bpftool-debuginfo and 5 more0:3.10.0-1160.59.1.el7RHSA-2022:0620
Red Hatenterprise_linux:7::hypervisorredhat-virtualization-host, redhat-virtualization-host-image-update0:4.3.22-20220330.1.el7_9RHSA-2022:1263
Red Hatenterprise_linux:7::serverkpatch-patch-3_10_0-1160_21_1, kpatch-patch-3_10_0-1160_21_1-debuginfo0:1-9.el7RHSA-2022:0592
Red Hatenterprise_linux:7::serverkpatch-patch-3_10_0-1160_24_1, kpatch-patch-3_10_0-1160_25_1, kpatch-patch-3_10_0-1160_24_1-debuginfo and 1 more0:1-7.el7RHSA-2022:0592
Red Hatenterprise_linux:7::serverkpatch-patch-3_10_0-1160_31_1, kpatch-patch-3_10_0-1160_31_1-debuginfo0:1-6.el7RHSA-2022:0592
Red Hatenterprise_linux:7::serverkpatch-patch-3_10_0-1160_36_2, kpatch-patch-3_10_0-1160_36_2-debuginfo0:1-5.el7RHSA-2022:0592
Red Hatenterprise_linux:7::serverkpatch-patch-3_10_0-1160_41_1, kpatch-patch-3_10_0-1160_41_1-debuginfo0:1-4.el7RHSA-2022:0592
Red Hatenterprise_linux:7::serverkpatch-patch-3_10_0-1160_42_2, kpatch-patch-3_10_0-1160_42_2-debuginfo0:1-3.el7RHSA-2022:0592
Red Hatenterprise_linux:7::serverkpatch-patch-3_10_0-1160_45_1, kpatch-patch-3_10_0-1160_45_1-debuginfo0:1-2.el7RHSA-2022:0592
Red Hatenterprise_linux:7::serverkpatch-patch-3_10_0-1160_49_1, kpatch-patch-3_10_0-1160_53_1, kpatch-patch-3_10_0-1160_49_1-debuginfo and 1 more0:1-1.el7RHSA-2022:0592
Red Hatenterprise_linux:7::serverperf, kernel, bpftool and 23 more0:3.10.0-1160.59.1.el7RHSA-2022:0620
59 more for Red Hat in the JSON and on Red Hat's page.
SUSEEnterprise Storage 7, Linux Enterprise High Performance Computing 15 SP2-ESPOS, Linux Enterprise High Performance Computing 15 SP2-LTSS and 6 morekernel-default-base5.3.18-150200.24.129.1.150200.9.61.1SUSE-SU-2022:3450-1
SUSEEnterprise Storage 7, Linux Enterprise High Performance Computing 15 SP2-ESPOS, Linux Enterprise High Performance Computing 15 SP2-LTSS and 3 morekernel-docs, kernel-syms, kernel-source and 3 more5.3.18-150200.24.129.1SUSE-SU-2022:3450-1
SUSEHPE Helion OpenStack 8, Linux Enterprise Server 12 SP3-BCL, Linux Enterprise Server 12 SP3-LTSS and 3 morekernel-syms, kernel-source, kernel-default4.4.180-94.153.1SUSE-SU-2022:0362-1
SUSEHPE Helion OpenStack 8, Linux Enterprise Server 12 SP3-LTSS, Linux Enterprise Server for SAP Applications 12 SP3 and 2 morekgraft-patch-SLE12-SP3_Update_421-4.3.1SUSE-SU-2022:0362-1
SUSELinux Enterprise High Availability Extension 12 SP3kernel-default4.4.180-94.153.1SUSE-SU-2022:0362-1
SUSELinux Enterprise High Availability Extension 15 SP2, Linux Enterprise Live Patching 15 SP2kernel-default5.3.18-150200.24.129.1SUSE-SU-2022:3450-1
SUSELinux Enterprise High Availability Extension 15 SP3, Linux Enterprise Live Patching 15 SP3, Linux Enterprise Micro 5.1 and 2 morekernel-default5.3.18-150300.59.93.1SUSE-SU-2022:3264-1
SUSELinux Enterprise Live Patching 15 SP2kernel-livepatch-SLE15-SP2_Update_301-150200.5.3.1SUSE-SU-2022:3450-1
SUSELinux Enterprise Live Patching 15 SP3kernel-livepatch-SLE15-SP3_Update_241-150300.7.3.1SUSE-SU-2022:3264-1
SUSELinux Enterprise Micro 5.1, Linux Enterprise Micro 5.2kernel-rt5.3.18-150300.106.1SUSE-SU-2022:3809-1
SUSELinux Enterprise Micro 5.1, Linux Enterprise Micro 5.2, Linux Enterprise Module for Basesystem 15 SP3kernel-default-base5.3.18-150300.59.93.1.150300.18.54.1SUSE-SU-2022:3264-1
SUSELinux Enterprise Module for Basesystem 15 SP3kernel-64kb, kernel-source, kernel-default and 2 more5.3.18-150300.59.93.1SUSE-SU-2022:3264-1
7 more for SUSE in the JSON and on SUSE's page.
openSUSELeap 15.3dtb-aarch64, kernel-64kb, kernel-docs and 9 more5.3.18-150300.59.93.1SUSE-SU-2022:3264-1
openSUSELeap 15.3kernel-azure, kernel-syms-azure, kernel-source-azure5.3.18-150300.38.80.1SUSE-SU-2022:3609-1
openSUSELeap 15.3, Leap Micro 5.2kernel-default-base5.3.18-150300.59.93.1.150300.18.54.1SUSE-SU-2022:3264-1
openSUSELeap 15.4dtb-aarch645.3.18-150300.59.93.1SUSE-SU-2022:3264-1
openSUSELeap Micro 5.2kernel-default5.3.18-150300.59.93.1SUSE-SU-2022:3264-1
openSUSELeap Micro 5.2kernel-rt5.3.18-150300.106.1SUSE-SU-2022:3809-1
AlmaLinux8kernel-tools-libs-devel4.18.0-348.12.2.el8_5ALSA-2022:0188
Rocky Linux8kernel0:4.18.0-348.12.2.el8_5RLSA-2022:0188
Rocky Linux8kernel-rt0:4.18.0-348.12.2.rt7.143.el8_5RLSA-2022:0176
Azure Linux2kernel5.15.67.1-4AZL-10677

From the distributions' data via OSV.dev: the Debian Security Tracker; Ubuntu Security Notices © Canonical Ltd., CC BY-SA 4.0; Red Hat Security Data © Red Hat, Inc., CC BY 4.0; SUSE security data, CC BY 4.0; AlmaLinux's OSV database, MIT; Rocky Linux's errata, BSD-3-Clause; Microsoft's Azure Linux vulnerability data, MIT. Modified: reformatted and linked to CVE records. Credits. On the distributions' own pages: Debian · Ubuntu · Red Hat · SUSE · openSUSE.

Red Hat

Red Hat rates this Important.

Red Hat's mitigation

This issue can be mitigated by ensuring xfs_alloc_file_space is not called with "0" as an argument.

This can be done with a SystemTap script (which resets "0" with XFS_BMAPI_PREALLOC), below are the steps:

1) Save the following script in a 'CVE-2021-4155.stp' file

--- On Red Hat Enterprise Linux 6 ---

probe module("xfs").function("xfs_alloc_file_space") {

if ($alloc_type == 0)

$alloc_type = 0x40;# XFS_BMAPI_PREALLOC

}

--- On Red Hat Enterprise Linux 6 ---

--- On Red Hat Enterprise Linux 7 onwards ---

probe module("xfs").function("xfs_alloc_file_space") {

if ($alloc_type == 0)

$alloc_type = 0x8;# XFS_BMAPI_PREALLOC

}

--- On Red Hat Enterprise Linux 7 onwards ---

2) Install systemtap package and its dependencies

# yum install -y systemtap systemtap-runtime

# yum install -y kernel-devel kernel-debuginfo

3) Build the mitigation kernel module as root.

# stap -r `uname -r` -m cve_2021_4155.ko -g CVE-2021-4155.stp -p4

4) Load the mitigation module as root

# staprun -L cve_2021_4155.ko

What is SystemTap and how to use it?

https://access.redhat.com/solutions/5441

ProductPackageStateAdvisory
Red Hat Enterprise Linux 6 Extended Lifecycle Supportkernel-0:2.6.32-754.47.1.el6Fixed 2022-04-19RHSA-2022:1417
Red Hat Enterprise Linux 7kernel-rt-0:3.10.0-1160.59.1.rt56.1200.el7Fixed 2022-02-22RHSA-2022:0622
Red Hat Enterprise Linux 7kpatch-patchFixed 2022-02-22RHSA-2022:0592
Red Hat Enterprise Linux 7kernel-0:3.10.0-1160.59.1.el7Fixed 2022-02-22RHSA-2022:0620
Red Hat Enterprise Linux 7.3 Advanced Update Supportkernel-0:3.10.0-514.97.1.el7Fixed 2022-02-15RHSA-2022:0529
Red Hat Enterprise Linux 7.4 Advanced Update Supportkernel-0:3.10.0-693.96.1.el7Fixed 2022-02-15RHSA-2022:0530
Red Hat Enterprise Linux 7.6 Advanced Update Supportkernel-0:3.10.0-957.88.1.el7Fixed 2022-02-15RHSA-2022:0531
Red Hat Enterprise Linux 7.6 Telco Extended Update Supportkernel-0:3.10.0-957.88.1.el7Fixed 2022-02-15RHSA-2022:0531
Red Hat Enterprise Linux 7.6 Update Services for SAP Solutionskernel-0:3.10.0-957.88.1.el7Fixed 2022-02-15RHSA-2022:0531
Red Hat Enterprise Linux 7.6 Update Services for SAP Solutionskpatch-patchFixed 2022-02-15RHSA-2022:0533
Red Hat Enterprise Linux 7.7 Advanced Update Supportkernel-0:3.10.0-1062.63.1.el7Fixed 2022-03-01RHSA-2022:0712
Red Hat Enterprise Linux 7.7 Telco Extended Update Supportkernel-0:3.10.0-1062.63.1.el7Fixed 2022-03-01RHSA-2022:0712
Red Hat Enterprise Linux 7.7 Update Services for SAP Solutionskernel-0:3.10.0-1062.63.1.el7Fixed 2022-03-01RHSA-2022:0712
Red Hat Enterprise Linux 7.7 Update Services for SAP Solutionskpatch-patchFixed 2022-03-01RHSA-2022:0718
Red Hat Enterprise Linux 8kernel-rt-0:4.18.0-348.12.2.rt7.143.el8_5Fixed 2022-01-19RHSA-2022:0176
Red Hat Enterprise Linux 8kernel-0:4.18.0-348.12.2.el8_5Fixed 2022-01-19RHSA-2022:0188
Red Hat Enterprise Linux 8kpatch-patchFixed 2022-01-24RHSA-2022:0232
Red Hat Enterprise Linux 8.1 Update Services for SAP Solutionskpatch-patchFixed 2022-02-01RHSA-2022:0335
Red Hat Enterprise Linux 5kernelNot affected
Red Hat Enterprise Linux 9kernelNot affected
10 more in the JSON and on Red Hat's page.

Contains Red Hat Security Data © Red Hat, Inc., licensed under CC BY 4.0. Source: https://access.redhat.com/security/data. Modified: reformatted. Red Hat's page for CVE-2021-4155.

Attack patterns (CAPEC)

  • CAPEC-47 Buffer Overflow via Parameter Expansion Likelihood: Medium · Severity: High
  • CAPEC-100 Overflow Buffers Likelihood: High · Severity: Very High

The attack patterns MITRE's CAPEC relates to this record's weaknesses, as MITRE names them. Credits.

References

Check your stackJSON