{"id":"CVE-2026-99505","summary":"apparmor: fix a use-after-free in aa_lookupn_ns()","details":"In the Linux kernel, the following vulnerability has been resolved:\n\napparmor: fix a use-after-free in aa_lookupn_ns()\n\naa_lookupn_ns() takes a reference on the namespace it finds with\naa_get_ns(), which is kref_get() on the reference count that the\nnamespace is released through, without checking whether the namespace\nis still in use.  A concurrent removal of a \":\"-prefixed namespace\nlooks the same namespace up and only then takes the parent lock to\nremove it, so the last reference can be dropped between the lookup and\nthe aa_get_ns() call: the reference count then reports the increment on\na zero count and the kernel classifies the following use of the object\nas a use-after-free.  A user with CAP_MAC_ADMIN can trigger this by\nwriting a \":\u003cname\u003e\" removal and a \":\u003cname\u003e/\u003cprofile\u003e\" removal to\n/sys/kernel/security/apparmor/.remove concurrently.\n\nrefcount_t: addition on 0; use-after-free.\nWARNING: lib/refcount.c:25 at refcount_warn_saturate+0xc0/0xe0, CPU#6\nCall Trace:\n \u003cTASK\u003e\n aa_lookupn_ns+0xa9/0xc0\n aa_remove_profiles+0x4fb/0x730\n ? __kvmalloc_node_noprof+0x219/0x5c0\n ? __pfx_aa_remove_profiles+0x10/0x10\n ? aa_loaddata_alloc+0x65/0x1f0\n ? _copy_from_user+0x2d/0x80\n ? aa_loaddata_alloc+0x111/0x1f0\n profile_remove+0x2ee/0x4a0\n vfs_write+0x21e/0xcf0\n ? rcu_core+0x29c/0x1740\n ? timerqueue_linked_add+0x1f4/0x3d0\n ? __pfx_vfs_write+0x10/0x10\n ? mutex_lock+0x81/0xe0\n ? __pfx_mutex_lock+0x10/0x10\n ? __pfx_rcu_core+0x10/0x10\n ? __pfx_hrtimer_update_next_event+0x10/0x10\n ? mutex_unlock+0x7b/0xd0\n ? fdget_pos+0x24d/0x4b0\n ksys_write+0xf7/0x1c0\n ? __pfx_ksys_write+0x10/0x10\n ? restore_fpregs_from_fpstate+0x37/0xc0\n do_syscall_64+0xf9/0x540\n entry_SYSCALL_64_after_hwframe+0x77/0x7f\n \u003c/TASK\u003e\n\nFix by rejecting a namespace whose reference count is zero.","modified":"2026-11-19T17:00:46.344338171Z","published":"2026-11-19T14:43:55.775Z","database_specific":{"cna_assigner":"Linux","osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/99xxx/CVE-2026-99505.json"},"references":[{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"},{"type":"WEB","url":"https://git.kernel.org/stable/c/174b4b90ec6731934cf84eb267a86ad7152267fa"},{"type":"WEB","url":"https://git.kernel.org/stable/c/2588c5693f4535e856841976cb1e1532bae77109"},{"type":"WEB","url":"https://git.kernel.org/stable/c/8db1a8614b4f8f3da11c568e2b5af4fe56eef360"},{"type":"WEB","url":"https://git.kernel.org/stable/c/f292873ceb4bd3a1a0f75f884361cd556e457692"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/99xxx/CVE-2026-99505.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-99505"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"3664268f19ea07bec55df92fe53ff9ed28968bcc"},{"fixed":"2588c5693f4535e856841976cb1e1532bae77109"},{"fixed":"174b4b90ec6731934cf84eb267a86ad7152267fa"},{"fixed":"8db1a8614b4f8f3da11c568e2b5af4fe56eef360"},{"fixed":"f292873ceb4bd3a1a0f75f884361cd556e457692"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-99505.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"4.13.0"},{"fixed":"6.12.117"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.13.0"},{"fixed":"6.18.61"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.19.0"},{"fixed":"7.3.2"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-99505.json"}}],"schema_version":"1.9.2"}