CVE-2022-50277
ext4: don't allow journal inode to have encrypt flag
Check your servers for CVE-2022-50277
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2022-50277 affects the running kernel, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
Description
In the Linux kernel, the following vulnerability has been resolved:
ext4: don't allow journal inode to have encrypt flag
Mounting a filesystem whose journal inode has the encrypt flag causes a NULL dereference in fscrypt_limit_io_blocks() when the 'inlinecrypt' mount option is used.
The problem is that when jbd2_journal_init_inode() calls bmap(), it eventually finds its way into ext4_iomap_begin(), which calls fscrypt_limit_io_blocks(). fscrypt_limit_io_blocks() requires that if the inode is encrypted, then its encryption key must already be set up. That's not the case here, since the journal inode is never "opened" like a normal file would be. Hence the crash.
A reproducer is:
mkfs.ext4 -F /dev/vdb debugfs -w /dev/vdb -R "set_inode_field <8> flags 0x80808" mount /dev/vdb /mnt -o inlinecrypt
To fix this, make ext4 consider journal inodes with the encrypt flag to be invalid. (Note, maybe other flags should be rejected on the journal inode too. For now, this is just the minimal fix for the above issue.)
I've marked this as fixing the commit that introduced the call to fscrypt_limit_io_blocks(), since that's what made an actual crash start being possible. But this fix could be applied to any version of ext4 that supports the encrypt feature.
Exploitation
EPSS 0.11%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 1.22% of all scored CVEs. Scores of 1 Dec 2026.
Affected products
As the CNA lists them.
| Product | Versions |
|---|---|
| Linux |
affected from 38ea50daa7a447dbcd7031f37a39a1baa163b2ab, before 1f7a6626f611aa06d7907aa45b484708dd5ac8bc affected from 38ea50daa7a447dbcd7031f37a39a1baa163b2ab, before bcc5057e1781a3ee889225480d995c3b5cbde555 affected from 38ea50daa7a447dbcd7031f37a39a1baa163b2ab, before 105c78e12468413e426625831faa7db4284e1fec
Other versions: unaffected
|
| Linux |
affected 5.18 unaffected before 5.18 unaffected from 6.0.18 up to and including 6.0.* unaffected from 6.1.4 up to and including 6.1.* unaffected 6.2 and later
Other versions: affected
|
Is my server affected?
This CVE is in the Linux kernel. Compare the running kernel with the fixed kernel version of your distribution, and reboot after a kernel update:
uname -r
# Debian, Ubuntu: does the changelog of the running kernel name the CVE?
zgrep -l CVE-2022-50277 /usr/share/doc/linux-image-$(uname -r)/changelog.Debian.gz
# RHEL, Rocky, Alma
rpm -q --changelog kernel | grep CVE-2022-50277
With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2022-50277
trivy image --scanners vuln IMAGE | grep CVE-2022-50277
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Other references
- https://git.kernel.org/stable/c/1f7a6626f611aa06d7907aa45b484708dd5ac8bc git.kernel.org
- https://git.kernel.org/stable/c/bcc5057e1781a3ee889225480d995c3b5cbde555 git.kernel.org
- https://git.kernel.org/stable/c/105c78e12468413e426625831faa7db4284e1fec git.kernel.org
Source: the record CVE-2022-50277 of the CVE List (CVE Program), CVE Terms of Use; EPSS of FIRST. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse