{
    "dataType": "CVE_RECORD",
    "dataVersion": "5.2",
    "cveMetadata": {
        "cveId": "CVE-2025-38082",
        "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "state": "PUBLISHED",
        "assignerShortName": "Linux",
        "dateReserved": "2025-04-16T04:51:23.981Z",
        "datePublished": "2025-06-18T09:35:41.902Z",
        "dateUpdated": "2026-08-05T11:59:20.241Z"
    },
    "containers": {
        "cna": {
            "providerMetadata": {
                "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
                "shortName": "Linux",
                "dateUpdated": "2026-08-05T11:59:20.241Z"
            },
            "descriptions": [
                {
                    "lang": "en",
                    "value": "In the Linux kernel, the following vulnerability has been resolved:\n\ngpio: virtuser: fix potential out-of-bound write\n\nIf the caller wrote more characters, count is truncated to the max\navailable space in \"simple_write_to_buffer\". Check that the input\nsize does not exceed the buffer size. Write a zero termination\nafterwards."
                }
            ],
            "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 bug is reached only via a `write(2)`/`pwrite(2)` syscall on the local debugfs files `/sys/kernel/debug/gpio-virtuser/<dev>/<line>/direction` and `.../consumer`. There is no network, remote-peer, or over-the-air input path into the gpio-virtuser driver.\nAC:L - A single unconditional write triggers it deterministically — a 32-byte write to `direction` guarantees an unterminated buffer and a one-byte OOB store past `buf[32]`, and a zero-length write to `consumer` guarantees `buf[strlen(buf)-1]` evaluates to `buf[-1]` on default `INIT_STACK_ALL_ZERO` kernels. There is no race, no timing window, and no memory-layout precondition outside the attacker's influence, since the attacker controls both the write length and every byte.\nPR:L - The debugfs nodes are mode 0644 and debugfs defaults to a 0700 root, but the `uid=`/`gid=`/`mode=` mount options and vendor chown policies commonly delegate debugfs to non-root system accounts on the embedded/industrial/automotive boards where a GPIO test-consumer device is instantiated, so a low-privileged local account is the realistic worst case — consistent with prior kernel CNA debugfs scoring (CVE-2025-38317, CVE-2025-38307).\nUI:N - The attacker performs the write entirely on their own; no victim action, mount, or file-open by another user is required.\nS:U - The corruption and disclosure occur in kernel stack/heap memory within the same kernel security authority, with no VM, IOMMU, or sandbox boundary crossed.\nC:H - `strim()` and `strlen()` read out of bounds past the stack buffer, and the unterminated buffer is handed to `gpiod_set_consumer_name()` → `desc_set_label()`, which `strcpy()`s the out-of-bounds stack bytes into a label exported to userspace through the debugfs `consumer` read and `GPIO_V2_GET_LINEINFO_IOCTL`; a `pwrite` at offset 31 leaks up to 31 bytes of uninitialized kernel stack, which can contain pointers and defeat KASLR.\nI:H - This is an out-of-bounds write — a NUL byte stored past the end of `buf[32]` in `direction`, and below the array (`buf[-1]`) or beyond it in `consumer` — at an offset the attacker can influence by grooming the kernel stack with prior syscalls, yielding a classic poison-NUL-byte primitive able to truncate an adjacent saved pointer or length field into a control-flow hijack.\nA:H - Corrupting adjacent stack locals, the stack-protector canary, or the frame of neighboring calls produces `__stack_chk_fail()` panics or oopses, and the OOB `strlen()` walk can fault; the attacker can repeat the write at will to guarantee a crash."
                        }
                    ]
                }
            ],
            "affected": [
                {
                    "product": "Linux",
                    "vendor": "Linux",
                    "defaultStatus": "unaffected",
                    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                    "programFiles": [
                        "drivers/gpio/gpio-virtuser.c"
                    ],
                    "versions": [
                        {
                            "version": "91581c4b3f29e2e22aeb1a62e842d529ca638b2d",
                            "lessThan": "afe090366f470f77e140ff3407db813f57852c04",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "91581c4b3f29e2e22aeb1a62e842d529ca638b2d",
                            "lessThan": "b96feaaa0fda1e3871b438143c3446954b32d3a7",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "91581c4b3f29e2e22aeb1a62e842d529ca638b2d",
                            "lessThan": "7118be7c6072f40391923543fdd1563b8d56377c",
                            "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/gpio/gpio-virtuser.c"
                    ],
                    "versions": [
                        {
                            "version": "6.11",
                            "status": "affected"
                        },
                        {
                            "version": "0",
                            "lessThan": "6.11",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.12.32",
                            "lessThanOrEqual": "6.12.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.14.10",
                            "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.11",
                                    "versionEndExcluding": "6.12.32"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "6.11",
                                    "versionEndExcluding": "6.14.10"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "6.11",
                                    "versionEndExcluding": "6.15"
                                }
                            ]
                        }
                    ]
                }
            ],
            "references": [
                {
                    "url": "https://git.kernel.org/stable/c/afe090366f470f77e140ff3407db813f57852c04"
                },
                {
                    "url": "https://git.kernel.org/stable/c/b96feaaa0fda1e3871b438143c3446954b32d3a7"
                },
                {
                    "url": "https://git.kernel.org/stable/c/7118be7c6072f40391923543fdd1563b8d56377c"
                }
            ],
            "title": "gpio: virtuser: fix potential out-of-bound write",
            "x_generator": {
                "engine": "bippy-1.2.0"
            }
        }
    }
}