Squashfs: fix handling and sanity checking of xattr_ids count
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 506220d2ba21791314af569211ffd8870b8208fa · < a7da7d01ac5ce9b369a1ac70e1197999cc6c9686| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
Squashfs: fix handling and sanity checking of xattr_ids count
A Sysbot [1] corrupted filesystem exposes two flaws in the handling and sanity checking of the xattr_ids count in the filesystem. Both of these flaws cause computation overflow due to incorrect typing.
In the corrupted filesystem the xattr_ids value is 4294967071, which stored in a signed variable becomes the negative number -225.
Flaw 1 (64-bit systems only):
The signed integer xattr_ids variable causes sign extension.
This causes variable overflow in the SQUASHFS_XATTR_*(A) macros. The variable is first multiplied by sizeof(struct squashfs_xattr_id) where the type of the sizeof operator is "unsigned long".
On a 64-bit system this is 64-bits in size, and causes the negative number to be sign extended and widened to 64-bits and then become unsigned. This produces the very large number 18446744073709548016 or 2^64 - 3600. This number when rounded up by SQUASHFS_METADATA_SIZE - 1 (8191 bytes) and divided by SQUASHFS_METADATA_SIZE overflows and produces a length of 0 (stored in len).
From the CVE record · Linux
The Linux kernel’s Squashfs xattr_ids calculations can overflow on both 32-bit and 64-bit systems when processing a corrupted filesystem. The resulting zero-length calculation can let an invalid xattr table pass a sanity check. The input does not specify how an attacker could supply the filesystem or whether authentication or user interaction is required.
Engineers running the Linux kernel with Squashfs support should check their versions; affected versions are not specified in the input.