{"id":"CVE-2026-139661","state":"PUBLISHED","title":"bpf, lsm: Reject writes into the BPF LSM program context","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf, lsm: Reject writes into the BPF LSM program context\n\nThe verifier types a load from a tracing-style context by its offset\nalone: btf_ctx_access() looks the offset up in the attach hook's\nprototype, and check_mem_access() stamps the resulting type onto the\ndestination register. Nothing tracks what the slot actually holds.\nThat is sound only as long as the context is read-only, and for BPF LSM\nit is not. lsm_verifier_ops wires ->is_valid_access() straight to\nbtf_ctx_access(), which never looks at enum bpf_access_type, so a store\ninto the context passes verification. Every other user of the helper\neither goes through bpf_tracing_btf_ctx_access() or open-codes the same\ntype != BPF_READ test first; BPF LSM is the only one that does neither.\n\nA program can therefore store a scalar of its choosing into a context\nslot, read the slot back, and get a register the verifier believes is a\ntrusted pointer of the hook's argument type. Handing that to a kfunc or\nhelper which dereferences a trusted argument turns it into an arbitrary\nkernel access. Route BPF LSM through bpf_tracing_btf_ctx_access() like\neveryone else.","publishedAt":"2026-11-30T13:36:48.960Z","updatedAt":"2026-11-30T13:36:48.960Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"fc611f47f2188ade2b48ff6902d5cce8baac0c58","status":"affected","lessThan":"6b810a303806b3a48c0d8cec99468956d15b8069","versionType":"git"},{"version":"fc611f47f2188ade2b48ff6902d5cce8baac0c58","status":"affected","lessThan":"23fd50ed3ae8ff501e90db8b253ee05992a0b563","versionType":"git"},{"version":"fc611f47f2188ade2b48ff6902d5cce8baac0c58","status":"affected","lessThan":"ad74f678b76e9460193afc1683ba50ae5d2f6400","versionType":"git"},{"version":"fc611f47f2188ade2b48ff6902d5cce8baac0c58","status":"affected","lessThan":"d37ac6eda751255a96a46737abbb526ada2a1017","versionType":"git"},{"version":"fc611f47f2188ade2b48ff6902d5cce8baac0c58","status":"affected","lessThan":"ab9f32e30ac4087a72070d8cc33809c02797e8ef","versionType":"git"},{"version":"fc611f47f2188ade2b48ff6902d5cce8baac0c58","status":"affected","lessThan":"63fa671681dc8f10d1f21032bc6da1c3398c782b","versionType":"git"},{"version":"fc611f47f2188ade2b48ff6902d5cce8baac0c58","status":"affected","lessThan":"c42da1d3ba9d5067cf3f0676b98bcb3f5f9e3ce1","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/bpf/bpf_lsm.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.7","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.7","versionType":"semver"},{"version":"5.15.226","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.193","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.163","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.119","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.65","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.6","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/bpf/bpf_lsm.c"]}],"references":["https://git.kernel.org/stable/c/6b810a303806b3a48c0d8cec99468956d15b8069","https://git.kernel.org/stable/c/23fd50ed3ae8ff501e90db8b253ee05992a0b563","https://git.kernel.org/stable/c/ad74f678b76e9460193afc1683ba50ae5d2f6400","https://git.kernel.org/stable/c/d37ac6eda751255a96a46737abbb526ada2a1017","https://git.kernel.org/stable/c/ab9f32e30ac4087a72070d8cc33809c02797e8ef","https://git.kernel.org/stable/c/63fa671681dc8f10d1f21032bc6da1c3398c782b","https://git.kernel.org/stable/c/c42da1d3ba9d5067cf3f0676b98bcb3f5f9e3ce1"],"weaknesses":[],"ingestedAt":"2026-11-30T13:54:04.526Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/139xxx/CVE-2026-139661.json","commit":"8c2c22940a0de21d18737df980299c0488d5dc73","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-139661","state":"PUBLISHED","datePublished":"2026-11-30T13:36:48.960Z","dateUpdated":"2026-11-30T13:36:48.960Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-11-30T13:22:15.946Z"},"containers":{"cna":{"title":"bpf, lsm: Reject writes into the BPF LSM program context","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf, lsm: Reject writes into the BPF LSM program context\n\nThe verifier types a load from a tracing-style context by its offset\nalone: btf_ctx_access() looks the offset up in the attach hook's\nprototype, and check_mem_access() stamps the resulting type onto the\ndestination register. Nothing tracks what the slot actually holds.\nThat is sound only as long as the context is read-only, and for BPF LSM\nit is not. lsm_verifier_ops wires ->is_valid_access() straight to\nbtf_ctx_access(), which never looks at enum bpf_access_type, so a store\ninto the context passes verification. Every other user of the helper\neither goes through bpf_tracing_btf_ctx_access() or open-codes the same\ntype != BPF_READ test first; BPF LSM is the only one that does neither.\n\nA program can therefore store a scalar of its choosing into a context\nslot, read the slot back, and get a register the verifier believes is a\ntrusted pointer of the hook's argument type. Handing that to a kfunc or\nhelper which dereferences a trusted argument turns it into an arbitrary\nkernel access. Route BPF LSM through bpf_tracing_btf_ctx_access() like\neveryone else."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"fc611f47f2188ade2b48ff6902d5cce8baac0c58","status":"affected","lessThan":"6b810a303806b3a48c0d8cec99468956d15b8069","versionType":"git"},{"version":"fc611f47f2188ade2b48ff6902d5cce8baac0c58","status":"affected","lessThan":"23fd50ed3ae8ff501e90db8b253ee05992a0b563","versionType":"git"},{"version":"fc611f47f2188ade2b48ff6902d5cce8baac0c58","status":"affected","lessThan":"ad74f678b76e9460193afc1683ba50ae5d2f6400","versionType":"git"},{"version":"fc611f47f2188ade2b48ff6902d5cce8baac0c58","status":"affected","lessThan":"d37ac6eda751255a96a46737abbb526ada2a1017","versionType":"git"},{"version":"fc611f47f2188ade2b48ff6902d5cce8baac0c58","status":"affected","lessThan":"ab9f32e30ac4087a72070d8cc33809c02797e8ef","versionType":"git"},{"version":"fc611f47f2188ade2b48ff6902d5cce8baac0c58","status":"affected","lessThan":"63fa671681dc8f10d1f21032bc6da1c3398c782b","versionType":"git"},{"version":"fc611f47f2188ade2b48ff6902d5cce8baac0c58","status":"affected","lessThan":"c42da1d3ba9d5067cf3f0676b98bcb3f5f9e3ce1","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/bpf/bpf_lsm.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.7","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.7","versionType":"semver"},{"version":"5.15.226","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.193","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.163","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.119","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.65","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.6","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/bpf/bpf_lsm.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/6b810a303806b3a48c0d8cec99468956d15b8069"},{"url":"https://git.kernel.org/stable/c/23fd50ed3ae8ff501e90db8b253ee05992a0b563"},{"url":"https://git.kernel.org/stable/c/ad74f678b76e9460193afc1683ba50ae5d2f6400"},{"url":"https://git.kernel.org/stable/c/d37ac6eda751255a96a46737abbb526ada2a1017"},{"url":"https://git.kernel.org/stable/c/ab9f32e30ac4087a72070d8cc33809c02797e8ef"},{"url":"https://git.kernel.org/stable/c/63fa671681dc8f10d1f21032bc6da1c3398c782b"},{"url":"https://git.kernel.org/stable/c/c42da1d3ba9d5067cf3f0676b98bcb3f5f9e3ce1"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-11-30T13:36:48.960Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.7","versionEndExcluding":"5.15.226"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.7","versionEndExcluding":"6.1.193"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.7","versionEndExcluding":"6.6.163"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.7","versionEndExcluding":"6.12.119"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.7","versionEndExcluding":"6.18.65"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.7","versionEndExcluding":"7.3.6"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.7","versionEndExcluding":"7.4-rc1"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}