CVE-2025-40285 (GCVE-0-2025-40285)
Vulnerability from cvelistv5
Published
2025-12-06 21:51
Modified
2026-08-05 12:09
Summary
In the Linux kernel, the following vulnerability has been resolved: smb/server: fix possible refcount leak in smb2_sess_setup() Reference count of ksmbd_session will leak when session need reconnect. Fix this by adding the missing ksmbd_user_session_put().
Impacted products
Vendor Product Version
Linux Linux Version: 37a0e2b362b3150317fb6e2139de67b1e29ae5ff
Version: 450a844c045ff0895d41b05a1cbe8febd1acfcfd
Version: a39e31e22a535d47b14656a7d6a893c7f6cf758c
Version: b95629435b84b9ecc0c765995204a4d8a913ed52
Version: b95629435b84b9ecc0c765995204a4d8a913ed52
Version: 2107ab40629aeabbec369cf34b8cf0f288c3eb1b
Version: 6.1.121   
Version: 6.6.67   
Version: 6.12.6   
Version: 5.15.176   
Create a notification for this product.
Show details on NVD website


{
  "containers": {
    "cna": {
      "affected": [
        {
          "defaultStatus": "unaffected",
          "product": "Linux",
          "programFiles": [
            "fs/smb/server/smb2pdu.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThan": "6fc935f798d44a8eb8a5e6659198399fbf57b981",
              "status": "affected",
              "version": "37a0e2b362b3150317fb6e2139de67b1e29ae5ff",
              "versionType": "git"
            },
            {
              "lessThan": "e671f9bb97805771380c98de944e2ceab6949188",
              "status": "affected",
              "version": "450a844c045ff0895d41b05a1cbe8febd1acfcfd",
              "versionType": "git"
            },
            {
              "lessThan": "dcc51dfe6ff26b52cac106865a172ac982d78401",
              "status": "affected",
              "version": "a39e31e22a535d47b14656a7d6a893c7f6cf758c",
              "versionType": "git"
            },
            {
              "lessThan": "d37b2c81c83d6c0d5ca582f4fe73c672983f9e0d",
              "status": "affected",
              "version": "b95629435b84b9ecc0c765995204a4d8a913ed52",
              "versionType": "git"
            },
            {
              "lessThan": "379510a815cb2e64eb0a379cb62295d6ade65df0",
              "status": "affected",
              "version": "b95629435b84b9ecc0c765995204a4d8a913ed52",
              "versionType": "git"
            },
            {
              "status": "affected",
              "version": "2107ab40629aeabbec369cf34b8cf0f288c3eb1b",
              "versionType": "git"
            },
            {
              "lessThan": "6.1.159",
              "status": "affected",
              "version": "6.1.121",
              "versionType": "semver"
            },
            {
              "lessThan": "6.6.117",
              "status": "affected",
              "version": "6.6.67",
              "versionType": "semver"
            },
            {
              "lessThan": "6.12.59",
              "status": "affected",
              "version": "6.12.6",
              "versionType": "semver"
            },
            {
              "lessThan": "5.16",
              "status": "affected",
              "version": "5.15.176",
              "versionType": "semver"
            }
          ]
        },
        {
          "defaultStatus": "affected",
          "product": "Linux",
          "programFiles": [
            "fs/smb/server/smb2pdu.c"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "status": "affected",
              "version": "6.13"
            },
            {
              "lessThan": "6.13",
              "status": "unaffected",
              "version": "0",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.1.*",
              "status": "unaffected",
              "version": "6.1.159",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.6.*",
              "status": "unaffected",
              "version": "6.6.117",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.12.*",
              "status": "unaffected",
              "version": "6.12.59",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.17.*",
              "status": "unaffected",
              "version": "6.17.9",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "*",
              "status": "unaffected",
              "version": "6.18",
              "versionType": "original_commit_for_fix"
            }
          ]
        }
      ],
      "cpeApplicability": [
        {
          "nodes": [
            {
              "cpeMatch": [
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.1.159",
                  "versionStartIncluding": "6.1.121",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.6.117",
                  "versionStartIncluding": "6.6.67",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.12.59",
                  "versionStartIncluding": "6.12.6",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.17.9",
                  "versionStartIncluding": "6.13",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.18",
                  "versionStartIncluding": "6.13",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionStartIncluding": "5.15.176",
                  "vulnerable": true
                }
              ],
              "negate": false,
              "operator": "OR"
            }
          ]
        }
      ],
      "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": {
            "baseScore": 7.5,
            "baseSeverity": "HIGH",
            "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
            "version": "3.1"
          },
          "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\u0027s own TCP connections. No local access to the target is required.\nAC:L - The attacker controls both sides of the race \u2014 it pipelines the SESSION_SETUP requests that take the reference and issues the LOGOFF/PreviousSessionId request that flips conn-\u003estatus to NEED_RECONNECT \u2014 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-\u003esessions 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 \u2014 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."
            }
          ]
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2026-08-05T12:09:15.214Z",
        "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "shortName": "Linux"
      },
      "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"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
    "assignerShortName": "Linux",
    "cveId": "CVE-2025-40285",
    "datePublished": "2025-12-06T21:51:09.590Z",
    "dateReserved": "2025-04-16T07:20:57.184Z",
    "dateUpdated": "2026-08-05T12:09:15.214Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.2"
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
  • Confirmed: The vulnerability is confirmed from an analyst perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
  • Patched: This vulnerability was successfully patched by the user reporting the sighting.
  • Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
  • Not confirmed: The user expresses doubt about the veracity of the vulnerability.
  • Not patched: This vulnerability was not successfully patched by the user reporting the sighting.


Loading…

Loading…