Cyber Posture

CVE-2022-49085

High

Published: 26 February 2025

Published
26 February 2025
Modified
25 March 2025
KEV Added
Patch
CVSS Score 7.8 CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
EPSS Score 0.0001 3.2th percentile
Risk Priority 16 60% EPSS · 20% KEV · 20% CVSS

Description

In the Linux kernel, the following vulnerability has been resolved: drbd: Fix five use after free bugs in get_initial_state In get_initial_state, it calls notify_initial_state_done(skb,..) if cb->args[5]==1. If genlmsg_put() failed in notify_initial_state_done(), the skb will be freed by nlmsg_free(skb). Then get_initial_state will goto out and the freed skb will be used by return value skb->len, which is a uaf bug. What's worse, the same problem goes even further: skb can also be freed in the notify_*_state_change -> notify_*_state calls below. Thus 4 additional uaf bugs happened. My patch lets the problem callee functions: notify_initial_state_done and notify_*_state_change return an error code if errors happen. So that the error codes could be propagated and the uaf bugs can be avoid. v2 reports a compilation warning. This v3 fixed this warning and built successfully in my local environment with no additional warnings. v2: https://lore.kernel.org/patchwork/patch/1435218/

Security Summary

CVE-2022-49085 is a set of five use-after-free vulnerabilities in the Linux kernel's DRBD (Distributed Replicated Block Device) module, specifically within the get_initial_state function. The primary issue occurs when notify_initial_state_done(skb, ...) is called if cb->args[5]==1; if genlmsg_put() fails in that function, the skb is freed via nlmsg_free(skb), but get_initial_state then accesses the freed skb->len upon returning to out, resulting in a use-after-free. Four additional use-after-free bugs arise in similar scenarios involving notify_*_state_change and notify_*_state calls, where the skb is freed but later dereferenced.

A local attacker with low privileges (PR:L) can exploit these vulnerabilities with low attack complexity (AC:L) and no user interaction (UI:N), as indicated by the CVSS v3.1 base score of 7.8 (AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H). Successful exploitation could grant high impacts on confidentiality, integrity, and availability (C:H/I:H/A:H), potentially allowing arbitrary code execution, data corruption, or denial of service through manipulation of the freed memory in the DRBD state notification paths.

The vulnerability is addressed in Linux kernel stable releases via patches that modify the affected notify functions—such as notify_initial_state_done and notify_*_state_change—to return error codes when failures like genlmsg_put() occur. This propagates errors back to get_initial_state, preventing use-after-free by avoiding dereferences of freed skbs. Relevant commits include 0489700bfeb1e53eb2039c2291c67e71b0b40103, 188fe6b26765edbad4055611c0f788b6870f4024, 226e993c39405292781bfcf4b039a8db56aab362, 594205b4936771a250f9d141e7e0fff21c3dd2d9, and a972c768723359ec995579902473028fe3cd64b1, available in kernel.org stable trees.

Details

CWE(s)
CWE-416

Affected Products

linux
linux kernel
5.18 · 4.5 — 4.9.311 · 4.10 — 4.14.276 · 4.15 — 4.19.238

References