Description
In the Linux kernel, the following vulnerability has been resolved:

apparmor: fix use-after-free in rawdata dedup loop

aa_replace_profiles() walks ns->rawdata_list to dedup the incoming
policy blob against entries already attached to existing profiles.
Per the kernel-doc on struct aa_loaddata, list membership does not
hold a reference: profiles hold pcount, and when the last pcount
drops, do_ploaddata_rmfs() is queued on a workqueue that takes
ns->lock and removes the entry. Between dropping the last pcount
and the workqueue running, an entry remains on the list with
pcount == 0.

aa_get_profile_loaddata() is an unconditional kref_get() on
pcount, so when the dedup loop hits such an entry, refcount
hardening reports

refcount_t: addition on 0; use-after-free.

inside aa_replace_profiles(), and the poisoned counter then
trips "saturated" and "underflow" warnings on the subsequent
uses of the same loaddata.

Before commit a0b7091c4de4 ("apparmor: fix race on rawdata
dereference") the dedup path used a get_unless_zero-style helper
on a single counter, so the existing "if (tmp)" guard was
meaningful. The split-refcount refactor introduced
aa_get_profile_loaddata(), which has plain kref_get() semantics,
and the guard quietly became a no-op.

Introduce aa_get_profile_loaddata_not0(), matching the existing
_not0 convention used by aa_get_profile_not0(), and use it for
the rawdata_list dedup lookup so dying entries are skipped.

Reproduced on x86_64 with v7.1-rc5 in QEMU+KVM running Ubuntu
24.04 + stress-ng 0.17.06:

stress-ng --apparmor 1 --klog-check --timeout 60s

Without this patch the three refcount_t warnings fire within a
few seconds. With it the same 60 s run is clean. Coverage is a
smoke-test only; a longer soak with CONFIG_KASAN, CONFIG_KCSAN
and CONFIG_PROVE_LOCKING would be welcome from anyone with the
cycles.
Published: 2026-07-19
Score: 7.8 High
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

A race condition in the AppArmor module causes the reference count of a rawdata list entry to be increased from zero, leading to a use‑after‑free when the kernel later drops the reference on that entry. This occurs in the rawdata dedup loop of aa_replace_profiles(), where an unguarded kref_get() increments a counter on an already‑freed object. The resulting memory corruption is visible through hardened counter warnings and can trigger kernel crashes or data corruption. Based on the description, it is inferred that an attacker could trigger the dedup loop by feeding crafted policy blobs into AppArmor, potentially causing the file descriptor or memory corruption.

Affected Systems

All Linux kernel builds that include AppArmor and have not yet applied the patch commit that introduces aa_get_profile_loaddata_not0(). The provided CPE identifier covers the generic Linux kernel, so every distribution running a kernel prior to the fix is affected. No specific vendor or version ranges are listed in the CNA data, but any kernel that compiled with AppArmor support is vulnerable.

Risk and Exploitability

The CVSS score of 7.8 indicates moderate‑to‑high severity, while the EPSS score of less than 1% suggests a very low likelihood of real‑world exploitation at the time of this analysis. The vulnerability is not listed in CISA KEV, implying that no confirmed exploit is known. The attack would require local or privileged access to inject or manipulate AppArmor policy blobs, making it a local‑to‑privilege‑escalation risk rather than a remote attack vector. If exploited, the kernel could crash or experience corruption, potentially allowing privilege escalation in a compromise scenario.

Generated by OpenCVE AI on July 30, 2026 at 22:09 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Apply the kernel update that contains the aa_get_profile_loaddata_not0() change and reboot to ensure the running kernel is at least the patched release
  • If an update is not immediately available, disable AppArmor entirely or restrict the use of policies that can be loaded through aa_replace_profiles()
  • Configure and review audit logs (e.g., auditd) for AppArmor policy modifications and monitor for KASAN/KCSAN warnings that indicate memory corruption attempts

Generated by OpenCVE AI on July 30, 2026 at 22:09 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Debian DLA Debian DLA DLA-4700-1 linux-6.1 security update
Debian DLA Debian DLA DLA-4717-1 linux security update
History

Fri, 24 Jul 2026 18:30:00 +0000


Tue, 21 Jul 2026 00:15:00 +0000


Mon, 20 Jul 2026 14:45:00 +0000

Type Values Removed Values Added
Metrics cvssV3_1

{'score': 7.8, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H'}


Sun, 19 Jul 2026 12:15:00 +0000

Type Values Removed Values Added
Description In the Linux kernel, the following vulnerability has been resolved: apparmor: fix use-after-free in rawdata dedup loop aa_replace_profiles() walks ns->rawdata_list to dedup the incoming policy blob against entries already attached to existing profiles. Per the kernel-doc on struct aa_loaddata, list membership does not hold a reference: profiles hold pcount, and when the last pcount drops, do_ploaddata_rmfs() is queued on a workqueue that takes ns->lock and removes the entry. Between dropping the last pcount and the workqueue running, an entry remains on the list with pcount == 0. aa_get_profile_loaddata() is an unconditional kref_get() on pcount, so when the dedup loop hits such an entry, refcount hardening reports refcount_t: addition on 0; use-after-free. inside aa_replace_profiles(), and the poisoned counter then trips "saturated" and "underflow" warnings on the subsequent uses of the same loaddata. Before commit a0b7091c4de4 ("apparmor: fix race on rawdata dereference") the dedup path used a get_unless_zero-style helper on a single counter, so the existing "if (tmp)" guard was meaningful. The split-refcount refactor introduced aa_get_profile_loaddata(), which has plain kref_get() semantics, and the guard quietly became a no-op. Introduce aa_get_profile_loaddata_not0(), matching the existing _not0 convention used by aa_get_profile_not0(), and use it for the rawdata_list dedup lookup so dying entries are skipped. Reproduced on x86_64 with v7.1-rc5 in QEMU+KVM running Ubuntu 24.04 + stress-ng 0.17.06: stress-ng --apparmor 1 --klog-check --timeout 60s Without this patch the three refcount_t warnings fire within a few seconds. With it the same 60 s run is clean. Coverage is a smoke-test only; a longer soak with CONFIG_KASAN, CONFIG_KCSAN and CONFIG_PROVE_LOCKING would be welcome from anyone with the cycles.
Title apparmor: fix use-after-free in rawdata dedup loop
First Time appeared Linux
Linux linux Kernel
CPEs cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
Vendors & Products Linux
Linux linux Kernel
References

Subscriptions

Linux Linux Kernel
cve-icon MITRE

Status: PUBLISHED

Assigner: Linux

Published:

Updated: 2026-08-05T12:36:10.099Z

Reserved: 2026-07-19T07:54:57.014Z

Link: CVE-2026-63827

cve-icon Vulnrichment

No data.

cve-icon NVD

No data.

cve-icon Redhat

Severity :

Publid Date: 2026-07-19T00:00:00Z

Links: CVE-2026-63827 - Bugzilla

cve-icon OpenCVE Enrichment

Updated: 2026-07-30T22:15:13Z

Weaknesses
  • CWE-825

    Expired Pointer Dereference