{
    "dataType": "CVE_RECORD",
    "dataVersion": "5.2",
    "cveMetadata": {
        "cveId": "CVE-2025-38366",
        "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "state": "PUBLISHED",
        "assignerShortName": "Linux",
        "dateReserved": "2025-04-16T04:51:24.008Z",
        "datePublished": "2025-07-25T12:47:36.104Z",
        "dateUpdated": "2026-08-05T12:01:23.461Z"
    },
    "containers": {
        "cna": {
            "providerMetadata": {
                "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
                "shortName": "Linux",
                "dateUpdated": "2026-08-05T12:01:23.461Z"
            },
            "descriptions": [
                {
                    "lang": "en",
                    "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nLoongArch: KVM: Check validity of \"num_cpu\" from user space\n\nThe maximum supported cpu number is EIOINTC_ROUTE_MAX_VCPUS about\nirqchip EIOINTC, here add validation about cpu number to avoid array\npointer overflow."
                }
            ],
            "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 reached only through ioctls on a local KVM device file descriptor (`/dev/kvm` → `KVM_CREATE_VM` → `KVM_CREATE_DEVICE` → `KVM_SET/GET_DEVICE_ATTR`); there is no network or remote path into `kvm_eiointc_regs_access()`.\nAC:L - A single ioctl with `attr->attr = (cpuid << 16) | 0x400` deterministically produces the out-of-bounds access — no race, no timing dependency, and the attacker fully chooses the ±1 MiB displacement and the written value. KVM is enabled by default in `loongson64_defconfig`.\nPR:L - The attacker needs only the ability to open `/dev/kvm` and create a VM — routinely granted to unprivileged local users and cloud/desktop VM users — and neither `kvm_ioctl_create_device()` nor `kvm_device_ioctl_attr()` performs any capability check.\nUI:N - The attacker drives the entire sequence from its own process with plain ioctls; no host operator, guest owner, or other user has to take any action.\nS:U - Both the vulnerable and the impacted component are the host kernel, reached by host userspace through its normal syscall interface — a classic local privilege escalation within one security authority, not a guest-to-host hypervisor escape (the guest MMIO paths index `coreisr` by the bounded `vcpu->vcpu_id`).\nC:H - `KVM_GET_DEVICE_ATTR` performs `copy_to_user(data, p, 4)` from an attacker-chosen 4-byte-aligned address up to 1 MiB either side of the ~74 KB `loongarch_eiointc` allocation, giving a repeatable, sweepable read of adjacent kernel memory — effectively arbitrary kernel-heap disclosure including pointers and secrets.\nI:H - `KVM_SET_DEVICE_ATTR` performs `copy_from_user(p, data, 4)` to the same attacker-chosen out-of-bounds address, yielding a controlled 4-byte write anywhere in a 2 MiB window around a page-allocator-backed object — a memory-corruption primitive directly leverageable for control-flow hijack and full privilege escalation.\nA:H - The same out-of-bounds write can clobber arbitrary neighboring kernel structures, and the unvalidated `num_cpu`/`cpuid` accesses reliably corrupt or fault kernel memory, producing an oops or panic that takes down the host and every VM on it."
                        }
                    ]
                }
            ],
            "affected": [
                {
                    "product": "Linux",
                    "vendor": "Linux",
                    "defaultStatus": "unaffected",
                    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                    "programFiles": [
                        "arch/loongarch/kvm/intc/eiointc.c"
                    ],
                    "versions": [
                        {
                            "version": "1ad7efa552fd5cf4e8c49fea863c5c6a5dcf9f00",
                            "lessThan": "a3293b4078ee93174f70f36d3ab7618554ce6ab6",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "1ad7efa552fd5cf4e8c49fea863c5c6a5dcf9f00",
                            "lessThan": "cc8d5b209e09d3b52bca1ffe00045876842d96ae",
                            "status": "affected",
                            "versionType": "git"
                        }
                    ]
                },
                {
                    "product": "Linux",
                    "vendor": "Linux",
                    "defaultStatus": "affected",
                    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                    "programFiles": [
                        "arch/loongarch/kvm/intc/eiointc.c"
                    ],
                    "versions": [
                        {
                            "version": "6.13",
                            "status": "affected"
                        },
                        {
                            "version": "0",
                            "lessThan": "6.13",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.15.5",
                            "lessThanOrEqual": "6.15.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.16",
                            "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.13",
                                    "versionEndExcluding": "6.15.5"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "6.13",
                                    "versionEndExcluding": "6.16"
                                }
                            ]
                        }
                    ]
                }
            ],
            "references": [
                {
                    "url": "https://git.kernel.org/stable/c/a3293b4078ee93174f70f36d3ab7618554ce6ab6"
                },
                {
                    "url": "https://git.kernel.org/stable/c/cc8d5b209e09d3b52bca1ffe00045876842d96ae"
                }
            ],
            "title": "LoongArch: KVM: Check validity of \"num_cpu\" from user space",
            "x_generator": {
                "engine": "bippy-1.2.0"
            }
        }
    }
}