{"id":"CVE-2024-57982","aliases":["CVE-2024-57982"],"related":[],"kind":"vulnerability","state":"published","title":"xfrm: state: fix out-of-bounds read during lookup","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\nxfrm: state: fix out-of-bounds read during lookup\n\nlookup and resize can run in parallel.\n\nThe xfrm_state_hash_generation seqlock ensures a retry, but the hash\nfunctions can observe a hmask value that is too large for the new hlist\narray.\n\nrehash does:\n  rcu_assign_pointer(net->xfrm.state_bydst, ndst) [..]\n  net->xfrm.state_hmask = nhashmask;\n\nWhile state lookup does:\n  h = xfrm_dst_hash(net, daddr, saddr, tmpl->reqid, encap_family);\n  hlist_for_each_entry_rcu(x, net->xfrm.state_bydst + h, bydst) {\n\nThis is only safe in case the update to state_bydst is larger than\nnet->xfrm.xfrm_state_hmask (or if the lookup function gets\nserialized via state spinlock again).\n\nFix this by prefetching state_hmask and the associated pointers.\nThe xfrm_state_hash_generation seqlock retry will ensure that the pointer\nand the hmask will be consistent.\n\nThe existing helpers, like xfrm_dst_hash(), are now unsafe for RCU side,\nadd lockdep assertions to document that they are only safe for insert\nside.\n\nxfrm_state_lookup_byaddr() uses the spinlock rather than RCU.\nAFAICS this is an oversight from back when state lookup was converted to\nRCU, this lock should be replaced with RCU in a future patch.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\nxfrm: state: fix out-of-bounds read during lookup\n\nlookup and resize can run in parallel.\n\nThe xfrm_state_hash_generation seqlock ensures a retry, but the hash\nfunctions can observe a hmask value that is too large for the new hlist\narray.\n\nrehash does:\n  rcu_assign_pointer(net->xfrm.state_bydst, ndst) [..]\n  net->xfrm.state_hmask = nhashmask;\n\nWhile state lookup does:\n  h = xfrm_dst_hash(net, daddr, saddr, tmpl->reqid, encap_family);\n  hlist_for_each_entry_rcu(x, net->xfrm.state_bydst + h, bydst) {\n\nThis is only safe in case the update to state_bydst is larger than\nnet->xfrm.xfrm_state_hmask (or if the lookup function gets\nserialized via state spinlock again).\n\nFix this by prefetching state_hmask and the associated pointers.\nThe xfrm_state_hash_generation seqlock retry will ensure that the pointer\nand the hmask will be consistent.\n\nThe existing helpers, like xfrm_dst_hash(), are now unsafe for RCU side,\nadd lockdep assertions to document that they are only safe for insert\nside.\n\nxfrm_state_lookup_byaddr() uses the spinlock rather than RCU.\nAFAICS this is an oversight from back when state lookup was converted to\nRCU, this lock should be replaced with RCU in a future patch.","source":"cvelist"},{"lang":"es","text":"En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: xfrm: state: fix out-of-limits read during lookup lookup and resize can run in parallel. El xfrm_state_hash_generation seqlock ensures a retry, but the hash functions can observe a hmask value that is too large for the new hlist array. rehash does: rcu_assign_pointer(net-&gt;xfrm.state_bydst, ndst) [..] net-&gt;xfrm.state_hmask = nhashmask; While state lookup does: h = xfrm_dst_hash(net, daddr, saddr, tmpl-&gt;reqid, encap_family); hlist_for_each_entry_rcu(x, net-&gt;xfrm.state_bydst + h, bydst) { This is only safe in case the update to state_bydst is larger than net-&gt;xfrm.xfrm_state_hmask (or if the lookup function gets serialized via state spinlock again). Solucione esto al precargar state_hmask y los punteros asociados. El reintento de seqlock xfrm_state_hash_generation asegurará que el puntero y el hmask sean consistentes. Los ayudantes existentes, como xfrm_dst_hash(), ahora no son seguros para el lado de RCU, agregue afirmaciones lockdep para documentar que solo son seguros para el lado de inserción. xfrm_state_lookup_byaddr() usa el bloqueo giratorio en lugar de RCU. AFAICS esto es un descuido de cuando la búsqueda de estado se convirtió a RCU, este bloqueo debe reemplazarse con RCU en un parche futuro.","source":"nvd"}],"published":"2025-02-27T02:07:08.169Z","modified":"2026-10-30T13:17:49.700Z","severity":{"scorer":"Linux","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"},"severities":[{"scorer":"Linux","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"},{"scorer":"CISA-ADP","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:H","score":7.1,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:H","score":7.1,"rating":"HIGH"}],"cwes":["CWE-125"],"affected":[{"ranges":[{"type":"git","introduced":"c2f672fc94642bae96821a393f342edcfa9794a6","fixed":"80610185e9dd2ef7c0a4818a47390a8655b3dc27","status":"affected"},{"type":"git","introduced":"c2f672fc94642bae96821a393f342edcfa9794a6","fixed":"b86dc510308d7a8955f3f47a4fea4bef887653e4","status":"affected"},{"type":"git","introduced":"c2f672fc94642bae96821a393f342edcfa9794a6","fixed":"a16871c7832ea6435abb6e0b58289ae7dcb7e4fc","status":"affected"},{"type":"git","introduced":"c2f672fc94642bae96821a393f342edcfa9794a6","fixed":"dd4c2a174994238d55ab54da2545543d36f4e0d0","status":"affected"},{"type":"git","introduced":"c2f672fc94642bae96821a393f342edcfa9794a6","fixed":"e952837f3ddb0ff726d5b582aa1aad9aa38d024d","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"4.9","status":"affected"},{"type":"semver","introduced":"0","fixed":"4.9","status":"unaffected"},{"type":"semver","introduced":"6.1.191","lastAffected":"6.1.*","status":"unaffected"},{"type":"semver","introduced":"6.6.120","lastAffected":"6.6.*","status":"unaffected"},{"type":"semver","introduced":"6.12.13","lastAffected":"6.12.*","status":"unaffected"},{"type":"semver","introduced":"6.13.2","lastAffected":"6.13.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"6.14","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"status":"affected","introduced":"4.9","fixed":"6.12.13"},{"status":"affected","introduced":"6.13","fixed":"6.13.2"}],"vendor":"linux","product":"linux_kernel","cpe":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://git.kernel.org/stable/c/80610185e9dd2ef7c0a4818a47390a8655b3dc27","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/b86dc510308d7a8955f3f47a4fea4bef887653e4","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/a16871c7832ea6435abb6e0b58289ae7dcb7e4fc","tags":["mailing-list","patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/dd4c2a174994238d55ab54da2545543d36f4e0d0","tags":["mailing-list","patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/e952837f3ddb0ff726d5b582aa1aad9aa38d024d","tags":["mailing-list","patch"],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2025-10-01T19:31:46.705Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2024-57982","url":"https://www.cve.org/CVERecord?id=CVE-2024-57982","licence":"CVE Terms of Use","modified":"2026-10-30T12:20:34.191Z"},{"source":"nvd","name":"NVD","id":"CVE-2024-57982","url":"https://nvd.nist.gov/vuln/detail/CVE-2024-57982","licence":"Public domain","modified":"2026-10-30T13:17:49.700Z"}],"updatedAt":"2026-11-25T22:58:52.086Z","epss":{"score":0.00257,"percentile":0.18479,"date":"2026-12-01T12:00:22.000Z"}}