{
    "dataType": "CVE_RECORD",
    "dataVersion": "5.2",
    "cveMetadata": {
        "cveId": "CVE-2025-21678",
        "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "state": "PUBLISHED",
        "assignerShortName": "Linux",
        "dateReserved": "2024-12-29T08:45:45.738Z",
        "datePublished": "2025-01-31T11:25:39.500Z",
        "dateUpdated": "2026-08-05T11:53:34.427Z"
    },
    "containers": {
        "cna": {
            "providerMetadata": {
                "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
                "shortName": "Linux",
                "dateUpdated": "2026-08-05T11:53:34.427Z"
            },
            "descriptions": [
                {
                    "lang": "en",
                    "value": "In the Linux kernel, the following vulnerability has been resolved:\n\ngtp: Destroy device along with udp socket's netns dismantle.\n\ngtp_newlink() links the device to a list in dev_net(dev) instead of\nsrc_net, where a udp tunnel socket is created.\n\nEven when src_net is removed, the device stays alive on dev_net(dev).\nThen, removing src_net triggers the splat below. [0]\n\nIn this example, gtp0 is created in ns2, and the udp socket is created\nin ns1.\n\n  ip netns add ns1\n  ip netns add ns2\n  ip -n ns1 link add netns ns2 name gtp0 type gtp role sgsn\n  ip netns del ns1\n\nLet's link the device to the socket's netns instead.\n\nNow, gtp_net_exit_batch_rtnl() needs another netdev iteration to remove\nall gtp devices in the netns.\n\n[0]:\nref_tracker: net notrefcnt@000000003d6e7d05 has 1/2 users at\n     sk_alloc (./include/net/net_namespace.h:345 net/core/sock.c:2236)\n     inet_create (net/ipv4/af_inet.c:326 net/ipv4/af_inet.c:252)\n     __sock_create (net/socket.c:1558)\n     udp_sock_create4 (net/ipv4/udp_tunnel_core.c:18)\n     gtp_create_sock (./include/net/udp_tunnel.h:59 drivers/net/gtp.c:1423)\n     gtp_create_sockets (drivers/net/gtp.c:1447)\n     gtp_newlink (drivers/net/gtp.c:1507)\n     rtnl_newlink (net/core/rtnetlink.c:3786 net/core/rtnetlink.c:3897 net/core/rtnetlink.c:4012)\n     rtnetlink_rcv_msg (net/core/rtnetlink.c:6922)\n     netlink_rcv_skb (net/netlink/af_netlink.c:2542)\n     netlink_unicast (net/netlink/af_netlink.c:1321 net/netlink/af_netlink.c:1347)\n     netlink_sendmsg (net/netlink/af_netlink.c:1891)\n     ____sys_sendmsg (net/socket.c:711 net/socket.c:726 net/socket.c:2583)\n     ___sys_sendmsg (net/socket.c:2639)\n     __sys_sendmsg (net/socket.c:2669)\n     do_syscall_64 (arch/x86/entry/common.c:52 arch/x86/entry/common.c:83)\n\nWARNING: CPU: 1 PID: 60 at lib/ref_tracker.c:179 ref_tracker_dir_exit (lib/ref_tracker.c:179)\nModules linked in:\nCPU: 1 UID: 0 PID: 60 Comm: kworker/u16:2 Not tainted 6.13.0-rc5-00147-g4c1224501e9d #5\nHardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014\nWorkqueue: netns cleanup_net\nRIP: 0010:ref_tracker_dir_exit (lib/ref_tracker.c:179)\nCode: 00 00 00 fc ff df 4d 8b 26 49 bd 00 01 00 00 00 00 ad de 4c 39 f5 0f 85 df 00 00 00 48 8b 74 24 08 48 89 df e8 a5 cc 12 02 90 <0f> 0b 90 48 8d 6b 44 be 04 00 00 00 48 89 ef e8 80 de 67 ff 48 89\nRSP: 0018:ff11000009a07b60 EFLAGS: 00010286\nRAX: 0000000000002bd3 RBX: ff1100000f4e1aa0 RCX: 1ffffffff0e40ac6\nRDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff8423ee3c\nRBP: ff1100000f4e1af0 R08: 0000000000000001 R09: fffffbfff0e395ae\nR10: 0000000000000001 R11: 0000000000036001 R12: ff1100000f4e1af0\nR13: dead000000000100 R14: ff1100000f4e1af0 R15: dffffc0000000000\nFS:  0000000000000000(0000) GS:ff1100006ce80000(0000) knlGS:0000000000000000\nCS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033\nCR2: 00007f9b2464bd98 CR3: 0000000005286005 CR4: 0000000000771ef0\nDR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000\nDR3: 0000000000000000 DR6: 00000000fffe07f0 DR7: 0000000000000400\nPKRU: 55555554\nCall Trace:\n <TASK>\n ? __warn (kernel/panic.c:748)\n ? ref_tracker_dir_exit (lib/ref_tracker.c:179)\n ? report_bug (lib/bug.c:201 lib/bug.c:219)\n ? handle_bug (arch/x86/kernel/traps.c:285)\n ? exc_invalid_op (arch/x86/kernel/traps.c:309 (discriminator 1))\n ? asm_exc_invalid_op (./arch/x86/include/asm/idtentry.h:621)\n ? _raw_spin_unlock_irqrestore (./arch/x86/include/asm/irqflags.h:42 ./arch/x86/include/asm/irqflags.h:97 ./arch/x86/include/asm/irqflags.h:155 ./include/linux/spinlock_api_smp.h:151 kernel/locking/spinlock.c:194)\n ? ref_tracker_dir_exit (lib/ref_tracker.c:179)\n ? __pfx_ref_tracker_dir_exit (lib/ref_tracker.c:158)\n ? kfree (mm/slub.c:4613 mm/slub.c:4761)\n net_free (net/core/net_namespace.c:476 net/core/net_namespace.c:467)\n cleanup_net (net/core/net_namespace.c:664 (discriminator 3))\n process_one_work (kernel/workqueue.c:3229)\n worker_thread (kernel/workqueue.c:3304 kernel/workqueue.c:3391\n---truncated---"
                }
            ],
            "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 vulnerability is triggered entirely through local syscalls — an RTM_NEWLINK netlink message creating a GTP device with the link in a different netns than the netlink socket, followed by teardown of that netns. No remote packet processing is involved in reaching the bug.\nAC:L - The four-command reproducer in the commit message triggers it deterministically with no race and no dependence on uncontrolled memory layout; reoccupying the freed struct net is done by simply calling unshare(CLONE_NEWNET), which is fully under attacker control.\nPR:L - Both gates on the path (netlink_net_capable and rtnl_link_get_net_capable) check CAP_NET_ADMIN against net->user_ns, which an unprivileged user obtains for netns it creates via `unshare -Urn`; the gtp module is autoloaded on demand from the same path.\nUI:N - The attacker performs every step — creating the namespaces, creating the GTP link, and destroying the socket's namespace — with no action required from any other user.\nS:U - The dangling struct net pointer and the resulting corruption are confined to the kernel's own security authority; there is no hypervisor, IOMMU, or other authority boundary crossed.\nC:H - This is a use-after-free of struct net whose freed slab object the attacker can deterministically reoccupy, so subsequent reads through gtp->net and sock_net(sk) return attacker-groomed contents and route/socket lookups are performed against a foreign namespace's tables, enabling information disclosure.\nI:H - The teardown path performs __netns_tracker_free() on the freed net — a spinlock acquisition and list_del() into freed memory — giving a write-after-free/unlink primitive, and the aliased netns allows packets to be routed and sockets to be hashed into a namespace the attacker does not own.\nA:H - The bug reliably produces a ref_tracker_dir_exit() WARNING splat in cleanup_net (a panic under panic_on_warn), and the subsequent use-after-free of struct net causes kernel oopses/panics on device teardown or transmit."
                        }
                    ]
                }
            ],
            "affected": [
                {
                    "product": "Linux",
                    "vendor": "Linux",
                    "defaultStatus": "unaffected",
                    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                    "programFiles": [
                        "drivers/net/gtp.c"
                    ],
                    "versions": [
                        {
                            "version": "459aa660eb1d8ce67080da1983bb81d716aa5a69",
                            "lessThan": "c986380c1d5274c4d5e935addc807d6791cc23eb",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "459aa660eb1d8ce67080da1983bb81d716aa5a69",
                            "lessThan": "5f1678346109ff3a6d229d33437fcba3cce9209d",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "459aa660eb1d8ce67080da1983bb81d716aa5a69",
                            "lessThan": "036f8d814a2cd11ee8ef62b8f3e7ce5dec0ee4f3",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "459aa660eb1d8ce67080da1983bb81d716aa5a69",
                            "lessThan": "efec287cbac92ac6ee8312a89221854760e13b34",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "459aa660eb1d8ce67080da1983bb81d716aa5a69",
                            "lessThan": "bb11f992f5a475bc68ef959f17a55306f0328495",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "459aa660eb1d8ce67080da1983bb81d716aa5a69",
                            "lessThan": "86f73d4ab2f27deeff22ba9336ad103d94f12ac7",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "459aa660eb1d8ce67080da1983bb81d716aa5a69",
                            "lessThan": "eb28fd76c0a08a47b470677c6cef9dd1c60e92d1",
                            "status": "affected",
                            "versionType": "git"
                        }
                    ]
                },
                {
                    "product": "Linux",
                    "vendor": "Linux",
                    "defaultStatus": "affected",
                    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                    "programFiles": [
                        "drivers/net/gtp.c"
                    ],
                    "versions": [
                        {
                            "version": "4.7",
                            "status": "affected"
                        },
                        {
                            "version": "0",
                            "lessThan": "4.7",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "5.4.290",
                            "lessThanOrEqual": "5.4.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "5.10.234",
                            "lessThanOrEqual": "5.10.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "5.15.177",
                            "lessThanOrEqual": "5.15.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.1.127",
                            "lessThanOrEqual": "6.1.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.6.74",
                            "lessThanOrEqual": "6.6.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.12.11",
                            "lessThanOrEqual": "6.12.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.13",
                            "lessThanOrEqual": "*",
                            "status": "unaffected",
                            "versionType": "original_commit_for_fix"
                        }
                    ]
                }
            ],
            "cpeApplicability": [
                {
                    "nodes": [
                        {
                            "operator": "OR",
                            "negate": false,
                            "cpeMatch": [
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "4.7",
                                    "versionEndExcluding": "5.4.290"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "4.7",
                                    "versionEndExcluding": "5.10.234"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "4.7",
                                    "versionEndExcluding": "5.15.177"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "4.7",
                                    "versionEndExcluding": "6.1.127"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "4.7",
                                    "versionEndExcluding": "6.6.74"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "4.7",
                                    "versionEndExcluding": "6.12.11"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "4.7",
                                    "versionEndExcluding": "6.13"
                                }
                            ]
                        }
                    ]
                }
            ],
            "references": [
                {
                    "url": "https://git.kernel.org/stable/c/c986380c1d5274c4d5e935addc807d6791cc23eb"
                },
                {
                    "url": "https://git.kernel.org/stable/c/5f1678346109ff3a6d229d33437fcba3cce9209d"
                },
                {
                    "url": "https://git.kernel.org/stable/c/036f8d814a2cd11ee8ef62b8f3e7ce5dec0ee4f3"
                },
                {
                    "url": "https://git.kernel.org/stable/c/efec287cbac92ac6ee8312a89221854760e13b34"
                },
                {
                    "url": "https://git.kernel.org/stable/c/bb11f992f5a475bc68ef959f17a55306f0328495"
                },
                {
                    "url": "https://git.kernel.org/stable/c/86f73d4ab2f27deeff22ba9336ad103d94f12ac7"
                },
                {
                    "url": "https://git.kernel.org/stable/c/eb28fd76c0a08a47b470677c6cef9dd1c60e92d1"
                }
            ],
            "title": "gtp: Destroy device along with udp socket's netns dismantle.",
            "x_generator": {
                "engine": "bippy-1.2.0"
            }
        },
        "adp": [
            {
                "title": "CVE Program Container",
                "references": [
                    {
                        "url": "https://lists.debian.org/debian-lts-announce/2025/03/msg00001.html"
                    },
                    {
                        "url": "https://lists.debian.org/debian-lts-announce/2025/03/msg00002.html"
                    }
                ],
                "providerMetadata": {
                    "orgId": "af854a3a-2127-422b-91ae-364da2661108",
                    "shortName": "CVE",
                    "dateUpdated": "2025-11-03T20:58:55.888Z"
                }
            },
            {
                "x_adpType": "supplier",
                "providerMetadata": {
                    "orgId": "0b142b55-0307-4c5a-b3c9-f314f3fb7c5e",
                    "shortName": "siemens-SADP",
                    "dateUpdated": "2026-05-12T12:03:10.577Z"
                },
                "affected": [
                    {
                        "vendor": "Siemens",
                        "product": "SIMATIC S7-1500 TM MFP - BIOS",
                        "versions": [
                            {
                                "status": "affected",
                                "version": "0",
                                "lessThan": "*",
                                "versionType": "custom"
                            }
                        ],
                        "defaultStatus": "unknown"
                    },
                    {
                        "vendor": "Siemens",
                        "product": "SIMATIC S7-1500 TM MFP - GNU/Linux subsystem",
                        "versions": [
                            {
                                "status": "affected",
                                "version": "0",
                                "lessThan": "*",
                                "versionType": "custom"
                            }
                        ],
                        "defaultStatus": "unknown"
                    }
                ],
                "references": [
                    {
                        "url": "https://cert-portal.siemens.com/productcert/html/ssa-265688.html"
                    },
                    {
                        "url": "https://cert-portal.siemens.com/productcert/html/ssa-503939.html"
                    }
                ]
            }
        ]
    }
}