{"id":"CVE-2024-26689","state":"PUBLISHED","title":"ceph: prevent use-after-free in encode_cap_msg()","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nceph: prevent use-after-free in encode_cap_msg()\n\nIn fs/ceph/caps.c, in encode_cap_msg(), \"use after free\" error was\ncaught by KASAN at this line - 'ceph_buffer_get(arg->xattr_buf);'. This\nimplies before the refcount could be increment here, it was freed.\n\nIn same file, in \"handle_cap_grant()\" refcount is decremented by this\nline - 'ceph_buffer_put(ci->i_xattrs.blob);'. It appears that a race\noccurred and resource was freed by the latter line before the former\nline could increment it.\n\nencode_cap_msg() is called by __send_cap() and __send_cap() is called by\nceph_check_caps() after calling __prep_cap(). __prep_cap() is where\narg->xattr_buf is assigned to ci->i_xattrs.blob. This is the spot where\nthe refcount must be increased to prevent \"use after free\" error.","publishedAt":"2024-04-03T14:54:50.885Z","updatedAt":"2026-08-05T11:26:42.116Z","severity":{"score":8.8,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"9030aaf9bf0a1eee47a154c316c789e959638b0f","status":"affected","lessThan":"8180d0c27b93a6eb60da1b08ea079e3926328214","versionType":"git"},{"version":"9030aaf9bf0a1eee47a154c316c789e959638b0f","status":"affected","lessThan":"70e329b440762390258a6fe8c0de93c9fdd56c77","versionType":"git"},{"version":"9030aaf9bf0a1eee47a154c316c789e959638b0f","status":"affected","lessThan":"f3f98d7d84b31828004545e29fd7262b9f444139","versionType":"git"},{"version":"9030aaf9bf0a1eee47a154c316c789e959638b0f","status":"affected","lessThan":"ae20db45e482303a20e56f2db667a9d9c54ac7e7","versionType":"git"},{"version":"9030aaf9bf0a1eee47a154c316c789e959638b0f","status":"affected","lessThan":"7958c1bf5b03c6f1f58e724dbdec93f8f60b96fc","versionType":"git"},{"version":"9030aaf9bf0a1eee47a154c316c789e959638b0f","status":"affected","lessThan":"cda4672da1c26835dcbd7aec2bfed954eda9b5ef","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/ceph/caps.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"2.6.34","status":"affected"},{"version":"0","status":"unaffected","lessThan":"2.6.34","versionType":"semver"},{"version":"5.10.210","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.149","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.79","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.18","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.7.6","status":"unaffected","lessThanOrEqual":"6.7.*","versionType":"semver"},{"version":"6.8","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/ceph/caps.c"]}],"references":["https://git.kernel.org/stable/c/8180d0c27b93a6eb60da1b08ea079e3926328214","https://git.kernel.org/stable/c/70e329b440762390258a6fe8c0de93c9fdd56c77","https://git.kernel.org/stable/c/f3f98d7d84b31828004545e29fd7262b9f444139","https://git.kernel.org/stable/c/ae20db45e482303a20e56f2db667a9d9c54ac7e7","https://git.kernel.org/stable/c/7958c1bf5b03c6f1f58e724dbdec93f8f60b96fc","https://git.kernel.org/stable/c/cda4672da1c26835dcbd7aec2bfed954eda9b5ef","https://lists.debian.org/debian-lts-announce/2024/06/msg00017.html"],"weaknesses":[],"ingestedAt":"2026-10-29T20:07:10.607Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2024/26xxx/CVE-2024-26689.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2024-26689","state":"PUBLISHED","datePublished":"2024-04-03T14:54:50.885Z","dateUpdated":"2026-08-05T11:26:42.116Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2024-02-19T14:20:24.154Z"},"containers":{"cna":{"title":"ceph: prevent use-after-free in encode_cap_msg()","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nceph: prevent use-after-free in encode_cap_msg()\n\nIn fs/ceph/caps.c, in encode_cap_msg(), \"use after free\" error was\ncaught by KASAN at this line - 'ceph_buffer_get(arg->xattr_buf);'. This\nimplies before the refcount could be increment here, it was freed.\n\nIn same file, in \"handle_cap_grant()\" refcount is decremented by this\nline - 'ceph_buffer_put(ci->i_xattrs.blob);'. It appears that a race\noccurred and resource was freed by the latter line before the former\nline could increment it.\n\nencode_cap_msg() is called by __send_cap() and __send_cap() is called by\nceph_check_caps() after calling __prep_cap(). __prep_cap() is where\narg->xattr_buf is assigned to ci->i_xattrs.blob. This is the spot where\nthe refcount must be increased to prevent \"use after free\" error."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"9030aaf9bf0a1eee47a154c316c789e959638b0f","status":"affected","lessThan":"8180d0c27b93a6eb60da1b08ea079e3926328214","versionType":"git"},{"version":"9030aaf9bf0a1eee47a154c316c789e959638b0f","status":"affected","lessThan":"70e329b440762390258a6fe8c0de93c9fdd56c77","versionType":"git"},{"version":"9030aaf9bf0a1eee47a154c316c789e959638b0f","status":"affected","lessThan":"f3f98d7d84b31828004545e29fd7262b9f444139","versionType":"git"},{"version":"9030aaf9bf0a1eee47a154c316c789e959638b0f","status":"affected","lessThan":"ae20db45e482303a20e56f2db667a9d9c54ac7e7","versionType":"git"},{"version":"9030aaf9bf0a1eee47a154c316c789e959638b0f","status":"affected","lessThan":"7958c1bf5b03c6f1f58e724dbdec93f8f60b96fc","versionType":"git"},{"version":"9030aaf9bf0a1eee47a154c316c789e959638b0f","status":"affected","lessThan":"cda4672da1c26835dcbd7aec2bfed954eda9b5ef","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/ceph/caps.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"2.6.34","status":"affected"},{"version":"0","status":"unaffected","lessThan":"2.6.34","versionType":"semver"},{"version":"5.10.210","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.149","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.79","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.18","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.7.6","status":"unaffected","lessThanOrEqual":"6.7.*","versionType":"semver"},{"version":"6.8","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/ceph/caps.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/8180d0c27b93a6eb60da1b08ea079e3926328214"},{"url":"https://git.kernel.org/stable/c/70e329b440762390258a6fe8c0de93c9fdd56c77"},{"url":"https://git.kernel.org/stable/c/f3f98d7d84b31828004545e29fd7262b9f444139"},{"url":"https://git.kernel.org/stable/c/ae20db45e482303a20e56f2db667a9d9c54ac7e7"},{"url":"https://git.kernel.org/stable/c/7958c1bf5b03c6f1f58e724dbdec93f8f60b96fc"},{"url":"https://git.kernel.org/stable/c/cda4672da1c26835dcbd7aec2bfed954eda9b5ef"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":8.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:N - The freeing half of the race executes in `handle_cap_grant()`/`ceph_fill_inode()` while parsing `CEPH_MSG_CLIENT_CAPS` messages and reply traces received from the remote Ceph MDS, so a co-tenant CephFS client, a malicious/compromised MDS, or a MITM on the (by-default unencrypted) msgr connection controls the timing and content of the free. The freed buffer's contents are additionally marshalled into `msg->middle` and transmitted back over the network to the MDS.\nAC:L - The attacker drives both sides of the race — local/co-tenant `setxattr` traffic opens the unlocked `__prep_cap()`→`__send_cap()` window, while concurrent access to the same inode from another client forces the MDS to emit the cap grant with a higher `xattr_version` that drops the last reference — and the sequence can be retried without limit until the window is hit.\nPR:L - Exploitation requires only an ordinary unprivileged account with write access to a file on an already-mounted CephFS (no capabilities are checked anywhere on the `setxattr`→`ceph_check_caps`→`__prep_cap` path), or an equally unprivileged co-tenant account on the same shared CephFS.\nUI:N - No victim action is needed at exploit time; the CephFS mount is pre-existing deployment configuration, and the attacker's own syscalls and MDS traffic supply every step of the race.\nS:U - The corruption is confined to kernel heap objects within the same kernel security authority; no VM, IOMMU, or sandbox boundary is crossed.\nC:H - This is a use-after-free whose stale `vec.iov_base`/`vec.iov_len` are read back and sent to the MDS as the cap message middle section, leaking reallocated kernel heap contents to a remote peer, and heap grooming of the small `kmalloc-64` `ceph_buffer` object generalizes this into an arbitrary kernel-memory read.\nI:H - `ceph_buffer_get()` performs a `kref_get()` increment directly into freed memory, corrupting a refcount field of whatever object is reallocated into that slab slot, and the later `ceph_buffer_put()`/`kvfree()` on stale pointers yields a double-free/arbitrary-free — both standard stepping stones to arbitrary write and control-flow hijack.\nA:H - The use-after-free was caught by KASAN and, unmitigated, corrupts slab metadata and refcounts leading to oops, double-free and kernel panic, which the attacker can trigger repeatedly."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T11:26:42.116Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.34","versionEndExcluding":"5.10.210"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.34","versionEndExcluding":"5.15.149"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.34","versionEndExcluding":"6.1.79"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.34","versionEndExcluding":"6.6.18"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.34","versionEndExcluding":"6.7.6"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.34","versionEndExcluding":"6.8"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"title":"CVE Program Container","references":[{"url":"https://git.kernel.org/stable/c/8180d0c27b93a6eb60da1b08ea079e3926328214","tags":["x_transferred"]},{"url":"https://git.kernel.org/stable/c/70e329b440762390258a6fe8c0de93c9fdd56c77","tags":["x_transferred"]},{"url":"https://git.kernel.org/stable/c/f3f98d7d84b31828004545e29fd7262b9f444139","tags":["x_transferred"]},{"url":"https://git.kernel.org/stable/c/ae20db45e482303a20e56f2db667a9d9c54ac7e7","tags":["x_transferred"]},{"url":"https://git.kernel.org/stable/c/7958c1bf5b03c6f1f58e724dbdec93f8f60b96fc","tags":["x_transferred"]},{"url":"https://git.kernel.org/stable/c/cda4672da1c26835dcbd7aec2bfed954eda9b5ef","tags":["x_transferred"]},{"url":"https://lists.debian.org/debian-lts-announce/2024/06/msg00017.html","tags":["x_transferred"]}],"providerMetadata":{"shortName":"CVE","orgId":"af854a3a-2127-422b-91ae-364da2661108","dateUpdated":"2024-08-02T00:14:12.664Z"}},{"title":"CISA ADP Vulnrichment","metrics":[{"other":{"type":"ssvc","content":{"timestamp":"2024-08-15T19:26:55.316031Z","id":"CVE-2024-26689","options":[{"Exploitation":"none"},{"Automatable":"no"},{"Technical Impact":"partial"}],"role":"CISA Coordinator","version":"2.0.3"}}}],"providerMetadata":{"shortName":"CISA-ADP","orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","dateUpdated":"2024-08-15T19:27:03.603Z"}}]}}}