{
    "dataType": "CVE_RECORD",
    "dataVersion": "5.2",
    "cveMetadata": {
        "cveId": "CVE-2025-38657",
        "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "state": "PUBLISHED",
        "assignerShortName": "Linux",
        "dateReserved": "2025-04-16T04:51:24.030Z",
        "datePublished": "2025-08-22T16:01:00.512Z",
        "dateUpdated": "2026-08-05T12:03:43.959Z"
    },
    "containers": {
        "cna": {
            "providerMetadata": {
                "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
                "shortName": "Linux",
                "dateUpdated": "2026-08-05T12:03:43.959Z"
            },
            "descriptions": [
                {
                    "lang": "en",
                    "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nwifi: rtw89: mcc: prevent shift wrapping in rtw89_core_mlsr_switch()\n\nThe \"link_id\" value comes from the user via debugfs.  If it's larger\nthan BITS_PER_LONG then that would result in shift wrapping and\npotentially an out of bounds access later.  In fact, we can limit it\nto IEEE80211_MLD_MAX_NUM_LINKS (15).\n\nFortunately, only root can write to debugfs files so the security\nimpact is minimal."
                }
            ],
            "metrics": [
                {
                    "cvssV3_1": {
                        "version": "3.1",
                        "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:L/A:H",
                        "baseScore": 7.3,
                        "baseSeverity": "HIGH"
                    },
                    "scenarios": [
                        {
                            "lang": "en",
                            "value": "AV:L - The only attacker-controlled path into `rtw89_core_mlsr_switch()` is a local `write()` to `/sys/kernel/debug/ieee80211/phyX/rtw89/mlo_mode`; the driver's other caller derives `link_id` from a bitmap already bounded by `IEEE80211_MLD_MAX_NUM_LINKS`, and no received frame or remote peer data reaches this function.\nAC:L - The attacker picks `link_id` outright, and the mod-64 shift wrap plus the `rtwvif->links[link_id]` over-index happen deterministically on every write — no race, no memory grooming. The only precondition is an MLD vif with a usable-but-inactive link, which is the ordinary steady state of Wi-Fi 7 hardware associated in MLSR mode and can be re-attempted at will.\nPR:L - The driver deliberately creates `mlo_mode` world-writable (`rtw89_debugfs_add_rw` uses `S_IFREG | 0666`) beneath 0755 directories, so on the embedded, BMC and Android-derived images that mount debugfs 0755 for diagnostics any unprivileged local user can trigger it; no `capable()` check exists anywhere in the rtw89 debugfs write path. Low is chosen over High per the higher-severity-when-uncertain rule, consistent with prior kernel CNA scoring of world-accessible debugfs files (CVE-2025-38719).\nUI:N - The attacker performs the single debugfs write themselves and the out-of-bounds access occurs synchronously in their own `write()` syscall; no victim must open a file, associate, or take any other action.\nS:U - The out-of-bounds reads and the resulting fault stay entirely within the kernel's own security authority — no hypervisor, IOMMU, or sandbox boundary is crossed.\nC:H - This is not a bounded few-byte over-read: `rtwvif->links[link_id]` reads a pointer from an attacker-chosen offset up to ~32 GB past a 15-entry array, and the recovered value is dereferenced as a `struct rtw89_vif_link *` whose `mac_id` is shipped to the Wi-Fi firmware, whose `link_id` is printed to dmesg, and whose `chanctx_idx` drives a second unchecked `hal->chanctx[idx]` over-read — an unbounded, repeatable kernel-memory disclosure primitive.\nI:L - No out-of-bounds write or write-through-pointer exists on this path, but values harvested from out-of-bounds kernel memory are programmed into the device: a bogus `mac_id` is sent to the Wi-Fi firmware in an H2C MLO link-cfg command and an out-of-range `chanctx_idx`/`phy_idx` steer TXGAPK/IQK/TSSI/DPK calibration writes to RF and BB registers, modifying radio state in ways the attacker cannot precisely steer.\nA:H - Dereferencing the garbage pointer read from far outside `links[]` — for `mac_id`, `chanctx_idx` and `phy_idx` — readily oopses the kernel (and KASAN reports the out-of-bounds access outright), while surviving cases run RF calibration with nonsense parameters that can wedge the adapter; the write can be repeated at will and escalates to a panic under `panic_on_oops`."
                        }
                    ]
                }
            ],
            "affected": [
                {
                    "product": "Linux",
                    "vendor": "Linux",
                    "defaultStatus": "unaffected",
                    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                    "programFiles": [
                        "drivers/net/wireless/realtek/rtw89/core.c"
                    ],
                    "versions": [
                        {
                            "version": "9dd85e739ce0765f022014c3e0713e1007d7ef60",
                            "lessThan": "417cfa9cc44fbe6bceab786f9a4ee5a210f1288e",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "9dd85e739ce0765f022014c3e0713e1007d7ef60",
                            "lessThan": "53cf488927a0f79968f9c03c4d1e00d2a79731c3",
                            "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/wireless/realtek/rtw89/core.c"
                    ],
                    "versions": [
                        {
                            "version": "6.16",
                            "status": "affected"
                        },
                        {
                            "version": "0",
                            "lessThan": "6.16",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.16.1",
                            "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": "6.16",
                                    "versionEndExcluding": "6.16.1"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "6.16",
                                    "versionEndExcluding": "6.17"
                                }
                            ]
                        }
                    ]
                }
            ],
            "references": [
                {
                    "url": "https://git.kernel.org/stable/c/417cfa9cc44fbe6bceab786f9a4ee5a210f1288e"
                },
                {
                    "url": "https://git.kernel.org/stable/c/53cf488927a0f79968f9c03c4d1e00d2a79731c3"
                }
            ],
            "title": "wifi: rtw89: mcc: prevent shift wrapping in rtw89_core_mlsr_switch()",
            "x_generator": {
                "engine": "bippy-1.2.0"
            }
        }
    }
}