{"id":"CVE-2025-68785","aliases":["CVE-2025-68785"],"related":[],"kind":"vulnerability","state":"published","title":"net: openvswitch: fix middle attribute validation in push_nsh() action","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\nnet: openvswitch: fix middle attribute validation in push_nsh() action\n\nThe push_nsh() action structure looks like this:\n\n OVS_ACTION_ATTR_PUSH_NSH(OVS_KEY_ATTR_NSH(OVS_NSH_KEY_ATTR_BASE,...))\n\nThe outermost OVS_ACTION_ATTR_PUSH_NSH attribute is OK'ed by the\nnla_for_each_nested() inside __ovs_nla_copy_actions().  The innermost\nOVS_NSH_KEY_ATTR_BASE/MD1/MD2 are OK'ed by the nla_for_each_nested()\ninside nsh_key_put_from_nlattr().  But nothing checks if the attribute\nin the middle is OK.  We don't even check that this attribute is the\nOVS_KEY_ATTR_NSH.  We just do a double unwrap with a pair of nla_data()\ncalls - first time directly while calling validate_push_nsh() and the\nsecond time as part of the nla_for_each_nested() macro, which isn't\nsafe, potentially causing invalid memory access if the size of this\nattribute is incorrect.  The failure may not be noticed during\nvalidation due to larger netlink buffer, but cause trouble later during\naction execution where the buffer is allocated exactly to the size:\n\n BUG: KASAN: slab-out-of-bounds in nsh_hdr_from_nlattr+0x1dd/0x6a0 [openvswitch]\n Read of size 184 at addr ffff88816459a634 by task a.out/22624\n\n CPU: 8 UID: 0 PID: 22624 6.18.0-rc7+ #115 PREEMPT(voluntary)\n Call Trace:\n  <TASK>\n  dump_stack_lvl+0x51/0x70\n  print_address_description.constprop.0+0x2c/0x390\n  kasan_report+0xdd/0x110\n  kasan_check_range+0x35/0x1b0\n  __asan_memcpy+0x20/0x60\n  nsh_hdr_from_nlattr+0x1dd/0x6a0 [openvswitch]\n  push_nsh+0x82/0x120 [openvswitch]\n  do_execute_actions+0x1405/0x2840 [openvswitch]\n  ovs_execute_actions+0xd5/0x3b0 [openvswitch]\n  ovs_packet_cmd_execute+0x949/0xdb0 [openvswitch]\n  genl_family_rcv_msg_doit+0x1d6/0x2b0\n  genl_family_rcv_msg+0x336/0x580\n  genl_rcv_msg+0x9f/0x130\n  netlink_rcv_skb+0x11f/0x370\n  genl_rcv+0x24/0x40\n  netlink_unicast+0x73e/0xaa0\n  netlink_sendmsg+0x744/0xbf0\n  __sys_sendto+0x3d6/0x450\n  do_syscall_64+0x79/0x2c0\n  entry_SYSCALL_64_after_hwframe+0x76/0x7e\n  </TASK>\n\nLet's add some checks that the attribute is properly sized and it's\nthe only one attribute inside the action.  Technically, there is no\nreal reason for OVS_KEY_ATTR_NSH to be there, as we know that we're\npushing an NSH header already, it just creates extra nesting, but\nthat's how uAPI works today.  So, keeping as it is.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\nnet: openvswitch: fix middle attribute validation in push_nsh() action\n\nThe push_nsh() action structure looks like this:\n\n OVS_ACTION_ATTR_PUSH_NSH(OVS_KEY_ATTR_NSH(OVS_NSH_KEY_ATTR_BASE,...))\n\nThe outermost OVS_ACTION_ATTR_PUSH_NSH attribute is OK'ed by the\nnla_for_each_nested() inside __ovs_nla_copy_actions().  The innermost\nOVS_NSH_KEY_ATTR_BASE/MD1/MD2 are OK'ed by the nla_for_each_nested()\ninside nsh_key_put_from_nlattr().  But nothing checks if the attribute\nin the middle is OK.  We don't even check that this attribute is the\nOVS_KEY_ATTR_NSH.  We just do a double unwrap with a pair of nla_data()\ncalls - first time directly while calling validate_push_nsh() and the\nsecond time as part of the nla_for_each_nested() macro, which isn't\nsafe, potentially causing invalid memory access if the size of this\nattribute is incorrect.  The failure may not be noticed during\nvalidation due to larger netlink buffer, but cause trouble later during\naction execution where the buffer is allocated exactly to the size:\n\n BUG: KASAN: slab-out-of-bounds in nsh_hdr_from_nlattr+0x1dd/0x6a0 [openvswitch]\n Read of size 184 at addr ffff88816459a634 by task a.out/22624\n\n CPU: 8 UID: 0 PID: 22624 6.18.0-rc7+ #115 PREEMPT(voluntary)\n Call Trace:\n  <TASK>\n  dump_stack_lvl+0x51/0x70\n  print_address_description.constprop.0+0x2c/0x390\n  kasan_report+0xdd/0x110\n  kasan_check_range+0x35/0x1b0\n  __asan_memcpy+0x20/0x60\n  nsh_hdr_from_nlattr+0x1dd/0x6a0 [openvswitch]\n  push_nsh+0x82/0x120 [openvswitch]\n  do_execute_actions+0x1405/0x2840 [openvswitch]\n  ovs_execute_actions+0xd5/0x3b0 [openvswitch]\n  ovs_packet_cmd_execute+0x949/0xdb0 [openvswitch]\n  genl_family_rcv_msg_doit+0x1d6/0x2b0\n  genl_family_rcv_msg+0x336/0x580\n  genl_rcv_msg+0x9f/0x130\n  netlink_rcv_skb+0x11f/0x370\n  genl_rcv+0x24/0x40\n  netlink_unicast+0x73e/0xaa0\n  netlink_sendmsg+0x744/0xbf0\n  __sys_sendto+0x3d6/0x450\n  do_syscall_64+0x79/0x2c0\n  entry_SYSCALL_64_after_hwframe+0x76/0x7e\n  </TASK>\n\nLet's add some checks that the attribute is properly sized and it's\nthe only one attribute inside the action.  Technically, there is no\nreal reason for OVS_KEY_ATTR_NSH to be there, as we know that we're\npushing an NSH header already, it just creates extra nesting, but\nthat's how uAPI works today.  So, keeping as it is.","source":"cvelist"},{"lang":"es","text":"En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta:\n\nnet: openvswitch: corrige la validación del atributo intermedio en la acción push_nsh()\n\nLa estructura de la acción push_nsh() se ve así:\n\n OVS_ACTION_ATTR_PUSH_NSH(OVS_KEY_ATTR_NSH(OVS_NSH_KEY_ATTR_BASE,...))\n\nEl atributo más externo OVS_ACTION_ATTR_PUSH_NSH es validado por nla_for_each_nested() dentro de __ovs_nla_copy_actions(). Los atributos más internos OVS_NSH_KEY_ATTR_BASE/MD1/MD2 son validados por nla_for_each_nested() dentro de nsh_key_put_from_nlattr(). Pero nada verifica si el atributo del medio es válido. Ni siquiera verificamos que este atributo sea OVS_KEY_ATTR_NSH. Simplemente hacemos un doble unwrap con un par de llamadas a nla_data() - la primera vez directamente al llamar a validate_push_nsh() y la segunda vez como parte de la macro nla_for_each_nested(), lo cual no es seguro, pudiendo causar acceso a memoria inválido si el tamaño de este atributo es incorrecto. El fallo podría no ser notado durante la validación debido a un búfer netlink más grande, pero causar problemas más tarde durante la ejecución de la acción donde el búfer se asigna exactamente al tamaño:\n\n BUG: KASAN: slab-out-of-bounds en nsh_hdr_from_nlattr+0x1dd/0x6a0 [openvswitch]\n Lectura de tamaño 184 en la dirección ffff88816459a634 por la tarea a.out/22624\n\n CPU: 8 UID: 0 PID: 22624 6.18.0-rc7+ #115 PREEMPT(voluntary)\n Traza de Llamadas:\n  \n  dump_stack_lvl+0x51/0x70\n  print_address_description.constprop.0+0x2c/0x390\n  kasan_report+0xdd/0x110\n  kasan_check_range+0x35/0x1b0\n  __asan_memcpy+0x20/0x60\n  nsh_hdr_from_nlattr+0x1dd/0x6a0 [openvswitch]\n  push_nsh+0x82/0x120 [openvswitch]\n  do_execute_actions+0x1405/0x2840 [openvswitch]\n  ovs_execute_actions+0xd5/0x3b0 [openvswitch]\n  ovs_packet_cmd_execute+0x949/0xdb0 [openvswitch]\n  genl_family_rcv_msg_doit+0x1d6/0x2b0\n  genl_family_rcv_msg+0x336/0x580\n  genl_rcv_msg+0x9f/0x130\n  netlink_rcv_skb+0x11f/0x370\n  genl_rcv+0x24/0x40\n  netlink_unicast+0x73e/0xaa0\n  netlink_sendmsg+0x744/0xbf0\n  __sys_sendto+0x3d6/0x450\n  do_syscall_64+0x79/0x2c0\n  entry_SYSCALL_64_after_hwframe+0x76/0x7e\n  \n\nAñadamos algunas verificaciones de que el atributo tiene el tamaño adecuado y es el único atributo dentro de la acción. Técnicamente, no hay una razón real para que OVS_KEY_ATTR_NSH esté allí, ya que sabemos que ya estamos pusheando un encabezado NSH, solo crea anidamiento adicional, pero así es como funciona la uAPI hoy. Así que, lo mantenemos como está.","source":"nvd"}],"published":"2026-01-13T15:28:58.930Z","modified":"2026-10-19T19:17:04.873Z","severity":{"scorer":"Linux","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"},"severities":[{"scorer":"Linux","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":"b2d0f5d5dc53532e6f07bc546a476a55ebdfe0f3","fixed":"d0c135b8bbbcf92836068fd395bebeb7ae6c7bef","status":"affected"},{"type":"git","introduced":"b2d0f5d5dc53532e6f07bc546a476a55ebdfe0f3","fixed":"3bc2efff20a38b2c7ca18317649715df0dd62ced","status":"affected"},{"type":"git","introduced":"b2d0f5d5dc53532e6f07bc546a476a55ebdfe0f3","fixed":"1b569db9c2f28b599e40050524aae5f7332bc294","status":"affected"},{"type":"git","introduced":"b2d0f5d5dc53532e6f07bc546a476a55ebdfe0f3","fixed":"10ffc558246f2c75619aedda0921906095e46702","status":"affected"},{"type":"git","introduced":"b2d0f5d5dc53532e6f07bc546a476a55ebdfe0f3","fixed":"2ecfc4433acdb149eafd7fb22d7fd4adf90b25e9","status":"affected"},{"type":"git","introduced":"b2d0f5d5dc53532e6f07bc546a476a55ebdfe0f3","fixed":"c999153bfb2d1d9b295b7010d920f2a7c6d7595f","status":"affected"},{"type":"git","introduced":"b2d0f5d5dc53532e6f07bc546a476a55ebdfe0f3","fixed":"5ace7ef87f059d68b5f50837ef3e8a1a4870c36e","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"4.15","status":"affected"},{"type":"semver","introduced":"0","fixed":"4.15","status":"unaffected"},{"type":"semver","introduced":"5.10.248","lastAffected":"5.10.*","status":"unaffected"},{"type":"semver","introduced":"5.15.198","lastAffected":"5.15.*","status":"unaffected"},{"type":"semver","introduced":"6.1.160","lastAffected":"6.1.*","status":"unaffected"},{"type":"semver","introduced":"6.6.120","lastAffected":"6.6.*","status":"unaffected"},{"type":"semver","introduced":"6.12.64","lastAffected":"6.12.*","status":"unaffected"},{"type":"semver","introduced":"6.18.3","lastAffected":"6.18.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"6.19","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/d0c135b8bbbcf92836068fd395bebeb7ae6c7bef","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/3bc2efff20a38b2c7ca18317649715df0dd62ced","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/1b569db9c2f28b599e40050524aae5f7332bc294","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/10ffc558246f2c75619aedda0921906095e46702","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/2ecfc4433acdb149eafd7fb22d7fd4adf90b25e9","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/c999153bfb2d1d9b295b7010d920f2a7c6d7595f","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/5ace7ef87f059d68b5f50837ef3e8a1a4870c36e","tags":[],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-06-16T19:21:59.526Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-68785","url":"https://www.cve.org/CVERecord?id=CVE-2025-68785","licence":"CVE Terms of Use","modified":"2026-10-19T18:05:07.113Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-68785","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-68785","licence":"Public domain","modified":"2026-10-19T19:17:04.873Z"}],"updatedAt":"2026-11-25T22:59:10.530Z","epss":{"score":0.00159,"percentile":0.05324,"date":"2026-12-01T12:00:22.000Z"}}