In the Linux kernel, the following vulnerability has been resolved:
ceph: clamp the inline data length in ceph_fill_inline_data()
The MDS decides how much inline data to attach to a reply, and the
client parses inline_len without any upper bound: ceph_decode_need()
only verifies that the message actually carries that many bytes.
ceph_fill_inline_data() then copies the data into a single folio
with no length check, so a malicious or buggy MDS returning more
inline data than the folio can hold writes past its end.
Clamp the length to folio_size() so both callers, handle_cap_grant()
and fill_inode(), are covered.
CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
CVSS Score: 9.8
AV:N - The MDS supplies inline_len and the following payload in a CEPH_MSG_CLIENT_REPLY, decoded by parse_reply_info_inline_data and passed through handle_reply and ceph_fill_inode, or in a v4+ CEPH_MSG_CLIENT_CAPS decoded by parse_inline_data and passed through ceph_handle_caps and handle_cap_grant; both copy it in ceph_fill_inline_data over the TCP messenger.
AC:L - A new inode has i_inline_version 0 and i_truncate_seq 0. The MDS reply sets a non-directory mode, size > 0, inline_version greater than 1, and CEPH_CAP_FILE_CACHE, so ceph_fill_file_size stores a non-zero i_size and ceph_fill_inode copies into a freshly created, non-uptodate page 0.
PR:N - handle_reply and ceph_handle_caps accept inline_len from the MDS peer on the session opened by ceph_real_mount. That peer is the remote cluster endpoint, and the copy runs with no local user credential consulted.
UI:N - open_root_dentry issues CEPH_MDS_OP_GETATTR during ceph_real_mount, and that reply is what handle_reply feeds to ceph_fill_inode. The MDS delivers inline_len in its own response; no later user action is required.
S:U - The memcpy corrupts memory of the kernel that mounted ceph, which is the same security authority as the filesystem client.
C:H - ceph_fill_inline_data memcpy's MDS-chosen bytes from the message through kmap_atomic or memcpy_to_folio past the single page at index 0, so the write continues into the adjacent direct-map page and can corrupt neighboring kernel objects into a disclosure primitive.
I:H - inline_len is the u32 from the MDS message, checked only by ceph_decode_need against the message end. The destination page is PAGE_SIZE, and the memcpy writes that full attacker-chosen length past the end of the page.
A:H - The overrun past that page writes into adjacent kernel memory and oopses the client; inline_len can extend to the messenger front limit of 16MB.
| Attack Vector |
Network |
Scope |
Unchanged |
| Attack Complexity |
Low |
Confidentiality Impact |
High |
| Privileges Required |
None |
Integrity Impact |
High |
| User Interaction |
None |
Availability Impact |
High |
AV:N - The MDS supplies inline_len and the following payload in a CEPH_MSG_CLIENT_REPLY, decoded by parse_reply_info_inline_data and passed through handle_reply and ceph_fill_inode, or in a v4+ CEPH_MSG_CLIENT_CAPS decoded by parse_inline_data and passed through ceph_handle_caps and handle_cap_grant; both copy it in ceph_fill_inline_data over the TCP messenger.
AC:L - A new inode has i_inline_version 0 and i_truncate_seq 0. The MDS reply sets a non-directory mode, size > 0, inline_version greater than 1, and CEPH_CAP_FILE_CACHE, so ceph_fill_file_size stores a non-zero i_size and ceph_fill_inode copies into a freshly created, non-uptodate page 0.
PR:N - handle_reply and ceph_handle_caps accept inline_len from the MDS peer on the session opened by ceph_real_mount. That peer is the remote cluster endpoint, and the copy runs with no local user credential consulted.
UI:N - open_root_dentry issues CEPH_MDS_OP_GETATTR during ceph_real_mount, and that reply is what handle_reply feeds to ceph_fill_inode. The MDS delivers inline_len in its own response; no later user action is required.
S:U - The memcpy corrupts memory of the kernel that mounted ceph, which is the same security authority as the filesystem client.
C:H - ceph_fill_inline_data memcpy's MDS-chosen bytes from the message through kmap_atomic or memcpy_to_folio past the single page at index 0, so the write continues into the adjacent direct-map page and can corrupt neighboring kernel objects into a disclosure primitive.
I:H - inline_len is the u32 from the MDS message, checked only by ceph_decode_need against the message end. The destination page is PAGE_SIZE, and the memcpy writes that full attacker-chosen length past the end of the page.
A:H - The overrun past that page writes into adjacent kernel memory and oopses the client; inline_len can extend to the messenger front limit of 16MB.
CVSS 3.1