{
    "dataType": "CVE_RECORD",
    "dataVersion": "5.2",
    "cveMetadata": {
        "cveId": "CVE-2025-38012",
        "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "state": "PUBLISHED",
        "assignerShortName": "Linux",
        "dateReserved": "2025-04-16T04:51:23.977Z",
        "datePublished": "2025-06-18T09:28:22.057Z",
        "dateUpdated": "2026-08-05T11:58:57.764Z"
    },
    "containers": {
        "cna": {
            "providerMetadata": {
                "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
                "shortName": "Linux",
                "dateUpdated": "2026-08-05T11:58:57.764Z"
            },
            "descriptions": [
                {
                    "lang": "en",
                    "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nsched_ext: bpf_iter_scx_dsq_new() should always initialize iterator\n\nBPF programs may call next() and destroy() on BPF iterators even after new()\nreturns an error value (e.g. bpf_for_each() macro ignores error returns from\nnew()). bpf_iter_scx_dsq_new() could leave the iterator in an uninitialized\nstate after an error return causing bpf_iter_scx_dsq_next() to dereference\ngarbage data. Make bpf_iter_scx_dsq_new() always clear $kit->dsq so that\nnext() and destroy() become noops."
                }
            ],
            "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 - Exploitation requires loading and running a BPF program via the local `bpf()` syscall (BPF_PROG_LOAD + BPF_PROG_TEST_RUN, or a struct_ops/tracing attach). There is no remote or adjacent-network path to the sched_ext DSQ iterator kfuncs.\nAC:L - The trigger is fully deterministic — pass an invalid flag bit to `bpf_iter_scx_dsq_new()` and call `next()` — with no race, no timing window, and no dependence on ambient memory layout, since the attacker pre-seeds the iterator stack slots with values of their choosing. `CONFIG_SCHED_CLASS_EXT` is enabled in mainstream 6.12+ distro kernels.\nPR:L - Only CAP_BPF is needed: the iterator kfuncs are registered for `BPF_PROG_TYPE_SYSCALL`, which is not perfmon/net-admin gated, and `bpf_prog_test_run_syscall()` adds no capability check. `bpf_token_capable()` allows CAP_BPF to be delegated into an unprivileged user namespace via a bpffs BPF token, so an ordinary low-privileged container user can reach it.\nUI:N - The attacker's own BPF program triggers the flaw synchronously; no victim action, mount, or file open is involved.\nS:U - The corruption and its consequences are confined to the kernel's own security authority — a standard local privilege escalation with no VM, IOMMU, or hypervisor boundary crossed.\nC:H - `nldsq_next_task()` dereferences the attacker-supplied `kit->dsq` pointer and then walks arbitrary `list_head` next/prev chains, yielding an arbitrary kernel-memory read primitive that can disclose credentials, keys, and KASLR state.\nI:H - The uninitialized `kit->cursor` drives `list_move()`/`list_del_init()` against attacker-chosen addresses, and `raw_spin_lock_irqsave(&kit->dsq->lock)` performs a read-modify-write at an arbitrary address — a controlled kernel write primitive leading to full privilege escalation.\nA:H - Dereferencing garbage pointers under `raw_spin_lock_irqsave()` reliably produces a kernel oops or a hard lockup on a bogus spinlock, and any unprivileged-BPF-capable process can repeat it at will to panic the machine."
                        }
                    ]
                }
            ],
            "affected": [
                {
                    "product": "Linux",
                    "vendor": "Linux",
                    "defaultStatus": "unaffected",
                    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                    "programFiles": [
                        "kernel/sched/ext.c"
                    ],
                    "versions": [
                        {
                            "version": "650ba21b131ed1f8ee57826b2c6295a3be221132",
                            "lessThan": "0102989af4c334d1d98b2a0fd4d61a5152e39b72",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "650ba21b131ed1f8ee57826b2c6295a3be221132",
                            "lessThan": "255dd31bfc4a67a19b1fc2cd130a50284dadfe3a",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "650ba21b131ed1f8ee57826b2c6295a3be221132",
                            "lessThan": "428dc9fc0873989d73918d4a9cc22745b7bbc799",
                            "status": "affected",
                            "versionType": "git"
                        }
                    ]
                },
                {
                    "product": "Linux",
                    "vendor": "Linux",
                    "defaultStatus": "affected",
                    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                    "programFiles": [
                        "kernel/sched/ext.c"
                    ],
                    "versions": [
                        {
                            "version": "6.12",
                            "status": "affected"
                        },
                        {
                            "version": "0",
                            "lessThan": "6.12",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.12.30",
                            "lessThanOrEqual": "6.12.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.14.8",
                            "lessThanOrEqual": "6.14.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.15",
                            "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": "6.12",
                                    "versionEndExcluding": "6.12.30"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "6.12",
                                    "versionEndExcluding": "6.14.8"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "6.12",
                                    "versionEndExcluding": "6.15"
                                }
                            ]
                        }
                    ]
                }
            ],
            "references": [
                {
                    "url": "https://git.kernel.org/stable/c/0102989af4c334d1d98b2a0fd4d61a5152e39b72"
                },
                {
                    "url": "https://git.kernel.org/stable/c/255dd31bfc4a67a19b1fc2cd130a50284dadfe3a"
                },
                {
                    "url": "https://git.kernel.org/stable/c/428dc9fc0873989d73918d4a9cc22745b7bbc799"
                }
            ],
            "title": "sched_ext: bpf_iter_scx_dsq_new() should always initialize iterator",
            "x_generator": {
                "engine": "bippy-1.2.0"
            }
        }
    }
}