{"id":"CVE-2025-40123","sourceIdentifier":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","published":"2025-11-12T11:15:41.807","lastModified":"2026-10-19T21:10:00.160","vulnStatus":"Deferred","cveTags":[],"descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Enforce expected_attach_type for tailcall compatibility\n\nYinhao et al. recently reported:\n\n  Our fuzzer tool discovered an uninitialized pointer issue in the\n  bpf_prog_test_run_xdp() function within the Linux kernel's BPF subsystem.\n  This leads to a NULL pointer dereference when a BPF program attempts to\n  deference the txq member of struct xdp_buff object.\n\nThe test initializes two programs of BPF_PROG_TYPE_XDP: progA acts as the\nentry point for bpf_prog_test_run_xdp() and its expected_attach_type can\nneither be of be BPF_XDP_DEVMAP nor BPF_XDP_CPUMAP. progA calls into a slot\nof a tailcall map it owns. progB's expected_attach_type must be BPF_XDP_DEVMAP\nto pass xdp_is_valid_access() validation. The program returns struct xdp_md's\negress_ifindex, and the latter is only allowed to be accessed under mentioned\nexpected_attach_type. progB is then inserted into the tailcall which progA\ncalls.\n\nThe underlying issue goes beyond XDP though. Another example are programs\nof type BPF_PROG_TYPE_CGROUP_SOCK_ADDR. sock_addr_is_valid_access() as well\nas sock_addr_func_proto() have different logic depending on the programs'\nexpected_attach_type. Similarly, a program attached to BPF_CGROUP_INET4_GETPEERNAME\nshould not be allowed doing a tailcall into a program which calls bpf_bind()\nout of BPF which is only enabled for BPF_CGROUP_INET4_CONNECT.\n\nIn short, specifying expected_attach_type allows to open up additional\nfunctionality or restrictions beyond what the basic bpf_prog_type enables.\nThe use of tailcalls must not violate these constraints. Fix it by enforcing\nexpected_attach_type in __bpf_prog_map_compatible().\n\nNote that we only enforce this for tailcall maps, but not for BPF devmaps or\ncpumaps: There, the programs are invoked through dev_map_bpf_prog_run*() and\ncpu_map_bpf_prog_run*() which set up a new environment / context and therefore\nthese situations are not prone to this issue."},{"lang":"es","value":"En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta:\n\nbpf: Hacer cumplir expected_attach_type para la compatibilidad de tailcall\n\nYinhao et al. informaron recientemente:\n\n  Nuestra herramienta de fuzzing descubrió un problema de puntero no\n  inicializado en la función bpf_prog_test_run_xdp() dentro del subsistema\n  BPF del kernel de Linux. Esto lleva a una desreferencia de puntero NULL\n  cuando un programa BPF intenta desreferenciar el miembro txq del objeto\n  struct xdp_buff.\n\nLa prueba inicializa dos programas de BPF_PROG_TYPE_XDP: progA actúa como\npunto de entrada para bpf_prog_test_run_xdp() y su expected_attach_type no\npuede ser ni BPF_XDP_DEVMAP ni BPF_XDP_CPUMAP. progA llama a una ranura de\nun mapa de tailcall que posee. El expected_attach_type de progB debe ser\nBPF_XDP_DEVMAP para pasar la validación de xdp_is_valid_access(). El\nprograma devuelve el egress_ifindex de struct xdp_md, y este último solo\npuede ser accedido bajo el expected_attach_type mencionado. progB se inserta\nentonces en el tailcall al que llama progA.\n\nSin embargo, el problema subyacente va más allá de XDP. Otro ejemplo son los\nprogramas de tipo BPF_PROG_TYPE_CGROUP_SOCK_ADDR. sock_addr_is_valid_access()\nasí como sock_addr_func_proto() tienen lógica diferente dependiendo del\nexpected_attach_type de los programas. De manera similar, un programa\nadjunto a BPF_CGROUP_INET4_GETPEERNAME no debería permitírsele hacer un\ntailcall a un programa que llama a bpf_bind() fuera de BPF, lo cual solo\nestá habilitado para BPF_CGROUP_INET4_CONNECT.\n\nEn resumen, especificar expected_attach_type permite habilitar funcionalidad\no restricciones adicionales más allá de lo que permite el bpf_prog_type\nbásico. El uso de tailcalls no debe violar estas restricciones. Se soluciona\nhaciendo cumplir expected_attach_type en __bpf_prog_map_compatible().\n\nTenga en cuenta que solo hacemos cumplir esto para los mapas de tailcall,\npero no para los devmaps o cpumaps de BPF: Allí, los programas se invocan a\ntravés de dev_map_bpf_prog_run*() y cpu_map_bpf_prog_run*() que configuran\nun nuevo entorno/contexto y, por lo tanto, estas situaciones no son\npropensas a este problema."}],"affected":[{"source":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","affectedData":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","programFiles":["include/linux/bpf.h","kernel/bpf/core.c"],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","versions":[{"version":"5e43f899b03a3492ce5fc44e8900becb04dae9c0","lessThan":"e53a59e7cee5c1605d1ed595933098c2b69108f9","versionType":"git","status":"affected"},{"version":"5e43f899b03a3492ce5fc44e8900becb04dae9c0","lessThan":"dc4f348952173beb8ceb15be30b249276eccb605","versionType":"git","status":"affected"},{"version":"5e43f899b03a3492ce5fc44e8900becb04dae9c0","lessThan":"a99de19128aec0913f3d529f529fbbff5edfaff8","versionType":"git","status":"affected"},{"version":"5e43f899b03a3492ce5fc44e8900becb04dae9c0","lessThan":"08cb3dc9d2b44f153d0bcf2cb966e4a94b5d0f32","versionType":"git","status":"affected"},{"version":"5e43f899b03a3492ce5fc44e8900becb04dae9c0","lessThan":"f856c598080ba7ce1252867b8ecd6ad5bdaf9a6a","versionType":"git","status":"affected"},{"version":"5e43f899b03a3492ce5fc44e8900becb04dae9c0","lessThan":"c1ad19b5d8e23123503dcaf2d4342e1b90b923ad","versionType":"git","status":"affected"},{"version":"5e43f899b03a3492ce5fc44e8900becb04dae9c0","lessThan":"4540aed51b12bc13364149bf95f6ecef013197c0","versionType":"git","status":"affected"}]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","programFiles":["include/linux/bpf.h","kernel/bpf/core.c"],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","versions":[{"version":"4.17","status":"affected"},{"version":"0","lessThan":"4.17","versionType":"semver","status":"unaffected"},{"version":"5.10.270","lessThanOrEqual":"5.10.*","versionType":"semver","status":"unaffected"},{"version":"5.15.221","lessThanOrEqual":"5.15.*","versionType":"semver","status":"unaffected"},{"version":"6.1.156","lessThanOrEqual":"6.1.*","versionType":"semver","status":"unaffected"},{"version":"6.6.112","lessThanOrEqual":"6.6.*","versionType":"semver","status":"unaffected"},{"version":"6.12.53","lessThanOrEqual":"6.12.*","versionType":"semver","status":"unaffected"},{"version":"6.17.3","lessThanOrEqual":"6.17.*","versionType":"semver","status":"unaffected"},{"version":"6.18","lessThanOrEqual":"*","versionType":"original_commit_for_fix","status":"unaffected"}]}]}],"metrics":{"cvssMetricV31":[{"source":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","type":"Secondary","cvssData":{"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","attackVector":"LOCAL","attackComplexity":"LOW","privilegesRequired":"LOW","userInteraction":"NONE","scope":"UNCHANGED","confidentialityImpact":"HIGH","integrityImpact":"HIGH","availabilityImpact":"HIGH"},"exploitabilityScore":1.8,"impactScore":5.9}],"ssvcV203":[{"source":"134c704f-9b21-4f2e-91b3-4a467353bcc0","ssvcData":{"timestamp":"2026-10-15T21:57:04.979824Z","id":"CVE-2025-40123","options":[{"exploitation":"none"},{"automatable":"no"},{"technicalImpact":"total"}],"role":"CISA Coordinator","version":"2.0.3"}}]},"references":[{"url":"https://git.kernel.org/stable/c/08cb3dc9d2b44f153d0bcf2cb966e4a94b5d0f32","source":"416baaa9-dc9f-4396-8d5f-8c081fb06d67"},{"url":"https://git.kernel.org/stable/c/4540aed51b12bc13364149bf95f6ecef013197c0","source":"416baaa9-dc9f-4396-8d5f-8c081fb06d67"},{"url":"https://git.kernel.org/stable/c/a99de19128aec0913f3d529f529fbbff5edfaff8","source":"416baaa9-dc9f-4396-8d5f-8c081fb06d67"},{"url":"https://git.kernel.org/stable/c/c1ad19b5d8e23123503dcaf2d4342e1b90b923ad","source":"416baaa9-dc9f-4396-8d5f-8c081fb06d67"},{"url":"https://git.kernel.org/stable/c/dc4f348952173beb8ceb15be30b249276eccb605","source":"416baaa9-dc9f-4396-8d5f-8c081fb06d67"},{"url":"https://git.kernel.org/stable/c/e53a59e7cee5c1605d1ed595933098c2b69108f9","source":"416baaa9-dc9f-4396-8d5f-8c081fb06d67"},{"url":"https://git.kernel.org/stable/c/f856c598080ba7ce1252867b8ecd6ad5bdaf9a6a","source":"416baaa9-dc9f-4396-8d5f-8c081fb06d67"}]}