{"id":"CVE-2026-31610","aliases":["CVE-2026-31610"],"related":[],"kind":"vulnerability","state":"published","title":"ksmbd: fix mechToken leak when SPNEGO decode fails after token alloc","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\nksmbd: fix mechToken leak when SPNEGO decode fails after token alloc\n\nThe kernel ASN.1 BER decoder calls action callbacks incrementally as it\nwalks the input.  When ksmbd_decode_negTokenInit() reaches the mechToken\n[2] OCTET STRING element, ksmbd_neg_token_alloc() allocates\nconn->mechToken immediately via kmemdup_nul().  If a later element in\nthe same blob is malformed, then the decoder will return nonzero after\nthe allocation is already live.  This could happen if mechListMIC [3]\noverrunse the enclosing SEQUENCE.\n\ndecode_negotiation_token() then sets conn->use_spnego = false because\nboth the negTokenInit and negTokenTarg grammars failed.  The cleanup at\nthe bottom of smb2_sess_setup() is gated on use_spnego:\n\n\tif (conn->use_spnego && conn->mechToken) {\n\t\tkfree(conn->mechToken);\n\t\tconn->mechToken = NULL;\n\t}\n\nso the kfree is skipped, causing the mechToken to never be freed.\n\nThis codepath is reachable pre-authentication, so untrusted clients can\ncause slow memory leaks on a server without even being properly\nauthenticated.\n\nFix this up by not checking check for use_spnego, as it's not required,\nso the memory will always be properly freed.  At the same time, always\nfree the memory in ksmbd_conn_free() incase some other failure path\nforgot to free it.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\nksmbd: fix mechToken leak when SPNEGO decode fails after token alloc\n\nThe kernel ASN.1 BER decoder calls action callbacks incrementally as it\nwalks the input.  When ksmbd_decode_negTokenInit() reaches the mechToken\n[2] OCTET STRING element, ksmbd_neg_token_alloc() allocates\nconn->mechToken immediately via kmemdup_nul().  If a later element in\nthe same blob is malformed, then the decoder will return nonzero after\nthe allocation is already live.  This could happen if mechListMIC [3]\noverrunse the enclosing SEQUENCE.\n\ndecode_negotiation_token() then sets conn->use_spnego = false because\nboth the negTokenInit and negTokenTarg grammars failed.  The cleanup at\nthe bottom of smb2_sess_setup() is gated on use_spnego:\n\n\tif (conn->use_spnego && conn->mechToken) {\n\t\tkfree(conn->mechToken);\n\t\tconn->mechToken = NULL;\n\t}\n\nso the kfree is skipped, causing the mechToken to never be freed.\n\nThis codepath is reachable pre-authentication, so untrusted clients can\ncause slow memory leaks on a server without even being properly\nauthenticated.\n\nFix this up by not checking check for use_spnego, as it's not required,\nso the memory will always be properly freed.  At the same time, always\nfree the memory in ksmbd_conn_free() incase some other failure path\nforgot to free it.","source":"cvelist"},{"lang":"es","text":"En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta:\n\nksmbd: corrige la fuga de mechToken cuando la decodificación SPNEGO falla después de la asignación del token\n\nEl decodificador BER ASN.1 del kernel llama a las devoluciones de llamada de acción incrementalmente a medida que recorre la entrada. Cuando ksmbd_decode_negTokenInit() alcanza el elemento OCTET STRING mechToken [2], ksmbd_neg_token_alloc() asigna conn  ->  mechToken inmediatamente a través de kmemdup_nul(). Si un elemento posterior en el mismo blob está malformado, entonces el decodificador devolverá un valor distinto de cero después de que la asignación ya esté activa. Esto podría ocurrir si mechListMIC [3] excede la SEQUENCE que lo contiene.\n\ndecode_negotiation_token() luego establece conn  ->  use_spnego = false porque ambas gramáticas negTokenInit y negTokenTarg fallaron. La limpieza al final de smb2_sess_setup() está condicionada por use_spnego:\n\n\tsi (conn  ->  use_spnego && conn  ->  mechToken) {\n\t\tkfree(conn  ->  mechToken);\n\t\tconn  ->  mechToken = NULL;\n\t}\n\npor lo que el kfree se omite, haciendo que el mechToken nunca sea liberado.\n\nEsta ruta de código es alcanzable pre-autenticación, por lo que los clientes no confiables pueden causar fugas de memoria lentas en un servidor sin siquiera estar correctamente autenticados.\n\nSoluciona esto al no verificar use_spnego, ya que no es necesario, por lo que la memoria siempre será liberada correctamente. Al mismo tiempo, libera siempre la memoria en ksmbd_conn_free() en caso de que alguna otra ruta de fallo olvidara liberarla.","source":"nvd"}],"published":"2026-04-24T14:42:31.471Z","modified":"2026-11-11T23:10:00.263Z","severity":{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.5,"rating":"MEDIUM"},"severities":[{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.5,"rating":"MEDIUM"}],"cwes":["CWE-401"],"affected":[{"ranges":[{"type":"git","introduced":"fad4161b5cd01a24202234976ebbb133f7adc0b5","fixed":"ae9cdb29efed20ffdee9ff3b0bb72fb369c353da","status":"affected"},{"type":"git","introduced":"fad4161b5cd01a24202234976ebbb133f7adc0b5","fixed":"bd4a7fb04f06f419b0e93d8b52fe32067eb312d1","status":"affected"},{"type":"git","introduced":"fad4161b5cd01a24202234976ebbb133f7adc0b5","fixed":"745a535461bbb90a56d9357573c9f97a5c12abe1","status":"affected"},{"type":"git","introduced":"fad4161b5cd01a24202234976ebbb133f7adc0b5","fixed":"dd577cb55588ec3fbc66af3621280306601c4192","status":"affected"},{"type":"git","introduced":"fad4161b5cd01a24202234976ebbb133f7adc0b5","fixed":"dd53414e301beb915fe672dc4c4a51bafb917604","status":"affected"},{"type":"git","introduced":"fad4161b5cd01a24202234976ebbb133f7adc0b5","fixed":"269c800a7a7e363459291885b35f7bc72e231ed6","status":"affected"},{"type":"git","introduced":"fad4161b5cd01a24202234976ebbb133f7adc0b5","fixed":"6c8c44e6553b9f072f62d9875e567766eb293162","status":"affected"},{"type":"git","introduced":"fad4161b5cd01a24202234976ebbb133f7adc0b5","fixed":"ad0057fb91218914d6c98268718ceb9d59b388e1","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"5.15","status":"affected"},{"type":"semver","introduced":"0","fixed":"5.15","status":"unaffected"},{"type":"semver","introduced":"5.15.212","lastAffected":"5.15.*","status":"unaffected"},{"type":"semver","introduced":"6.1.178","lastAffected":"6.1.*","status":"unaffected"},{"type":"semver","introduced":"6.6.136","lastAffected":"6.6.*","status":"unaffected"},{"type":"semver","introduced":"6.12.83","lastAffected":"6.12.*","status":"unaffected"},{"type":"semver","introduced":"6.18.24","lastAffected":"6.18.*","status":"unaffected"},{"type":"semver","introduced":"6.19.14","lastAffected":"6.19.*","status":"unaffected"},{"type":"semver","introduced":"7.0.1","lastAffected":"7.0.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"7.1","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"status":"affected","introduced":"5.15","fixed":"6.6.136"},{"status":"affected","introduced":"6.7","fixed":"6.12.83"},{"status":"affected","introduced":"6.13","fixed":"6.18.24"},{"status":"affected","introduced":"6.19","fixed":"6.19.14"},{"status":"affected","introduced":"7.0","fixed":"7.0.1"}],"vendor":"linux","product":"linux_kernel","cpe":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://git.kernel.org/stable/c/ae9cdb29efed20ffdee9ff3b0bb72fb369c353da","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/bd4a7fb04f06f419b0e93d8b52fe32067eb312d1","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/745a535461bbb90a56d9357573c9f97a5c12abe1","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/dd577cb55588ec3fbc66af3621280306601c4192","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/dd53414e301beb915fe672dc4c4a51bafb917604","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/269c800a7a7e363459291885b35f7bc72e231ed6","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/6c8c44e6553b9f072f62d9875e567766eb293162","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/ad0057fb91218914d6c98268718ceb9d59b388e1","tags":["patch"],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-31610","url":"https://www.cve.org/CVERecord?id=CVE-2026-31610","licence":"CVE Terms of Use","modified":"2026-07-24T14:33:31.688Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-31610","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-31610","licence":"Public domain","modified":"2026-11-11T23:10:00.263Z"}],"updatedAt":"2026-11-25T22:59:19.513Z","epss":{"score":0.00141,"percentile":0.03676,"date":"2026-12-01T12:00:22.000Z"}}