Cloudanix VulnDB

CVE-2025-39877

None

CVSS

—

EPSS

0.2%

Published

Sep 23, 2025

CISA due date

—

Cloudanix analysis

Next patch cycle SSVC: Track

A flaw in the Linux kernel's memory monitoring feature can let a local attacker crash the system or gain higher privileges by racing certain internal operations.

Chainable
Exploitation
Local Privilege
Attacker needs
Local User
Complexity
Moderate
Impact
Privilege Gain
Component
OS kernel
Class
Use After Free
Remediation
Upgrade
Effort
Medium
Patch risk
Low

What it actually does

state_show() in damon sysfs dereferences kdamond->damon_ctx without holding damon_sysfs_lock, creating a use-after-free window when damon_sysfs_turn_damon_on(), damon_sysfs_kdamonds_rm_dirs(), or damon_sysfs_kdamond_release() frees or replaces the context under the lock.

Why it matters to the business

Kernel memory corruption in the DAMON monitoring subsystem can lead to system crashes, denial of service, or local privilege escalation on Linux hosts, especially those running container-optimized images targeted by known threat actors.

How an attack unfolds

An attacker with local access races state_show() against damon_sysfs_turn_damon_on() or removal functions so that a freed damon_ctx is dereferenced and locked, enabling memory corruption; VMSCAPE and related container-optimized OS campaigns have demonstrated similar kernel primitives for escalation.

How to fix it

Upgrade the Linux kernel to commit 3858c44341ad49dc7544b19cc9f9ecffaa7cc50e or later stable releases containing the damon_sysfs_lock acquisition in state_show(); apply the corresponding Debian package updates once available for the running kernel.

How to confirm the fix worked

Confirm the running kernel contains commit 3858c44341ad49dc7544b19cc9f9ecffaa7cc50e, verify state_show() acquires damon_sysfs_lock before dereferencing damon_ctx, and test concurrent sysfs operations under load to ensure no UAF occurs.

Typical attack path

  1. Obtain local unprivileged shell on affected Linux kernel
  2. Trigger concurrent DAMON sysfs operations via crafted writes to /sys/kernel/mm/damon/
  3. Race state_show() with context destruction under damon_sysfs_lock
  4. Trigger use-after-free dereference and lock acquisition on freed ctx
  5. Leverage resulting memory corruption for privilege escalation or DoS

How to detect it

Search kernel logs and audit trails for concurrent DAMON sysfs activity around crashes or oops involving damon_ctx or kdamond_lock; correlate with process activity from known container-optimized OS exploitation campaigns such as VMSCAPE.

What your security team should do

  • Prioritize kernel upgrade to the fixed commit on all production systems within the next maintenance window
  • Restrict unprivileged access to /sys/kernel/mm/damon/ via mount options or SELinux policies until patched
  • Monitor for similar DAMON-related races reported under CVE-2025-39946 and CVE-2025-40018
  • Include the fixed commit hash in vulnerability scanning signatures

The record

In the Linux kernel, the following vulnerability has been resolved: mm/damon/sysfs: fix use-after-free in state_show() state_show() reads kdamond->damon_ctx without holding damon_sysfs_lock. This allows a use-after-free race: CPU 0 CPU 1 ----- ----- state_show() damon_sysfs_turn_damon_on() ctx = kdamond->damon_ctx; mutex_lock(&damon_sysfs_lock); damon_destroy_ctx(kdamond->damon_ctx); kdamond->damon_ctx = NULL; mutex_unlock(&damon_sysfs_lock); damon_is_running(ctx); /* ctx is freed */ mutex_lock(&ctx->kdamond_lock); /* UAF */ (The race can also occur with damon_sysfs_kdamonds_rm_dirs() and damon_sysfs_kdamond_release(), which free or replace the context under damon_sysfs_lock.) Fix by taking damon_sysfs_lock before dereferencing the context, mirroring the locking used in pid_show(). The bug has existed since state_show() first accessed kdamond->damon_ctx.

Affected packages

Ecosystem Package Introduced Fixed
Debian:12 linux 0 6.1.153-1
Debian:13 linux 0 6.12.48-1
Debian:14 linux 0 No fix
Linux Kernel 5.18.0 6.1.153
Mageia:9 kernel 0 6.6.116-1.mga9
Mageia:9 kernel-linus 0 6.6.116-1.mga9
Mageia:9 kmod-virtualbox 0 7.1.14-13.mga9
Mageia:9 kmod-xtables-addons 0 3.24-87.mga9
openSUSE:Leap 16.0 dtb-aarch64 0 6.12.0-160000.6.1
openSUSE:Leap 16.0 kernel-64kb 0 6.12.0-160000.6.1
openSUSE:Leap 16.0 kernel-default 0 6.12.0-160000.6.1
openSUSE:Leap 16.0 kernel-default-base 0 6.12.0-160000.6.1.160000.2.4
openSUSE:Leap 16.0 kernel-docs 0 6.12.0-160000.6.1
openSUSE:Leap 16.0 kernel-kvmsmall 0 6.12.0-160000.6.1
openSUSE:Leap 16.0 kernel-obs-build 0 6.12.0-160000.6.1
openSUSE:Leap 16.0 kernel-obs-qa 0 6.12.0-160000.6.1
openSUSE:Leap 16.0 kernel-rt 0 6.12.0-160000.6.1
openSUSE:Leap 16.0 kernel-source 0 6.12.0-160000.6.1
openSUSE:Leap 16.0 kernel-syms 0 6.12.0-160000.6.1
openSUSE:Leap 16.0 kernel-zfcpdump 0 6.12.0-160000.6.1

Related vulnerabilities