CVE-2025-39840: audit: fix out-of-bounds read in audit_compare_dname_path()
In the Linux kernel, the following vulnerability has been resolved:
audit: fix out-of-bounds read in audit_compare_dname_path()
When a watch on dir=/ is combined with an fsnotify event for a
single-character name directly under / (e.g., creating /a), an
out-of-bounds read can occur in audit_compare_dname_path().
The helper parent_len() returns 1 for "/". In audit_compare_dname_path(),
when parentlen equals the full path length (1), the code sets p = path + 1
and pathlen = 1 - 1 = 0. The subsequent loop then dereferences
p[pathlen - 1] (i.e., p[-1]), causing an out-of-bounds read.
Fix this by adding a pathlen > 0 check to the while loop condition
to prevent the out-of-bounds access.
[PM: subject tweak, sign-off email fixes]
Security readout for executives and security teams
Plain-English summary
A Linux kernel audit bug can read outside valid memory when a root-directory audit watch encounters certain short filenames. A local, low-privileged user may be able to trigger confidentiality or availability impacts. Risk is concentrated on affected kernels using this audit configuration.
Executive priority
Prioritize affected multi-user, shared-hosting, and other systems permitting untrusted local access. Patch through normal expedited kernel maintenance; escalate where root-directory audit watches and exposed local accounts coexist.
Technical view
CVE-2025-39840 is a CWE-125 out-of-bounds read in audit_compare_dname_path(). When parent_len() and the full path length are both one, pathlen becomes zero before p[pathlen-1] is evaluated. The upstream correction requires pathlen to remain greater than zero during the loop.
Likely exposure
Exposure requires an affected Linux kernel, local low-privileged access, and an audit watch on dir=/. The supplied affected-version metadata is ambiguous, so organizations should map their exact distribution kernel package to vendor guidance or the referenced fixes.
Exploitation context
The CVSS 3.1 score is 7.1 with local, low-complexity, low-privilege access and potential high confidentiality and availability impact. The bundle marks this CVE as absent from KEV and provides no evidence of active exploitation or a public exploit.
Researcher notes
The boundary condition occurs after pathlen is reduced from one to zero, followed by an index of negative one. The fix adds a pathlen > 0 loop guard. The supplied sources do not establish practical information disclosure, reliable crashing, affected distribution packages, or exploitation in the wild.
Mitigation direction
Install a vendor-supported kernel update containing the upstream correction.
Map distribution kernel packages to the referenced stable commits or vendor advisories.
Until patched, avoid dir=/ audit watches where operationally and security-wise acceptable.
Limit untrusted local account access where patching cannot occur promptly.
Validation and detection
Inventory running kernel versions across Linux systems.
Identify systems configured with audit watches targeting dir=/.
Confirm vendor packages include the pathlen guard or referenced stable fix.
Reboot updated systems and verify the patched kernel is running.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cwe · low confidence lookup
CWE-125: Exact CWE lookup
Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
CWE-125 · source CWE mapping
Out-of-bounds Read
Out-of-bounds Read represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.