{"id":"CVE-2022-50259","state":"PUBLISHED","title":"bpf, sockmap: fix race in sock_map_free()","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf, sockmap: fix race in sock_map_free()\n\nsock_map_free() calls release_sock(sk) without owning a reference\non the socket. This can cause use-after-free as syzbot found [1]\n\nJakub Sitnicki already took care of a similar issue\nin sock_hash_free() in commit 75e68e5bf2c7 (\"bpf, sockhash:\nSynchronize delete from bucket list on map free\")\n\n[1]\nrefcount_t: decrement hit 0; leaking memory.\nWARNING: CPU: 0 PID: 3785 at lib/refcount.c:31 refcount_warn_saturate+0x17c/0x1a0 lib/refcount.c:31\nModules linked in:\nCPU: 0 PID: 3785 Comm: kworker/u4:6 Not tainted 6.1.0-rc7-syzkaller-00103-gef4d3ea40565 #0\nHardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022\nWorkqueue: events_unbound bpf_map_free_deferred\nRIP: 0010:refcount_warn_saturate+0x17c/0x1a0 lib/refcount.c:31\nCode: 68 8b 31 c0 e8 75 71 15 fd 0f 0b e9 64 ff ff ff e8 d9 6e 4e fd c6 05 62 9c 3d 0a 01 48 c7 c7 80 bb 68 8b 31 c0 e8 54 71 15 fd <0f> 0b e9 43 ff ff ff 89 d9 80 e1 07 80 c1 03 38 c1 0f 8c a2 fe ff\nRSP: 0018:ffffc9000456fb60 EFLAGS: 00010246\nRAX: eae59bab72dcd700 RBX: 0000000000000004 RCX: ffff8880207057c0\nRDX: 0000000000000000 RSI: 0000000000000201 RDI: 0000000000000000\nRBP: 0000000000000004 R08: ffffffff816fdabd R09: fffff520008adee5\nR10: fffff520008adee5 R11: 1ffff920008adee4 R12: 0000000000000004\nR13: dffffc0000000000 R14: ffff88807b1c6c00 R15: 1ffff1100f638dcf\nFS: 0000000000000000(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000\nCS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033\nCR2: 0000001b30c30000 CR3: 000000000d08e000 CR4: 00000000003506f0\nDR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000\nDR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400\nCall Trace:\n<TASK>\n__refcount_dec include/linux/refcount.h:344 [inline]\nrefcount_dec include/linux/refcount.h:359 [inline]\n__sock_put include/net/sock.h:779 [inline]\ntcp_release_cb+0x2d0/0x360 net/ipv4/tcp_output.c:1092\nrelease_sock+0xaf/0x1c0 net/core/sock.c:3468\nsock_map_free+0x219/0x2c0 net/core/sock_map.c:356\nprocess_one_work+0x81c/0xd10 kernel/workqueue.c:2289\nworker_thread+0xb14/0x1330 kernel/workqueue.c:2436\nkthread+0x266/0x300 kernel/kthread.c:376\nret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306\n</TASK>","publishedAt":"2025-09-15T14:02:47.875Z","updatedAt":"2026-10-15T21:31:19.702Z","severity":{"score":7.8,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/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":"20ae0cb8983b05136d5293c47fadc99a8ca8ca2d","status":"affected","lessThan":"4cabc3af4a6f36c222fecb15858c1060e59218e7","versionType":"git"},{"version":"7e81a35302066c5a00b4c72d83e3ea4cad6eeb5b","status":"affected","lessThan":"be719496ae6a7fc325e9e5056a52f63ebc84cc0c","versionType":"git"},{"version":"7e81a35302066c5a00b4c72d83e3ea4cad6eeb5b","status":"affected","lessThan":"a443c55d96dede82a724df6e70a318ad15c199e1","versionType":"git"},{"version":"7e81a35302066c5a00b4c72d83e3ea4cad6eeb5b","status":"affected","lessThan":"e8b2b392a646bf5cb9413c1cc7a39d99c1b65a62","versionType":"git"},{"version":"7e81a35302066c5a00b4c72d83e3ea4cad6eeb5b","status":"affected","lessThan":"5c3568166129bc73fd6b37748d2d8f95cd8f22f3","versionType":"git"},{"version":"7e81a35302066c5a00b4c72d83e3ea4cad6eeb5b","status":"affected","lessThan":"0a182f8d607464911756b4dbef5d6cad8de22469","versionType":"git"},{"version":"5.4.14","status":"affected","lessThan":"5.4.229","versionType":"semver"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/core/sock_map.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.5","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.5","versionType":"semver"},{"version":"5.4.229","status":"unaffected","lessThanOrEqual":"5.4.*","versionType":"semver"},{"version":"5.10.163","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.86","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.0.16","status":"unaffected","lessThanOrEqual":"6.0.*","versionType":"semver"},{"version":"6.1.2","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.2","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/core/sock_map.c"]}],"references":["https://git.kernel.org/stable/c/4cabc3af4a6f36c222fecb15858c1060e59218e7","https://git.kernel.org/stable/c/be719496ae6a7fc325e9e5056a52f63ebc84cc0c","https://git.kernel.org/stable/c/a443c55d96dede82a724df6e70a318ad15c199e1","https://git.kernel.org/stable/c/e8b2b392a646bf5cb9413c1cc7a39d99c1b65a62","https://git.kernel.org/stable/c/5c3568166129bc73fd6b37748d2d8f95cd8f22f3","https://git.kernel.org/stable/c/0a182f8d607464911756b4dbef5d6cad8de22469"],"weaknesses":[],"ingestedAt":"2026-10-29T20:05:26.763Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2022/50xxx/CVE-2022-50259.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2022-50259","state":"PUBLISHED","datePublished":"2025-09-15T14:02:47.875Z","dateUpdated":"2026-10-15T21:31:19.702Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2025-09-15T13:58:00.974Z"},"containers":{"cna":{"title":"bpf, sockmap: fix race in sock_map_free()","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf, sockmap: fix race in sock_map_free()\n\nsock_map_free() calls release_sock(sk) without owning a reference\non the socket. This can cause use-after-free as syzbot found [1]\n\nJakub Sitnicki already took care of a similar issue\nin sock_hash_free() in commit 75e68e5bf2c7 (\"bpf, sockhash:\nSynchronize delete from bucket list on map free\")\n\n[1]\nrefcount_t: decrement hit 0; leaking memory.\nWARNING: CPU: 0 PID: 3785 at lib/refcount.c:31 refcount_warn_saturate+0x17c/0x1a0 lib/refcount.c:31\nModules linked in:\nCPU: 0 PID: 3785 Comm: kworker/u4:6 Not tainted 6.1.0-rc7-syzkaller-00103-gef4d3ea40565 #0\nHardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022\nWorkqueue: events_unbound bpf_map_free_deferred\nRIP: 0010:refcount_warn_saturate+0x17c/0x1a0 lib/refcount.c:31\nCode: 68 8b 31 c0 e8 75 71 15 fd 0f 0b e9 64 ff ff ff e8 d9 6e 4e fd c6 05 62 9c 3d 0a 01 48 c7 c7 80 bb 68 8b 31 c0 e8 54 71 15 fd <0f> 0b e9 43 ff ff ff 89 d9 80 e1 07 80 c1 03 38 c1 0f 8c a2 fe ff\nRSP: 0018:ffffc9000456fb60 EFLAGS: 00010246\nRAX: eae59bab72dcd700 RBX: 0000000000000004 RCX: ffff8880207057c0\nRDX: 0000000000000000 RSI: 0000000000000201 RDI: 0000000000000000\nRBP: 0000000000000004 R08: ffffffff816fdabd R09: fffff520008adee5\nR10: fffff520008adee5 R11: 1ffff920008adee4 R12: 0000000000000004\nR13: dffffc0000000000 R14: ffff88807b1c6c00 R15: 1ffff1100f638dcf\nFS: 0000000000000000(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000\nCS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033\nCR2: 0000001b30c30000 CR3: 000000000d08e000 CR4: 00000000003506f0\nDR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000\nDR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400\nCall Trace:\n<TASK>\n__refcount_dec include/linux/refcount.h:344 [inline]\nrefcount_dec include/linux/refcount.h:359 [inline]\n__sock_put include/net/sock.h:779 [inline]\ntcp_release_cb+0x2d0/0x360 net/ipv4/tcp_output.c:1092\nrelease_sock+0xaf/0x1c0 net/core/sock.c:3468\nsock_map_free+0x219/0x2c0 net/core/sock_map.c:356\nprocess_one_work+0x81c/0xd10 kernel/workqueue.c:2289\nworker_thread+0xb14/0x1330 kernel/workqueue.c:2436\nkthread+0x266/0x300 kernel/kthread.c:376\nret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306\n</TASK>"}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"20ae0cb8983b05136d5293c47fadc99a8ca8ca2d","status":"affected","lessThan":"4cabc3af4a6f36c222fecb15858c1060e59218e7","versionType":"git"},{"version":"7e81a35302066c5a00b4c72d83e3ea4cad6eeb5b","status":"affected","lessThan":"be719496ae6a7fc325e9e5056a52f63ebc84cc0c","versionType":"git"},{"version":"7e81a35302066c5a00b4c72d83e3ea4cad6eeb5b","status":"affected","lessThan":"a443c55d96dede82a724df6e70a318ad15c199e1","versionType":"git"},{"version":"7e81a35302066c5a00b4c72d83e3ea4cad6eeb5b","status":"affected","lessThan":"e8b2b392a646bf5cb9413c1cc7a39d99c1b65a62","versionType":"git"},{"version":"7e81a35302066c5a00b4c72d83e3ea4cad6eeb5b","status":"affected","lessThan":"5c3568166129bc73fd6b37748d2d8f95cd8f22f3","versionType":"git"},{"version":"7e81a35302066c5a00b4c72d83e3ea4cad6eeb5b","status":"affected","lessThan":"0a182f8d607464911756b4dbef5d6cad8de22469","versionType":"git"},{"version":"5.4.14","status":"affected","lessThan":"5.4.229","versionType":"semver"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/core/sock_map.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.5","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.5","versionType":"semver"},{"version":"5.4.229","status":"unaffected","lessThanOrEqual":"5.4.*","versionType":"semver"},{"version":"5.10.163","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.86","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.0.16","status":"unaffected","lessThanOrEqual":"6.0.*","versionType":"semver"},{"version":"6.1.2","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.2","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["net/core/sock_map.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/4cabc3af4a6f36c222fecb15858c1060e59218e7"},{"url":"https://git.kernel.org/stable/c/be719496ae6a7fc325e9e5056a52f63ebc84cc0c"},{"url":"https://git.kernel.org/stable/c/a443c55d96dede82a724df6e70a318ad15c199e1"},{"url":"https://git.kernel.org/stable/c/e8b2b392a646bf5cb9413c1cc7a39d99c1b65a62"},{"url":"https://git.kernel.org/stable/c/5c3568166129bc73fd6b37748d2d8f95cd8f22f3"},{"url":"https://git.kernel.org/stable/c/0a182f8d607464911756b4dbef5d6cad8de22469"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - The bug is reached only through local bpf(2) SOCKMAP create/update and map teardown (close last map FD → bpf_map_put → bpf_map_free_deferred → sock_map_free); it is not reachable from network packet processing.\nAC:L - The attacker fully controls both sides of the race—populating the SOCKMAP, closing the map to schedule sock_map_free, and concurrently closing enrolled sockets—so success does not depend on conditions outside their influence.\nPR:L - SOCKMAP creation needs capable(CAP_NET_ADMIN), but that capability is commonly granted to networking containers and delegated via BPF tokens; this matches established CNA PR:L scoring for the same sock_map/sk_psock subsystem when uncertain toward higher severity.\nUI:N - The attacker performs map create/update, map close, and concurrent socket close entirely in their own threads; no separate victim action is required.\nS:U - The use-after-free of struct sock remains inside the host kernel security authority and does not cross a VM, IOMMU, or sandbox boundary.\nC:H - sock_map_free() can lock/release a socket after its last reference is dropped, yielding a use-after-free of struct sock whose fields (including protocol ops) can be reclaimed for arbitrary kernel disclosure.\nI:H - A freed struct sock is a classic heap-spray target; reuse of sk_prot/callback pointers during release_sock/tcp_release_cb enables arbitrary write and control-flow hijacking primitives.\nA:H - The syzbot report shows refcount_warn_saturate on a dead socket during release_sock, and any sock UAF can oops/panic the kernel even when not fully exploited."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T08:57:59.099Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.4.14","versionEndExcluding":"5.4.229"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.5","versionEndExcluding":"5.10.163"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.5","versionEndExcluding":"5.15.86"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.5","versionEndExcluding":"6.0.16"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.5","versionEndExcluding":"6.1.2"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.5","versionEndExcluding":"6.2"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"title":"CISA ADP Vulnrichment","metrics":[{"other":{"type":"ssvc","content":{"id":"CVE-2022-50259","role":"CISA Coordinator","options":[{"Exploitation":"none"},{"Automatable":"no"},{"Technical Impact":"total"}],"version":"2.0.3","timestamp":"2026-10-15T21:30:46.333972Z"}}}],"providerMetadata":{"shortName":"CISA-ADP","orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","dateUpdated":"2026-10-15T21:31:19.702Z"}}]}}}