{"id":"CVE-2026-99040","aliases":["CVE-2026-99040"],"related":[],"kind":"vulnerability","state":"published","title":"KEYS: Fix add_key() race with keyring restriction","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\nKEYS: Fix add_key() race with keyring restriction\n\n__key_create_or_update() snapshots keyring->restrict_link before taking\nthe destination keyring's semaphore.  keyring_restrict() installs a\nrestriction while holding that semaphore.\n\nThis allows a writer to observe no restriction, wait for the keyring\nowner to install a reject-all restriction and return successfully, and\nthen link a key using the stale NULL snapshot.  The writer only needs\nwrite permission on the destination keyring.\n\nMove the restrict_link read after __key_link_lock() and\n__key_link_begin().  The read and the subsequent restriction check are\nthen serialized with restriction installation by keyring->sem.\n\nThe race was reproduced on v7.2.8 in 19 executions where restriction\ninstallation returned before the link completed.  All 19 linked the key\ndespite the reject-all restriction.  With this change, 312 executions\nreached the same ordering and every add_key() call failed with -EPERM.\n\nThe issue was found by manual concurrency analysis assisted by AI-based\nanalysis and independently verified with a QEMU reproducer and kernel\ninstrumentation.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\nKEYS: Fix add_key() race with keyring restriction\n\n__key_create_or_update() snapshots keyring->restrict_link before taking\nthe destination keyring's semaphore.  keyring_restrict() installs a\nrestriction while holding that semaphore.\n\nThis allows a writer to observe no restriction, wait for the keyring\nowner to install a reject-all restriction and return successfully, and\nthen link a key using the stale NULL snapshot.  The writer only needs\nwrite permission on the destination keyring.\n\nMove the restrict_link read after __key_link_lock() and\n__key_link_begin().  The read and the subsequent restriction check are\nthen serialized with restriction installation by keyring->sem.\n\nThe race was reproduced on v7.2.8 in 19 executions where restriction\ninstallation returned before the link completed.  All 19 linked the key\ndespite the reject-all restriction.  With this change, 312 executions\nreached the same ordering and every add_key() call failed with -EPERM.\n\nThe issue was found by manual concurrency analysis assisted by AI-based\nanalysis and independently verified with a QEMU reproducer and kernel\ninstrumentation.","source":"cvelist"}],"published":"2026-10-23T12:21:59.288Z","modified":"2026-10-30T13:21:41.200Z","severities":[],"cwes":[],"affected":[{"ranges":[{"type":"git","introduced":"5ac7eace2d00eab5ae0e9fdee63e38aee6001f7c","fixed":"24806fc9bca28fa1433bf938d1424dcb45d80e50","status":"affected"},{"type":"git","introduced":"5ac7eace2d00eab5ae0e9fdee63e38aee6001f7c","fixed":"9a5c2700336878465a630804a2d21864f22eca9c","status":"affected"},{"type":"git","introduced":"5ac7eace2d00eab5ae0e9fdee63e38aee6001f7c","fixed":"b3e404550dc2b7f3d4bb64b1da8005a1fa9a798d","status":"affected"},{"type":"git","introduced":"5ac7eace2d00eab5ae0e9fdee63e38aee6001f7c","fixed":"305f1828b871dd46bf41addeb6f11d2c162dcb25","status":"affected"},{"type":"git","introduced":"5ac7eace2d00eab5ae0e9fdee63e38aee6001f7c","fixed":"f99399b48e3edd6851fac34cd329bab9f1f33baf","status":"affected"},{"type":"git","introduced":"5ac7eace2d00eab5ae0e9fdee63e38aee6001f7c","fixed":"11516a0c402a6c1fa52254aa70d8d65fb921e59e","status":"affected"},{"type":"git","introduced":"5ac7eace2d00eab5ae0e9fdee63e38aee6001f7c","fixed":"da0b595d8e6e2dd798f6e34e09dc51a13b888514","status":"affected"},{"type":"git","introduced":"5ac7eace2d00eab5ae0e9fdee63e38aee6001f7c","fixed":"dd3ea3fcba7c75493760cdbccd35f029597e8d5e","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"4.7","status":"affected"},{"type":"semver","introduced":"0","fixed":"4.7","status":"unaffected"},{"type":"semver","introduced":"5.10.273","lastAffected":"5.10.*","status":"unaffected"},{"type":"semver","introduced":"5.15.224","lastAffected":"5.15.*","status":"unaffected"},{"type":"semver","introduced":"6.1.191","lastAffected":"6.1.*","status":"unaffected"},{"type":"semver","introduced":"6.6.160","lastAffected":"6.6.*","status":"unaffected"},{"type":"semver","introduced":"6.12.113","lastAffected":"6.12.*","status":"unaffected"},{"type":"semver","introduced":"6.18.57","lastAffected":"6.18.*","status":"unaffected"},{"type":"semver","introduced":"7.2.11","lastAffected":"7.2.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"7.3","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"}],"references":[{"url":"https://git.kernel.org/stable/c/24806fc9bca28fa1433bf938d1424dcb45d80e50","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/9a5c2700336878465a630804a2d21864f22eca9c","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/b3e404550dc2b7f3d4bb64b1da8005a1fa9a798d","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/305f1828b871dd46bf41addeb6f11d2c162dcb25","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/f99399b48e3edd6851fac34cd329bab9f1f33baf","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/11516a0c402a6c1fa52254aa70d8d65fb921e59e","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/da0b595d8e6e2dd798f6e34e09dc51a13b888514","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/dd3ea3fcba7c75493760cdbccd35f029597e8d5e","tags":[],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-99040","url":"https://www.cve.org/CVERecord?id=CVE-2026-99040","licence":"CVE Terms of Use","modified":"2026-10-30T12:41:13.694Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-99040","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-99040","licence":"Public domain","modified":"2026-10-30T13:21:41.200Z"}],"updatedAt":"2026-11-25T22:59:46.957Z","epss":{"score":0.00227,"percentile":0.14365,"date":"2026-12-01T12:00:22.000Z"}}