In the Linux kernel, the following vulnerability has been resolved:
rnbd-srv: publish the sess_dev at the end of OPEN
rnbd_sess_dev_alloc() stores the empty sess_dev in the XArray as its
first step. An IO message with the new ID from another connection can
find it before bdev_file is set, or hold a reference while a failing
OPEN frees it after a mere RCU grace period. Both are reachable from any
host that can open a device.
Reserve the ID with a NULL entry and store the sess_dev once nothing can
fail anymore. The error path still erases the ID, and no longer needs
synchronize_rcu().
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 client's own RNBD_MSG_OPEN and an RNBD_MSG_IO carrying the new device_id arrive via rtrs_srv_rdma_done() -> process_io_req() -> rnbd_srv_rdma_ev() -> process_msg_open()/process_rdma(). rtrs_srv_rdma_init() listens with RDMA_PS_TCP on IN6ADDR_ANY, so RoCEv2/iWARP peers reach it over routable IP.
AC:L - Each RTRS connection has its own IB_POLL_WORKQUEUE CQ, so an IO on a second connection runs rnbd_get_sess_dev() without srv_sess->lock while OPEN holds it, and xa_alloc() IDs are predictable. The peer forces free_srv_sess_dev itself: "ram0" then "./ram0" gives -EEXIST up to 5.10.y, and opening a device while its own last mapping closes on another session makes rnbd_srv_create_dev_sysfs() fail. Misses are harmless.
PR:N - rtrs_rdma_connect() and process_info_req() check only RTRS_MAGIC, the version, cid/con_num and a unique pathname, and process_msg_open() checks only path length and "..". No credential is exchanged before a peer opens a device under dev_search_path and sends IO to its ID.
UI:N - The OPEN, CLOSE and IO messages are handled by the server's CQ workqueue as ordinary RTRS traffic. The attacker supplies every step, and no administrator or local user does anything.
S:U - The freed rnbd_srv_sess_dev, and the refcount and completion pointer touched through it, belong to the storage server's own kernel. No VM, IOMMU or sandbox boundary is crossed.
C:H - free_srv_sess_dev waits only an RCU grace period before kfree(), while process_rdma() already holds a kref on the kmalloc-512 sess_dev. When its bio completes, rnbd_dev_bi_end_io() runs kref_put() on the freed slot and, at zero, complete() follows a destroy_comp pointer loaded from whatever reclaimed it, which can be groomed into a kernel read.
I:H - The stale kref_put() decrements a refcount in reclaimed memory. If the next OPEN's sess_dev reuses the ID and slot, that live mapping is released early, and complete() through a reclaimed pointer writes via its wait-queue lock and done count: heap corruption exploitable for control flow.
A:H - Without grooming, an IO landing between kref_init() and the bdev_file store in rnbd_srv_create_set_sess_dev() makes process_rdma() call file_bdev(NULL) and oops the CQ worker. On the UAF path, a reused slot oopses in complete(NULL). The unauthenticated peer can repeat both.
| 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 client's own RNBD_MSG_OPEN and an RNBD_MSG_IO carrying the new device_id arrive via rtrs_srv_rdma_done() -> process_io_req() -> rnbd_srv_rdma_ev() -> process_msg_open()/process_rdma(). rtrs_srv_rdma_init() listens with RDMA_PS_TCP on IN6ADDR_ANY, so RoCEv2/iWARP peers reach it over routable IP.
AC:L - Each RTRS connection has its own IB_POLL_WORKQUEUE CQ, so an IO on a second connection runs rnbd_get_sess_dev() without srv_sess->lock while OPEN holds it, and xa_alloc() IDs are predictable. The peer forces free_srv_sess_dev itself: "ram0" then "./ram0" gives -EEXIST up to 5.10.y, and opening a device while its own last mapping closes on another session makes rnbd_srv_create_dev_sysfs() fail. Misses are harmless.
PR:N - rtrs_rdma_connect() and process_info_req() check only RTRS_MAGIC, the version, cid/con_num and a unique pathname, and process_msg_open() checks only path length and "..". No credential is exchanged before a peer opens a device under dev_search_path and sends IO to its ID.
UI:N - The OPEN, CLOSE and IO messages are handled by the server's CQ workqueue as ordinary RTRS traffic. The attacker supplies every step, and no administrator or local user does anything.
S:U - The freed rnbd_srv_sess_dev, and the refcount and completion pointer touched through it, belong to the storage server's own kernel. No VM, IOMMU or sandbox boundary is crossed.
C:H - free_srv_sess_dev waits only an RCU grace period before kfree(), while process_rdma() already holds a kref on the kmalloc-512 sess_dev. When its bio completes, rnbd_dev_bi_end_io() runs kref_put() on the freed slot and, at zero, complete() follows a destroy_comp pointer loaded from whatever reclaimed it, which can be groomed into a kernel read.
I:H - The stale kref_put() decrements a refcount in reclaimed memory. If the next OPEN's sess_dev reuses the ID and slot, that live mapping is released early, and complete() through a reclaimed pointer writes via its wait-queue lock and done count: heap corruption exploitable for control flow.
A:H - Without grooming, an IO landing between kref_init() and the bdev_file store in rnbd_srv_create_set_sess_dev() makes process_rdma() call file_bdev(NULL) and oops the CQ worker. On the UAF path, a reused slot oopses in complete(NULL). The unauthenticated peer can repeat both.
CVSS 3.1