cve.bz

CVE-2021-31440 Incorrect Calculation

7.0 highEPSS 1.8%Fix available

High (7.0). EPSS 1.8% estimated probability of exploitation activity in the next 30 days.

On this page
This vulnerability allows local attackers to escalate privileges on affected installations of Linux Kernel 5.11.15. An attacker must first obtain the ability to execute low-privileged code on the target system in order to exploit this vulnerability. The specific flaw exists within the handling of eBPF programs. The issue results from the lack of proper validation of user-supplied eBPF programs prior to executing them. An attacker can leverage this vulnerability to escalate privileges and execute arbitrary code in the context of the kernel. Was ZDI-CAN-13661.

Severity

CVSS 3.1

7.0 high
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
EPSS
1.8% (unchanged from 1.8% a week ago; 1.8% 30 days ago) estimated probability of exploitation activity in the next 30 days; 79th percentile. Scored 2026-11-25. A forecast for this CVE across the internet, not for your own systems.
CWE
CWE-682 Incorrect Calculation
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-31440 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2021-31440?via=ask-ai-copy and https://cve.bz/cve/CVE-2021-31440?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-31440 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_kernelfrom 5.7 before 5.10.37
linux:linux_kernelfrom 5.11 before 5.11.21
linux:linux_kernelfrom 5.12 before 5.12.4

Linux distributions

DistributionReleasePackageFixed inAdvisory
Debian12, 13, 14linux5.10.38-1DEBIAN-CVE-2021-31440
Ubuntu16.04:LTSlinux-hwe-edgeno fix listedUBUNTU-CVE-2021-31440
Ubuntu18.04:LTSlinux-gcp, linux-hwe, linux-oem and 11 moreno fix listedUBUNTU-CVE-2021-31440
Ubuntu20.04:LTSlinux-aws-5.85.8.0-1038.40~20.04.1UBUNTU-CVE-2021-31440 USN-4999-1
Ubuntu20.04:LTSlinux-azure-5.85.8.0-1036.38~20.04.1UBUNTU-CVE-2021-31440 USN-4999-1
Ubuntu20.04:LTSlinux-gcp-5.85.8.0-1035.37~20.04.1UBUNTU-CVE-2021-31440 USN-4999-1
Ubuntu20.04:LTSlinux-hwe-5.85.8.0-59.66~20.04.1UBUNTU-CVE-2021-31440 USN-4999-1
Ubuntu20.04:LTSlinux-oem-5.105.10.0-1032.33UBUNTU-CVE-2021-31440 USN-5001-1
Ubuntu20.04:LTSlinux-oracle-5.85.8.0-1033.34~20.04.1UBUNTU-CVE-2021-31440 USN-4999-1
Ubuntu20.04:LTSlinux-riscv, linux-raspi2no fix listedUBUNTU-CVE-2021-31440
Ubuntu20.04:LTSlinux-riscv-5.85.8.0-29.31~20.04.1UBUNTU-CVE-2021-31440
Red Hatenterprise_linux:8::baseosperf, kernel, bpftool and 30 more0:4.18.0-348.el8RHSA-2021:4356
Red Hatenterprise_linux:8::crbperf-debuginfo, kernel-debuginfo, bpftool-debuginfo and 7 more0:4.18.0-348.el8RHSA-2021:4356
Red Hatenterprise_linux:8::nfvkernel-rt, kernel-rt-kvm, kernel-rt-core and 12 more0:4.18.0-348.rt7.130.el8RHSA-2021:4140
Red Hatenterprise_linux:8::realtimekernel-rt, kernel-rt-core, kernel-rt-debug and 10 more0:4.18.0-348.rt7.130.el8RHSA-2021:4140
SUSELinux Enterprise Live Patching 15 SP3kernel-livepatch-SLE15-SP3_Update_07-3.1SUSE-SU-2021:3360-1
AlmaLinux8kernel-tools-libs-devel4.18.0-348.el8ALSA-2021:4356

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. Modified: reformatted and linked to CVE records. Credits. On the distributions' own pages: Debian · Ubuntu · Red Hat · SUSE.

Red Hat

Red Hat rates this Moderate.

Red Hat's mitigation

The default Red Hat Enterprise Linux kernel prevents unprivileged users from being able to use eBPF by the kernel.unprivileged_bpf_disabled sysctl. This would require a privileged user with CAP_SYS_ADMIN or root to be able to abuse this flaw reducing its attack space.

For the Red Hat Enterprise Linux 7 the eBPF for unprivileged users is always disabled.

For the Red Hat Enterprise Linux 8 to confirm the current state, inspect the sysctl with the command:

# cat /proc/sys/kernel/unprivileged_bpf_disabled

The setting of 1 would mean that unprivileged users can not use eBPF, mitigating the flaw.

A kernel update will be required to mitigate the flaw for the root or users with CAP_SYS_ADMIN capabilities.

ProductPackageStateAdvisory
Red Hat Enterprise Linux 8kernel-rt-0:4.18.0-348.rt7.130.el8Fixed 2021-11-09RHSA-2021:4140
Red Hat Enterprise Linux 8kernel-0:4.18.0-348.el8Fixed 2021-11-09RHSA-2021:4356
Red Hat Enterprise Linux 6kernelNot affected
Red Hat Enterprise Linux 7kernel-altNot affected
Red Hat Enterprise Linux 7kernelNot affected
Red Hat Enterprise Linux 7kernel-rtNot affected
Red Hat Enterprise Linux 9kernelNot affected

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-31440.

GitHub PoC (unverified)

Repositories on GitHub named after this CVE. Nobody has checked them and they are not scanned: some hold a working proof of concept, some nothing useful, and some malware made to look like one. Read the code before you run any of it.

Attack patterns (CAPEC)

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

References

Check your stackJSON