{
    "dataType": "CVE_RECORD",
    "dataVersion": "5.2",
    "cveMetadata": {
        "cveId": "CVE-2025-38717",
        "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "state": "PUBLISHED",
        "assignerShortName": "Linux",
        "dateReserved": "2025-04-16T04:51:24.033Z",
        "datePublished": "2025-09-04T15:33:11.686Z",
        "dateUpdated": "2026-08-05T12:04:14.893Z"
    },
    "containers": {
        "cna": {
            "providerMetadata": {
                "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
                "shortName": "Linux",
                "dateUpdated": "2026-08-05T12:04:14.893Z"
            },
            "descriptions": [
                {
                    "lang": "en",
                    "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nnet: kcm: Fix race condition in kcm_unattach()\n\nsyzbot found a race condition when kcm_unattach(psock)\nand kcm_release(kcm) are executed at the same time.\n\nkcm_unattach() is missing a check of the flag\nkcm->tx_stopped before calling queue_work().\n\nIf the kcm has a reserved psock, kcm_unattach() might get executed\nbetween cancel_work_sync() and unreserve_psock() in kcm_release(),\nrequeuing kcm->tx_work right before kcm gets freed in kcm_done().\n\nRemove kcm->tx_stopped and replace it by the less\nerror-prone disable_work_sync()."
                }
            ],
            "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 race is driven entirely by local syscalls — creating an AF_KCM socket, `SIOCKCMATTACH`/`SIOCKCMUNATTACH` ioctls, and `close()` — with no remote packet needed to reach the vulnerable window. No network-facing service parses attacker data on this path.\nAC:L - The attacker controls both sides of the race, running `kcm_release()` in one thread while a second thread issues `SIOCKCMUNATTACH` on the reserved psock, and can retry the loop indefinitely until the window between `cancel_work_sync()` and `unreserve_psock()` is hit. syzbot hit it repeatedly with three separate reproducers, and `CONFIG_AF_KCM` is shipped as a module by major distributions.\nPR:L - There is not a single `capable()` or `CAP_NET_ADMIN` check in `net/kcm/`, and the protocol family autoloads on an unprivileged `socket(AF_KCM, ...)` call via `MODULE_ALIAS_NETPROTO(PF_KCM)`. Any local unprivileged user can attach a TCP socket and trigger the race.\nUI:N - The attacker performs every step — socket creation, attach, unattach, and close — from its own threads. No victim action or cooperation is required.\nS:U - The use-after-free corrupts kernel heap memory within the same kernel security authority; there is no VM, IOMMU, or sandbox boundary crossed.\nC:H - The freed `struct kcm_sock` is reachable from a workqueue and is reallocatable by the attacker (its own slab cache, refillable simply by creating more KCM sockets), so the UAF yields a read primitive over adjacent/reused kernel objects and can leak arbitrary kernel memory.\nI:H - Queueing work on a freed object makes the workqueue write into freed memory, and `kcm_tx_work()` subsequently operates on attacker-groomed contents, culminating in the indirect call `sk->sk_write_space(sk)` in `kcm_write_msgs()` — a control-flow hijack / arbitrary-write path, not just corruption.\nA:H - Even unexploited, running `lock_sock()` and `kcm_write_msgs()` on a freed `kcm_sock` produces a KASAN-reported use-after-free, workqueue list corruption, and kernel oops/panic, which any unprivileged user can trigger repeatedly."
                        }
                    ]
                }
            ],
            "affected": [
                {
                    "product": "Linux",
                    "vendor": "Linux",
                    "defaultStatus": "unaffected",
                    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                    "programFiles": [
                        "include/net/kcm.h",
                        "net/kcm/kcmsock.c"
                    ],
                    "versions": [
                        {
                            "version": "ab7ac4eb9832e32a09f4e8042705484d2fb0aad3",
                            "lessThan": "c0bffbc92a1ca3960fb9cdb8e9f75a68468eb308",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "ab7ac4eb9832e32a09f4e8042705484d2fb0aad3",
                            "lessThan": "7275dc3bb8f91b23125ff3f47b6529935cf46152",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "ab7ac4eb9832e32a09f4e8042705484d2fb0aad3",
                            "lessThan": "798733ee5d5788b12e8a52db1519abc17e826f69",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "ab7ac4eb9832e32a09f4e8042705484d2fb0aad3",
                            "lessThan": "52565a935213cd6a8662ddb8efe5b4219343a25d",
                            "status": "affected",
                            "versionType": "git"
                        }
                    ]
                },
                {
                    "product": "Linux",
                    "vendor": "Linux",
                    "defaultStatus": "affected",
                    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                    "programFiles": [
                        "include/net/kcm.h",
                        "net/kcm/kcmsock.c"
                    ],
                    "versions": [
                        {
                            "version": "4.6",
                            "status": "affected"
                        },
                        {
                            "version": "0",
                            "lessThan": "4.6",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.12.43",
                            "lessThanOrEqual": "6.12.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.15.11",
                            "lessThanOrEqual": "6.15.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.16.2",
                            "lessThanOrEqual": "6.16.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.17",
                            "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.6",
                                    "versionEndExcluding": "6.12.43"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "4.6",
                                    "versionEndExcluding": "6.15.11"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "4.6",
                                    "versionEndExcluding": "6.16.2"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "4.6",
                                    "versionEndExcluding": "6.17"
                                }
                            ]
                        }
                    ]
                }
            ],
            "references": [
                {
                    "url": "https://git.kernel.org/stable/c/c0bffbc92a1ca3960fb9cdb8e9f75a68468eb308"
                },
                {
                    "url": "https://git.kernel.org/stable/c/7275dc3bb8f91b23125ff3f47b6529935cf46152"
                },
                {
                    "url": "https://git.kernel.org/stable/c/798733ee5d5788b12e8a52db1519abc17e826f69"
                },
                {
                    "url": "https://git.kernel.org/stable/c/52565a935213cd6a8662ddb8efe5b4219343a25d"
                }
            ],
            "title": "net: kcm: Fix race condition in kcm_unattach()",
            "x_generator": {
                "engine": "bippy-1.2.0"
            }
        }
    }
}