CVE-2025-40002
thunderbolt: Fix use-after-free in tb_dp_dprx_work
Description
In the Linux kernel, the following vulnerability has been resolved: thunderbolt: Fix use-after-free in tb_dp_dprx_work The original code relies on cancel_delayed_work() in tb_dp_dprx_stop(), which does not ensure that the delayed work item tunnel->dprx_work has fully completed if it was already running. This leads to use-after-free scenarios where tb_tunnel is deallocated by tb_tunnel_put(), while tunnel->dprx_work remains active and attempts to dereference tb_tunnel in tb_dp_dprx_work(). A typical race condition is illustrated below: CPU 0 | CPU 1 tb_dp_tunnel_active() | tb_deactivate_and_free_tunnel()| tb_dp_dprx_start() tb_tunnel_deactivate() | queue_delayed_work() tb_dp_activate() | tb_dp_dprx_stop() | tb_dp_dprx_work() //delayed worker cancel_delayed_work() | tb_tunnel_put(tunnel); | | tunnel = container_of(...); //UAF | tunnel-> //UAF Replacing cancel_delayed_work() with cancel_delayed_work_sync() is not feasible as it would introduce a deadlock: both tb_dp_dprx_work() and the cleanup path acquire tb->lock, and cancel_delayed_work_sync() would wait indefinitely for the work item that cannot proceed. Instead, implement proper reference counting: - If cancel_delayed_work() returns true (work is pending), we release the reference in the stop function. - If it returns false (work is executing or already completed), the reference is released in delayed work function itself. This ensures the tb_tunnel remains valid during work item execution while preventing memory leaks. This bug was found by static analysis.
INFO
Published Date :
Oct. 18, 2025, 8:15 a.m.
Last Modified :
Oct. 19, 2026, 9:10 p.m.
Remotely Exploit :
No
Source :
416baaa9-dc9f-4396-8d5f-8c081fb06d67
Solution
- Update the Linux kernel to fix the Thunderbolt driver.
- Ensure delayed work items complete before deallocation.
- Release references based on work item status.
References to Advisories, Solutions, and Tools
Here, you will find a curated list of external links that provide in-depth
information, practical solutions, and valuable tools related to
CVE-2025-40002.
| URL | Resource |
|---|---|
| https://git.kernel.org/stable/c/67600ccfc4f38ebd331b9332ac94717bfbc87ea7 | |
| https://git.kernel.org/stable/c/c07923f6a8729fc27ee652221a51702ff6654097 |
CWE - Common Weakness Enumeration
While CVE identifies
specific instances of vulnerabilities, CWE categorizes the common flaws or
weaknesses that can lead to vulnerabilities. CVE-2025-40002 is
associated with the following CWEs:
Common Attack Pattern Enumeration and Classification (CAPEC)
Common Attack Pattern Enumeration and Classification
(CAPEC)
stores attack patterns, which are descriptions of the common attributes and
approaches employed by adversaries to exploit the CVE-2025-40002
weaknesses.
We scan GitHub repositories to detect new proof-of-concept exploits. Following list is a collection of public exploits and proof-of-concepts, which have been published on GitHub (sorted by the most recently updated).
Results are limited to the first 15 repositories due to potential performance issues.
The following list is the news that have been mention
CVE-2025-40002 vulnerability anywhere in the article.
The following table lists the changes that have been made to the
CVE-2025-40002 vulnerability over time.
Vulnerability history details can be useful for understanding the evolution of a vulnerability, and for identifying the most recent changes that may impact the vulnerability's severity, exploitability, or other characteristics.
-
CVE Translated by [email protected]
Oct. 19, 2026
Action Type Old Value New Value Added Translation Title: Linux, Description: En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta: thunderbolt: Soluciona uso después de liberación en tb_dp_dprx_work El código original se basa en cancel_delayed_work() en tb_dp_dprx_stop(), lo que no asegura que el elemento de trabajo retrasado tunnel->dprx_work haya completado completamente si ya estaba en ejecución. Esto lleva a escenarios de uso después de liberación donde tb_tunnel es desasignado por tb_tunnel_put(), mientras que tunnel->dprx_work permanece activo e intenta desreferenciar tb_tunnel en tb_dp_dprx_work(). Una condición de carrera típica se ilustra a continuación: CPU 0 | CPU 1 tb_dp_tunnel_active() | tb_deactivate_and_free_tunnel()| tb_dp_dprx_start() tb_tunnel_deactivate() | queue_delayed_work() tb_dp_activate() | tb_dp_dprx_stop() | tb_dp_dprx_work() //trabajador retrasado cancel_delayed_work() | tb_tunnel_put(tunnel); | | tunnel = container_of(...); //UAF | tunnel-> //UAF Reemplazar cancel_delayed_work() con cancel_delayed_work_sync() no es factible ya que introduciría un interbloqueo: tanto tb_dp_dprx_work() como la ruta de limpieza adquieren tb->lock, y cancel_delayed_work_sync() esperaría indefinidamente por el elemento de trabajo que no puede continuar. En su lugar, implementa un conteo de referencias adecuado: - Si cancel_delayed_work() devuelve verdadero (el trabajo está pendiente), liberamos la referencia en la función de parada. - Si devuelve falso (el trabajo se está ejecutando o ya ha completado), la referencia se libera en la propia función de trabajo retrasado. Esto asegura que el tb_tunnel permanezca válido durante la ejecución del elemento de trabajo mientras previene fugas de memoria. Este error fue encontrado mediante análisis estático. -
CVE Modified by 416baaa9-dc9f-4396-8d5f-8c081fb06d67
Jun. 17, 2026
Action Type Old Value New Value Added Affected [{'repo': 'https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git', 'vendor': 'Linux', 'product': 'Linux', 'versions': [{'status': 'affected', 'version': 'd6d458d42e1e1544a18f37f1d5c840e00d5261b9', 'lessThan': 'c07923f6a8729fc27ee652221a51702ff6654097', 'versionType': 'git'}, {'status': 'affected', 'version': 'd6d458d42e1e1544a18f37f1d5c840e00d5261b9', 'lessThan': '67600ccfc4f38ebd331b9332ac94717bfbc87ea7', 'versionType': 'git'}], 'programFiles': ['drivers/thunderbolt/tunnel.c'], 'defaultStatus': 'unaffected'}, {'repo': 'https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git', 'vendor': 'Linux', 'product': 'Linux', 'versions': [{'status': 'affected', 'version': '6.14'}, {'status': 'unaffected', 'version': '0', 'lessThan': '6.14', 'versionType': 'semver'}, {'status': 'unaffected', 'version': '6.17.3', 'versionType': 'semver', 'lessThanOrEqual': '6.17.*'}, {'status': 'unaffected', 'version': '6.18', 'versionType': 'original_commit_for_fix', 'lessThanOrEqual': '*'}], 'programFiles': ['drivers/thunderbolt/tunnel.c'], 'defaultStatus': 'affected'}] -
New CVE Received by 416baaa9-dc9f-4396-8d5f-8c081fb06d67
Oct. 18, 2025
Action Type Old Value New Value Added Description In the Linux kernel, the following vulnerability has been resolved: thunderbolt: Fix use-after-free in tb_dp_dprx_work The original code relies on cancel_delayed_work() in tb_dp_dprx_stop(), which does not ensure that the delayed work item tunnel->dprx_work has fully completed if it was already running. This leads to use-after-free scenarios where tb_tunnel is deallocated by tb_tunnel_put(), while tunnel->dprx_work remains active and attempts to dereference tb_tunnel in tb_dp_dprx_work(). A typical race condition is illustrated below: CPU 0 | CPU 1 tb_dp_tunnel_active() | tb_deactivate_and_free_tunnel()| tb_dp_dprx_start() tb_tunnel_deactivate() | queue_delayed_work() tb_dp_activate() | tb_dp_dprx_stop() | tb_dp_dprx_work() //delayed worker cancel_delayed_work() | tb_tunnel_put(tunnel); | | tunnel = container_of(...); //UAF | tunnel-> //UAF Replacing cancel_delayed_work() with cancel_delayed_work_sync() is not feasible as it would introduce a deadlock: both tb_dp_dprx_work() and the cleanup path acquire tb->lock, and cancel_delayed_work_sync() would wait indefinitely for the work item that cannot proceed. Instead, implement proper reference counting: - If cancel_delayed_work() returns true (work is pending), we release the reference in the stop function. - If it returns false (work is executing or already completed), the reference is released in delayed work function itself. This ensures the tb_tunnel remains valid during work item execution while preventing memory leaks. This bug was found by static analysis. Added Reference https://git.kernel.org/stable/c/67600ccfc4f38ebd331b9332ac94717bfbc87ea7 Added Reference https://git.kernel.org/stable/c/c07923f6a8729fc27ee652221a51702ff6654097