CVE-2025-38618: vsock: Do not allow binding to VMADDR_PORT_ANY
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
vsock: Do not allow binding to VMADDR_PORT_ANY
It is possible for a vsock to autobind to VMADDR_PORT_ANY. This can cause a use-after-free when a connection is made to the bound socket. The socket returned by accept() also has port VMADDR_PORT_ANY but is not on the list of unbound sockets. Binding it will result in an extra refcount decrement similar to the one fixed in fcdd2242c023 (vsock: Keep the binding until socket destruction).
Modify the check in __vsock_bind_connectible() to also prevent binding to VMADDR_PORT_ANY.
The Linux kernel CVE team has assigned CVE-2025-38618 to this issue.
Affected and fixed versions
===========================
Issue introduced in 3.9 with commit d021c344051af91f42c5ba9fdedc176740cbd238 and fixed in 6.1.148 with commit f138be5d7f301fddad4e65ec66dfc3ceebf79be3 Issue introduced in 3.9 with commit d021c344051af91f42c5ba9fdedc176740cbd238 and fixed in 6.6.102 with commit 44bd006d5c93f6a8f28b106cbae2428c5d0275b7 Issue introduced in 3.9 with commit d021c344051af91f42c5ba9fdedc176740cbd238 and fixed in 6.12.42 with commit 32950b1907919be86a7a2697d6f93d57068b3865 Issue introduced in 3.9 with commit d021c344051af91f42c5ba9fdedc176740cbd238 and fixed in 6.15.10 with commit 8f01093646b49f6330bb2d36761983fd829472b1 Issue introduced in 3.9 with commit d021c344051af91f42c5ba9fdedc176740cbd238 and fixed in 6.16.1 with commit d73960f0cf03ef1dc9e96ec7a20e538accc26d87 Issue introduced in 3.9 with commit d021c344051af91f42c5ba9fdedc176740cbd238 and fixed in 6.17-rc2 with commit aba0c94f61ec05315fa7815d21aefa4c87f6a9f4
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2025-38618
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
net/vmw_vsock/af_vsock.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/f138be5d7f301fddad4e65ec66dfc3ceebf79be3 https://git.kernel.org/stable/c/44bd006d5c93f6a8f28b106cbae2428c5d0275b7 https://git.kernel.org/stable/c/32950b1907919be86a7a2697d6f93d57068b3865 https://git.kernel.org/stable/c/8f01093646b49f6330bb2d36761983fd829472b1 https://git.kernel.org/stable/c/d73960f0cf03ef1dc9e96ec7a20e538accc26d87 https://git.kernel.org/stable/c/aba0c94f61ec05315fa7815d21aefa4c87f6a9f4