CVE-2025-38236
Description
A use-after-free flaw was found in the Linux kernel's AF_UNIX sockets functionality in how a user triggers the issue by sending and receiving a crafted sequence of OOB socket messages. This vulnerability allows a local attacker to escalate privileges, especially if the kernel address layout information, such as kernel address space layout randomization (KASLR), is exposed through freed memory.
Statement
This patch addresses a use-after-free vulnerability in the af_unix subsystem, specifically when handling consecutive out-of-band (OOB) messages. Improper management of consumed OOB sk_buffs could lead to a dangling pointer being accessed after it was freed, potentially causing memory corruption or privilege escalation. An unprivileged local attacker can trigger the bug by sending and receiving a crafted sequence of OOB socket messages via AF_UNIX stream sockets. This may allow kernel memory manipulation from user space, leading to possible code execution or system compromise. Although the exploit can be carried out by an unprivileged user-space process using crafted AF_UNIX socket operations via send(MSG_OOB) and recv(MSG_OOB)), the attacker still needs local code execution access, but no elevated privileges are required. For the Red Hat Enterprise Linux 8 bug not yet introduced, related source code is not backported to any version, but for Red Hat Enterprise Linux 9 and Red Hat Enterprise Linux 10 it is actual. The CVSS the Availability is Low because kernel panic likely would not happen until KASAN is enabled with additional debugging. The impact level is Important. A local attacker might leverage this issue to escalate privileges, especially if kernel address layout information, such as KASLR, is exposed through the freed memory.
No Red Hat Enterprise Linux is affected.
Mitigation
The mitigation could disable AF_UNIX sockets usage for local users. This is only a conceptional example not tested with the SELinux usage:
# Disable for users to create AF_UNIX STREAM sockets:
dontaudit user_t self:unix_stream_socket create;
# Prevent connections to similar existing sockets:
dontaudit user_t self:unix_stream_socket connectto;
Common Vulnerability Scoring System (CVSS) Score Details
Info alert:Important note
CVSS scores for open source components depend on vendor-specific factors (e.g. version or build chain). Therefore, Red Hat's score and impact rating can be different from NVD and other vendors. Red Hat remains the authoritative CVE Naming Authority (CNA) source for its products and services (see Red Hat classifications).
The following CVSS metrics and score provided are preliminary and subject to review.
CVSS v3 Score Breakdown
| Red Hat | NVD | cve.org | |
|---|---|---|---|
| Base Score | 7.3 | 7.8 | 7.8 |
| Attack Vector | Local | Local | Local |
| Attack Complexity | Low | Low | Low |
| Privileges Required | Low | Low | Low |
| User Interaction | None | None | None |
| Scope | Unchanged | Unchanged | Unchanged |
| Confidentiality | High | High | High |
| Integrity Impact | High | High | High |
| Availability Impact | Low | High | High |
Vector
Red Hat: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:L
NVD: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
cve.org: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Understanding the Weakness (CWE)
Integrity
Technical Impact: Modify Memory
The use of previously freed memory may corrupt valid data, if the memory area in question has been allocated and used properly elsewhere.
Availability
Technical Impact: DoS: Crash, Exit, or Restart
If chunk consolidation occurs after the use of previously freed data, the process may crash when invalid data is used as chunk information.
Confidentiality
Technical Impact: Read Memory
Read operations on freed memory can sometimes leak sensitive information instead of causing a crash
Integrity,Confidentiality,Availability
Technical Impact: Execute Unauthorized Code or Commands
If malicious data is entered before chunk consolidation can take place, it may be possible to take advantage of a write-what-where primitive to execute arbitrary code. If the newly allocated data happens to hold a class, in C++ for example, various function pointers may be scattered within the heap data. If one of these function pointers is overwritten with an address to valid shellcode, execution of arbitrary code can be achieved.
Frequently Asked Questions
Not sure what something means? Check out our Security Glossary.
Want to get errata notifications? Sign up here.