FS#73362 - (CVE-2021-4155) VUL-0: CVE-2021-4155: kernel-source: xfs: map unwritten blocks in XFS_IOC_{ALLOC,FRE

Attached to Project: Community Packages
Opened by Nikolay (saber716rus) - Friday, 14 January 2022, 15:51 GMT
Last edited by Antonio Rojas (arojas) - Wednesday, 19 January 2022, 09:41 GMT
Task Type Bug Report
Category Security
Status Closed
Assigned To Jan Alexander Steffens (heftig)
David Runge (dvzrv)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

A vulnerability has been discovered in the code of the XFS file system (CVE-2021-4155), which allows a local unprivileged user to read data from unused blocks directly from a block device. All significant versions of the Linux kernel older than 5.16 that contain the XFS driver are affected by this problem. The fix is included in version 5.16, as well as in kernel updates 5.15.14, 5.10.91, 5.4.171, 4.19.225, etc. The status of the formation of updates with the elimination of the problem in distributions can be tracked on these pages: Debian, RHEL, SUSE, Fedora, Ubuntu, Arch.

The vulnerability is caused by the incorrect behavior of two XFS-specific ioctl(XFS_IOC_ALLOCSP) and ioctl(XFS_IOC_FREESP), which are a functional analogue of the common core system call fallocate(). When increasing the size of a file that is not aligned to the block size, ioctl XFS_IOC_ALLOCSP/XFS_IOC_FREESP do not reset the tail bytes to the next block boundary. Thus, on XFS with a standard block size of 4096 bytes, an attacker can read 4095 bytes of the previous recorded data from each block. The specified areas may contain data from deleted files of defragmented files, as well as data from files with deduplicated blocks.

You can check your system for a problem using a simple prototype exploit. If, after executing the proposed sequence of commands, it is possible to read the text of Shakespeare, then the FS driver is vulnerable. The initial mounting of the XFS partition for demonstration requires superuser rights.

Since ioctl(XFS_IOC_ALLOCSP) and ioctl(XFS_IOC_FREESP) are practically identical in functionality to the standard fallocate(), and their only difference is data leakage, their presence is similar to a backdoor. Despite the general policy not to change existing interfaces in the kernel, at Linus' suggestion, it was decided to completely remove these ioctl's in the next version.

This task depends upon

Closed by  Antonio Rojas (arojas)
Wednesday, 19 January 2022, 09:41 GMT
Reason for closing:  Fixed
Additional comments about closing:  linux 5.16.arch1-1 linux-zen 5.16.zen1-1 linux-lts 5.15.14-1 linux-hardened 5.15.14.hardened1-1
Comment by Nikolay (saber716rus) - Friday, 14 January 2022, 15:54 GMT Comment by George Rawlinson (rawlinsong) - Monday, 17 January 2022, 20:09 GMT
@heftig & dvzrv: Not sure who to assign this to, feel free to re-assign to the correct person(s).

Loading...