{
    "dataType": "CVE_RECORD",
    "dataVersion": "5.2",
    "cveMetadata": {
        "cveId": "CVE-2025-40285",
        "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "state": "PUBLISHED",
        "assignerShortName": "Linux",
        "dateReserved": "2025-04-16T07:20:57.184Z",
        "datePublished": "2025-12-06T21:51:09.590Z",
        "dateUpdated": "2026-08-05T12:09:15.214Z"
    },
    "containers": {
        "cna": {
            "providerMetadata": {
                "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
                "shortName": "Linux",
                "dateUpdated": "2026-08-05T12:09:15.214Z"
            },
            "descriptions": [
                {
                    "lang": "en",
                    "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nsmb/server: fix possible refcount leak in smb2_sess_setup()\n\nReference count of ksmbd_session will leak when session need reconnect.\nFix this by adding the missing ksmbd_user_session_put()."
                }
            ],
            "metrics": [
                {
                    "cvssV3_1": {
                        "version": "3.1",
                        "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
                        "baseScore": 7.5,
                        "baseSeverity": "HIGH"
                    },
                    "scenarios": [
                        {
                            "lang": "en",
                            "value": "AV:N - ksmbd is the in-kernel SMB server on TCP/445, and the leak is driven entirely by remote SMB2 SESSION_SETUP and LOGOFF PDUs on the attacker's own TCP connections. No local access to the target is required.\nAC:L - The attacker controls both sides of the race — it pipelines the SESSION_SETUP requests that take the reference and issues the LOGOFF/PreviousSessionId request that flips conn->status to NEED_RECONNECT — and the window is wide because ksmbd_conn_wait_idle()/ksmbd_conn_wait_idle_sess_id() hold that status for the duration of the teardown (up to 120 s). Failed attempts are harmless and can be retried indefinitely.\nPR:N - smb2_check_user_session() explicitly bypasses session validation for SMB2_SESSION_SETUP, and the session is registered in conn->sessions before any credential check, so the leaking lookup is reached with zero credentials. On the common guest-mapped ksmbd share, ntlm_authenticate() skips password verification for user_guest(), so the LOGOFF that flips the connection to NEED_RECONNECT is also available unauthenticated.\nUI:N - The attacker opens its own connections and issues every request itself; no legitimate user or administrator action is involved.\nS:U - The leaked session object and its pinned file references are kernel resources within the same security authority as the ksmbd server; no VM, IOMMU, or sandbox boundary is crossed.\nC:N - Nothing is read out of bounds and nothing is transmitted back to the client on this error path — the only effect is that a reference count is never decremented, so no kernel data is disclosed.\nI:N - No memory is written out of bounds or freed early; the object simply outlives its intended lifetime, so no kernel data or control flow is modified.\nA:H - Each won race permanently leaks a struct ksmbd_session plus its entire file table, so open struct file/inode/dentry references are pinned forever (also blocking unmount), and the attack is replayable without limit over surviving connections, driving unbounded kernel memory and handle exhaustion to OOM and system hang."
                        }
                    ]
                }
            ],
            "affected": [
                {
                    "product": "Linux",
                    "vendor": "Linux",
                    "defaultStatus": "unaffected",
                    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                    "programFiles": [
                        "fs/smb/server/smb2pdu.c"
                    ],
                    "versions": [
                        {
                            "version": "37a0e2b362b3150317fb6e2139de67b1e29ae5ff",
                            "lessThan": "6fc935f798d44a8eb8a5e6659198399fbf57b981",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "450a844c045ff0895d41b05a1cbe8febd1acfcfd",
                            "lessThan": "e671f9bb97805771380c98de944e2ceab6949188",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "a39e31e22a535d47b14656a7d6a893c7f6cf758c",
                            "lessThan": "dcc51dfe6ff26b52cac106865a172ac982d78401",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "b95629435b84b9ecc0c765995204a4d8a913ed52",
                            "lessThan": "d37b2c81c83d6c0d5ca582f4fe73c672983f9e0d",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "b95629435b84b9ecc0c765995204a4d8a913ed52",
                            "lessThan": "379510a815cb2e64eb0a379cb62295d6ade65df0",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "2107ab40629aeabbec369cf34b8cf0f288c3eb1b",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "6.1.121",
                            "lessThan": "6.1.159",
                            "status": "affected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.6.67",
                            "lessThan": "6.6.117",
                            "status": "affected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.12.6",
                            "lessThan": "6.12.59",
                            "status": "affected",
                            "versionType": "semver"
                        },
                        {
                            "version": "5.15.176",
                            "lessThan": "5.16",
                            "status": "affected",
                            "versionType": "semver"
                        }
                    ]
                },
                {
                    "product": "Linux",
                    "vendor": "Linux",
                    "defaultStatus": "affected",
                    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                    "programFiles": [
                        "fs/smb/server/smb2pdu.c"
                    ],
                    "versions": [
                        {
                            "version": "6.13",
                            "status": "affected"
                        },
                        {
                            "version": "0",
                            "lessThan": "6.13",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.1.159",
                            "lessThanOrEqual": "6.1.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.6.117",
                            "lessThanOrEqual": "6.6.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.12.59",
                            "lessThanOrEqual": "6.12.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.17.9",
                            "lessThanOrEqual": "6.17.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "6.18",
                            "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.1.121",
                                    "versionEndExcluding": "6.1.159"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "6.6.67",
                                    "versionEndExcluding": "6.6.117"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "6.12.6",
                                    "versionEndExcluding": "6.12.59"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "6.13",
                                    "versionEndExcluding": "6.17.9"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "6.13",
                                    "versionEndExcluding": "6.18"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "5.15.176"
                                }
                            ]
                        }
                    ]
                }
            ],
            "references": [
                {
                    "url": "https://git.kernel.org/stable/c/6fc935f798d44a8eb8a5e6659198399fbf57b981"
                },
                {
                    "url": "https://git.kernel.org/stable/c/e671f9bb97805771380c98de944e2ceab6949188"
                },
                {
                    "url": "https://git.kernel.org/stable/c/dcc51dfe6ff26b52cac106865a172ac982d78401"
                },
                {
                    "url": "https://git.kernel.org/stable/c/d37b2c81c83d6c0d5ca582f4fe73c672983f9e0d"
                },
                {
                    "url": "https://git.kernel.org/stable/c/379510a815cb2e64eb0a379cb62295d6ade65df0"
                }
            ],
            "title": "smb/server: fix possible refcount leak in smb2_sess_setup()",
            "x_generator": {
                "engine": "bippy-1.2.0"
            }
        }
    }
}