{"id":"CVE-2021-47515","aliases":["CVE-2021-47515"],"related":[],"kind":"vulnerability","state":"published","title":"seg6: fix the iif in the IPv6 socket control block","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\nseg6: fix the iif in the IPv6 socket control block\n\nWhen an IPv4 packet is received, the ip_rcv_core(...) sets the receiving\ninterface index into the IPv4 socket control block (v5.16-rc4,\nnet/ipv4/ip_input.c line 510):\n\n    IPCB(skb)->iif = skb->skb_iif;\n\nIf that IPv4 packet is meant to be encapsulated in an outer IPv6+SRH\nheader, the seg6_do_srh_encap(...) performs the required encapsulation.\nIn this case, the seg6_do_srh_encap function clears the IPv6 socket control\nblock (v5.16-rc4 net/ipv6/seg6_iptunnel.c line 163):\n\n    memset(IP6CB(skb), 0, sizeof(*IP6CB(skb)));\n\nThe memset(...) was introduced in commit ef489749aae5 (\"ipv6: sr: clear\nIP6CB(skb) on SRH ip4ip6 encapsulation\") a long time ago (2019-01-29).\n\nSince the IPv6 socket control block and the IPv4 socket control block share\nthe same memory area (skb->cb), the receiving interface index info is lost\n(IP6CB(skb)->iif is set to zero).\n\nAs a side effect, that condition triggers a NULL pointer dereference if\ncommit 0857d6f8c759 (\"ipv6: When forwarding count rx stats on the orig\nnetdev\") is applied.\n\nTo fix that issue, we set the IP6CB(skb)->iif with the index of the\nreceiving interface once again.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\nseg6: fix the iif in the IPv6 socket control block\n\nWhen an IPv4 packet is received, the ip_rcv_core(...) sets the receiving\ninterface index into the IPv4 socket control block (v5.16-rc4,\nnet/ipv4/ip_input.c line 510):\n\n    IPCB(skb)->iif = skb->skb_iif;\n\nIf that IPv4 packet is meant to be encapsulated in an outer IPv6+SRH\nheader, the seg6_do_srh_encap(...) performs the required encapsulation.\nIn this case, the seg6_do_srh_encap function clears the IPv6 socket control\nblock (v5.16-rc4 net/ipv6/seg6_iptunnel.c line 163):\n\n    memset(IP6CB(skb), 0, sizeof(*IP6CB(skb)));\n\nThe memset(...) was introduced in commit ef489749aae5 (\"ipv6: sr: clear\nIP6CB(skb) on SRH ip4ip6 encapsulation\") a long time ago (2019-01-29).\n\nSince the IPv6 socket control block and the IPv4 socket control block share\nthe same memory area (skb->cb), the receiving interface index info is lost\n(IP6CB(skb)->iif is set to zero).\n\nAs a side effect, that condition triggers a NULL pointer dereference if\ncommit 0857d6f8c759 (\"ipv6: When forwarding count rx stats on the orig\nnetdev\") is applied.\n\nTo fix that issue, we set the IP6CB(skb)->iif with the index of the\nreceiving interface once again.","source":"cvelist"},{"lang":"es","text":"En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: seg6: corrige el iif en el bloque de control del socket IPv6 Cuando se recibe un paquete IPv4, ip_rcv_core(...) establece el índice de la interfaz de recepción en el bloque de control del socket IPv4 (v5 .16-rc4, net/ipv4/ip_input.c línea 510): IPCB(skb)-&gt;iif = skb-&gt;skb_iif; Si ese paquete IPv4 debe encapsularse en un encabezado IPv6+SRH externo, seg6_do_srh_encap(...) realiza la encapsulación requerida. En este caso, la función seg6_do_srh_encap borra el bloque de control del socket IPv6 (v5.16-rc4 net/ipv6/seg6_iptunnel.c línea 163): memset(IP6CB(skb), 0, sizeof(*IP6CB(skb))); El memset(...) se introdujo en El commit ef489749aae5 (\"ipv6: sr: clear IP6CB(skb) en la encapsulación SRH ip4ip6\") hace mucho tiempo (29 de enero de 2019). Dado que el bloque de control del socket IPv6 y el bloque de control del socket IPv4 comparten la misma área de memoria (skb-&gt;cb), la información del índice de la interfaz de recepción se pierde (IP6CB(skb)-&gt;iif se establece en cero). Como efecto secundario, esa condición desencadena una desreferencia del puntero NULL si se aplica el commit 0857d6f8c759 (\"ipv6: al reenviar estadísticas de recuento de rx en el netdev original\"). Para solucionar ese problema, configuramos IP6CB(skb)-&gt;iif con el índice de la interfaz de recepción una vez más.","source":"nvd"}],"published":"2024-05-24T15:09:29.334Z","modified":"2026-08-05T08:48:12.387Z","severity":{"scorer":"Linux","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"Linux","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","score":7.5,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.5,"rating":"MEDIUM"}],"cwes":["CWE-476"],"affected":[{"ranges":[{"type":"git","introduced":"c630ec8bdadae9d557b1ceb9d6c06e149108a0d4","fixed":"b16d412e5f79734033df04e97d7ea2f50a8e9fe3","status":"affected"},{"type":"git","introduced":"2f704348c93ff8119e642dae6a72327f90b82810","fixed":"6431e71093f3da586a00c6d931481ffb0dc2db0e","status":"affected"},{"type":"git","introduced":"ef489749aae508e6f17886775c075f12ff919fb1","fixed":"ef8804e47c0a44ae106ead1740408af5ea6c6ee9","status":"affected"},{"type":"git","introduced":"ef489749aae508e6f17886775c075f12ff919fb1","fixed":"666521b3852d2b2f52d570f9122b1e4b50d96831","status":"affected"},{"type":"git","introduced":"ef489749aae508e6f17886775c075f12ff919fb1","fixed":"98adb2bbfa407c9290bda299d4c6f7a1c4ebd5e1","status":"affected"},{"type":"git","introduced":"ef489749aae508e6f17886775c075f12ff919fb1","fixed":"ae68d93354e5bf5191ee673982251864ea24dd5c","status":"affected"},{"type":"git","version":"b71b7e0280f47b4ac633fbfd153423814ea87810","status":"affected"},{"type":"semver","introduced":"4.14.98","fixed":"4.14.258","status":"affected"},{"type":"semver","introduced":"4.19.20","fixed":"4.19.221","status":"affected"},{"type":"semver","introduced":"4.20.7","fixed":"4.21","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"5.0","status":"affected"},{"type":"semver","introduced":"0","fixed":"5.0","status":"unaffected"},{"type":"semver","introduced":"4.14.258","lastAffected":"4.14.*","status":"unaffected"},{"type":"semver","introduced":"4.19.221","lastAffected":"4.19.*","status":"unaffected"},{"type":"semver","introduced":"5.4.165","lastAffected":"5.4.*","status":"unaffected"},{"type":"semver","introduced":"5.10.85","lastAffected":"5.10.*","status":"unaffected"},{"type":"semver","introduced":"5.15.8","lastAffected":"5.15.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"5.16","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.14.98","fixed":"4.14.258"},{"status":"affected","introduced":"4.19.20","fixed":"4.19.221"},{"status":"affected","introduced":"4.20.7","fixed":"5.0"},{"status":"affected","introduced":"5.0.1","fixed":"5.4.165"},{"status":"affected","introduced":"5.5","fixed":"5.10.85"},{"status":"affected","introduced":"5.11","fixed":"5.15.8"},{"status":"affected","version":"5.0"},{"status":"affected","version":"5.0"},{"status":"affected","version":"5.0"},{"status":"affected","version":"5.0"},{"status":"affected","version":"5.16"},{"status":"affected","version":"5.16"},{"status":"affected","version":"5.16"},{"status":"affected","version":"5.16"}],"vendor":"linux","product":"linux_kernel","cpe":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://git.kernel.org/stable/c/b16d412e5f79734033df04e97d7ea2f50a8e9fe3","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/6431e71093f3da586a00c6d931481ffb0dc2db0e","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/ef8804e47c0a44ae106ead1740408af5ea6c6ee9","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/666521b3852d2b2f52d570f9122b1e4b50d96831","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/98adb2bbfa407c9290bda299d4c6f7a1c4ebd5e1","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/ae68d93354e5bf5191ee673982251864ea24dd5c","tags":["patch","x-transferred"],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2024-09-10T15:35:33.340Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2021-47515","url":"https://www.cve.org/CVERecord?id=CVE-2021-47515","licence":"CVE Terms of Use","modified":"2026-08-05T08:48:12.387Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-47515","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-47515","licence":"Public domain","modified":"2026-08-04T10:17:06.950Z"}],"updatedAt":"2026-11-25T22:58:08.895Z","epss":{"score":0.00752,"percentile":0.56248,"date":"2026-12-01T12:00:22.000Z"}}