In the Linux kernel, the following vulnerability has been resolved:
net: openvswitch: fix use-after-free of the flow table mask array
tbl_mask_array_realloc() retires the old mask_array before it stops being
reachable:
<pre>
old = ovsl_dereference(tbl->mask_array);
if (old) {
...
call_rcu(&old->rcu, mask_array_rcu_cb);
}
rcu_assign_pointer(tbl->mask_array, new);
</pre>
call_rcu() only waits for read-side critical sections already in flight.
tbl->mask_array still points at old between the call_rcu() and the
rcu_assign_pointer(), so a reader entering ovs_flow_tbl_lookup_stats() in
that window picks up old in a fresh critical section that the pending
grace period does not cover.
tbl_mask_array_realloc() runs in process context under ovs_mutex, so the
window is preemptible and can outlast the grace period. Then
mask_array_rcu_cb() frees old before the swap runs:
BUG: KASAN: slab-use-after-free in flow_lookup.constprop.0+0x2bf/0x2f0
Read of size 8 at addr ffff888020b3e018 by task poc/741
flow_lookup.constprop.0+0x2bf/0x2f0
ovs_flow_tbl_lookup_stats+0x4a3/0x5c0
ovs_dp_process_packet+0x19c/0x710
ovs_vport_receive+0x243/0x390
internal_dev_xmit+0x81/0x170
Freed by task 728:
kfree+0x16a/0x4e0
rcu_core+0x853/0x1030
Publish the new array before retiring the old one. The kfree_rcu() that
call_rcu() replaced ran after the swap.
CVSS Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
CVSS Score: 7.8
AV:L - Both sides of the race are driven locally: tbl_mask_array_realloc() runs from OVS_FLOW_CMD_NEW/DEL generic-netlink requests (flow insert/remove growing or shrinking the mask array), and the reader is ovs_flow_tbl_lookup_stats() fed by the attacker's own packets via internal_dev_xmit. No remote protocol carries data that causes the bug.
AC:L - The attacker controls both sides, looping flow add/delete to trigger reallocs while transmitting on the datapath's internal port so lookups run. Failed attempts are harmless, the preemptible window can outlast a grace period, and the reporter's KASAN trace shows a PoC hit it.
PR:L - The OVS datapath, vport and flow genl ops are GENL_UNS_ADMIN_PERM with netnsok=true, so CAP_NET_ADMIN in a user namespace (unshare -Urn) is enough to create a datapath, add flows and send packets through it.
UI:N - No victim action is needed; the attacker creates the datapath, drives mask-array reallocation and generates the lookup traffic entirely by themselves.
S:U - The impact stays within the kernel's own security authority, as ordinary kernel memory corruption leading to local privilege escalation; no VM or hardware boundary is crossed.
C:H - flow_lookup() reads the freed struct mask_array (max, masks[] pointers) and dereferences masks[i] as sw_flow_mask. If the slab is reclaimed with attacker data, that gives controlled-pointer reads of kernel memory.
I:H - On a flow hit, flow_lookup() does stats->usage_cntrs[index]++ through ma->masks_usage_stats taken from the freed mask_array, so a reclaimed object yields an attacker-steered kernel memory increment (write primitive).
A:H - The slab use-after-free in flow_lookup() during ovs_dp_process_packet crashes the kernel (KASAN-reported); with a reclaimed object, wild pointer dereferences cause an oops or panic.
| Attack Vector |
Local |
Scope |
Unchanged |
| Attack Complexity |
Low |
Confidentiality Impact |
High |
| Privileges Required |
Low |
Integrity Impact |
High |
| User Interaction |
None |
Availability Impact |
High |
AV:L - Both sides of the race are driven locally: tbl_mask_array_realloc() runs from OVS_FLOW_CMD_NEW/DEL generic-netlink requests (flow insert/remove growing or shrinking the mask array), and the reader is ovs_flow_tbl_lookup_stats() fed by the attacker's own packets via internal_dev_xmit. No remote protocol carries data that causes the bug.
AC:L - The attacker controls both sides, looping flow add/delete to trigger reallocs while transmitting on the datapath's internal port so lookups run. Failed attempts are harmless, the preemptible window can outlast a grace period, and the reporter's KASAN trace shows a PoC hit it.
PR:L - The OVS datapath, vport and flow genl ops are GENL_UNS_ADMIN_PERM with netnsok=true, so CAP_NET_ADMIN in a user namespace (unshare -Urn) is enough to create a datapath, add flows and send packets through it.
UI:N - No victim action is needed; the attacker creates the datapath, drives mask-array reallocation and generates the lookup traffic entirely by themselves.
S:U - The impact stays within the kernel's own security authority, as ordinary kernel memory corruption leading to local privilege escalation; no VM or hardware boundary is crossed.
C:H - flow_lookup() reads the freed struct mask_array (max, masks[] pointers) and dereferences masks[i] as sw_flow_mask. If the slab is reclaimed with attacker data, that gives controlled-pointer reads of kernel memory.
I:H - On a flow hit, flow_lookup() does stats->usage_cntrs[index]++ through ma->masks_usage_stats taken from the freed mask_array, so a reclaimed object yields an attacker-steered kernel memory increment (write primitive).
A:H - The slab use-after-free in flow_lookup() during ovs_dp_process_packet crashes the kernel (KASAN-reported); with a reclaimed object, wild pointer dereferences cause an oops or panic.
CVSS 3.1