erofs: fix the out-of-bounds nameoff handling for trailing dirents
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 3aa8ec716e52c02360457fa018296629b4d0becf · < 8ebb951a284b7446e025afc7dc5e9516ef9a7214| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
erofs: fix the out-of-bounds nameoff handling for trailing dirents
Currently we already have boundary-checks for nameoffs, but the trailing dirents are special since the namelens are calculated with strnlen() with unchecked nameoffs.
If a crafted EROFS has a trailing dirent with nameoff >= maxsize, maxsize - nameoff can underflow, causing strnlen() to read past the directory block.
nameoff0 should also be verified to be a multiple of `sizeof(struct erofs_dirent)` as well [1].
[1] https://sashiko.dev/#/patchset/20260416063511.3173774-1-hsiangkao%40linux.alibaba.com
From the CVE record · Linux
The Linux kernel’s EROFS directory handling can read past a directory block when a crafted filesystem has a trailing directory entry with an unchecked name offset. The input does not specify whether exploitation requires local access, authentication, or user interaction.
Teams running Linux kernels with EROFS support should check whether their kernel includes the fix; affected versions are not specified.