{"vulnerability": "CVE-2024-54680", "sightings": [{"uuid": "00eb2bc3-26e3-4083-8c9b-1c75c0d62c3b", "vulnerability_lookup_origin": "1a89b78e-f703-45f3-bb86-59eb712668bd", "author": "9f56dd64-161d-43a6-b9c3-555944290a09", "vulnerability": "CVE-2024-54680", "type": "seen", "source": "https://bsky.app/profile/cve-notifications.bsky.social/post/3lfhs5ggedp2a", "content": "", "creation_timestamp": "2025-01-11T13:17:01.703144Z"}, {"uuid": "212a41e2-35c9-4a97-b2cb-40f7ddbe5259", "vulnerability_lookup_origin": "1a89b78e-f703-45f3-bb86-59eb712668bd", "author": "9f56dd64-161d-43a6-b9c3-555944290a09", "vulnerability": "CVE-2024-54680", "type": "seen", "source": "https://infosec.exchange/users/vuldb/statuses/113809985518349846", "content": "", "creation_timestamp": "2025-01-11T13:36:02.691142Z"}, {"uuid": "a595460a-e4ca-4851-aac9-8ee2ce7d94aa", "vulnerability_lookup_origin": "1a89b78e-f703-45f3-bb86-59eb712668bd", "author": "9f56dd64-161d-43a6-b9c3-555944290a09", "vulnerability": "CVE-2024-54680", "type": "published-proof-of-concept", "source": "https://t.me/cvedetector/15076", "content": "{\n  \"Source\": \"CVE FEED\",\n  \"Title\": \"CVE-2024-54680 - Linux Kernel Samba SMB Client NetNS Reference Counting Vulnerability\", \n  \"Content\": \"CVE ID : CVE-2024-54680 \nPublished : Jan. 11, 2025, 1:15 p.m. | 35\u00a0minutes ago \nDescription : In the Linux kernel, the following vulnerability has been resolved:  \n  \nsmb: client: fix TCP timers deadlock after rmmod  \n  \nCommit ef7134c7fc48 (\"smb: client: Fix use-after-free of network namespace.\")  \nfixed a netns UAF by manually enabled socket refcounting  \n(sk-&gt;sk_net_refcnt=1 and sock_inuse_add(net, 1)).  \n  \nThe reason the patch worked for that bug was because we now hold  \nreferences to the netns (get_net_track() gets a ref internally)  \nand they're properly released (internally, on __sk_destruct()),  \nbut only because sk-&gt;sk_net_refcnt was set.  \n  \nProblem:  \n(this happens regardless of CONFIG_NET_NS_REFCNT_TRACKER and regardless  \nif init_net or other)  \n  \nSetting sk-&gt;sk_net_refcnt=1 *manually* and *after* socket creation is not  \nonly out of cifs scope, but also technically wrong -- it's set conditionally  \nbased on user (=1) vs kernel (=0) sockets.  And net/ implementations  \nseem to base their user vs kernel space operations on it.  \n  \ne.g. upon TCP socket close, the TCP timers are not cleared because  \nsk-&gt;sk_net_refcnt=1:  \n(cf. commit 151c9c724d05 (\"tcp: properly terminate timers for kernel sockets\"))  \n  \nnet/ipv4/tcp.c:  \n    void tcp_close(struct sock *sk, long timeout)  \n    {  \n     lock_sock(sk);  \n     __tcp_close(sk, timeout);  \n     release_sock(sk);  \n     if (!sk-&gt;sk_net_refcnt)  \n      inet_csk_clear_xmit_timers_sync(sk);  \n     sock_put(sk);  \n    }  \n  \nWhich will throw a lockdep warning and then, as expected, deadlock on  \ntcp_write_timer().  \n  \nA way to reproduce this is by running the reproducer from ef7134c7fc48  \nand then 'rmmod cifs'.  A few seconds later, the deadlock/lockdep  \nwarning shows up.  \n  \nFix:  \nWe shouldn't mess with socket internals ourselves, so do not set  \nsk_net_refcnt manually.  \n  \nAlso change __sock_create() to sock_create_kern() for explicitness.  \n  \nAs for non-init_net network namespaces, we deal with it the best way  \nwe can -- hold an extra netns reference for server-&gt;ssocket and drop it  \nwhen it's released.  This ensures that the netns still exists whenever  \nwe need to create/destroy server-&gt;ssocket, but is not directly tied to  \nit. \nSeverity: 0.0 | NA \nVisit the link for more details, such as CVSS details, affected products, timeline, and more...\",\n  \"Detection Date\": \"11 Jan 2025\",\n  \"Type\": \"Vulnerability\"\n}\n\ud83d\udd39 t.me/cvedetector \ud83d\udd39", "creation_timestamp": "2025-01-11T14:55:32.000000Z"}, {"uuid": "89e88c40-866f-4282-8ac7-d6de23e21d21", "vulnerability_lookup_origin": "1a89b78e-f703-45f3-bb86-59eb712668bd", "author": "9f56dd64-161d-43a6-b9c3-555944290a09", "vulnerability": "CVE-2024-54680", "type": "published-proof-of-concept", "source": "https://t.me/DarkWebInformer_CVEAlerts/1305", "content": "\ud83d\udd17 DarkWebInformer.com - Cyber Threat Intelligence\n\ud83d\udccc CVE ID: CVE-2024-54680\n\ud83d\udd39 Description: In the Linux kernel, the following vulnerability has been resolved:\n\nsmb: client: fix TCP timers deadlock after rmmod\n\nCommit ef7134c7fc48 (\"smb: client: Fix use-after-free of network namespace.\")\nfixed a netns UAF by manually enabled socket refcounting\n(sk-&gt;sk_net_refcnt=1 and sock_inuse_add(net, 1)).\n\nThe reason the patch worked for that bug was because we now hold\nreferences to the netns (get_net_track() gets a ref internally)\nand they're properly released (internally, on __sk_destruct()),\nbut only because sk-&gt;sk_net_refcnt was set.\n\nProblem:\n(this happens regardless of CONFIG_NET_NS_REFCNT_TRACKER and regardless\nif init_net or other)\n\nSetting sk-&gt;sk_net_refcnt=1 *manually* and *after* socket creation is not\nonly out of cifs scope, but also technically wrong -- it's set conditionally\nbased on user (=1) vs kernel (=0) sockets.  And net/ implementations\nseem to base their user vs kernel space operations on it.\n\ne.g. upon TCP socket close, the TCP timers are not cleared because\nsk-&gt;sk_net_refcnt=1:\n(cf. commit 151c9c724d05 (\"tcp: properly terminate timers for kernel sockets\"))\n\nnet/ipv4/tcp.c:\n    void tcp_close(struct sock *sk, long timeout)\n    {\n     lock_sock(sk);\n     __tcp_close(sk, timeout);\n     release_sock(sk);\n     if (!sk-&gt;sk_net_refcnt)\n      inet_csk_clear_xmit_timers_sync(sk);\n     sock_put(sk);\n    }\n\nWhich will throw a lockdep warning and then, as expected, deadlock on\ntcp_write_timer().\n\nA way to reproduce this is by running the reproducer from ef7134c7fc48\nand then 'rmmod cifs'.  A few seconds later, the deadlock/lockdep\nwarning shows up.\n\nFix:\nWe shouldn't mess with socket internals ourselves, so do not set\nsk_net_refcnt manually.\n\nAlso change __sock_create() to sock_create_kern() for explicitness.\n\nAs for non-init_net network namespaces, we deal with it the best way\nwe can -- hold an extra netns reference for server-&gt;ssocket and drop it\nwhen it's released.  This ensures that the netns still exists whenever\nwe need to create/destroy server-&gt;ssocket, but is not directly tied to\nit.\n\ud83d\udccf Published: 2025-01-11T12:35:43.170Z\n\ud83d\udccf Modified: 2025-01-11T12:35:43.170Z\n\ud83d\udd17 References:\n1. https://git.kernel.org/stable/c/906807c734ed219dcb2e7bbfde5c4168ed72a3d0\n2. https://git.kernel.org/stable/c/127e907e11ccd54b59bb78fc22c43ccb76c71079\n3. https://git.kernel.org/stable/c/e9f2517a3e18a54a3943c098d2226b245d488801", "creation_timestamp": "2025-01-11T13:06:26.000000Z"}, {"uuid": "e038c9e9-4384-44d8-a4bc-f38387acd7ac", "vulnerability_lookup_origin": "1a89b78e-f703-45f3-bb86-59eb712668bd", "author": "9f56dd64-161d-43a6-b9c3-555944290a09", "vulnerability": "CVE-2024-54680", "type": "published-proof-of-concept", "source": "https://t.me/DarkWebInformer_CVEAlerts/12805", "content": "\ud83d\udd17 DarkWebInformer.com - Cyber Threat Intelligence\n\ud83d\udccc CVE ID: CVE-2025-22077\n\ud83d\udd25 CVSS Score: N/A\n\ud83d\udd39 Description: In the Linux kernel, the following vulnerability has been resolved:\n\nRevert \"smb: client: fix TCP timers deadlock after rmmod\"\n\nThis reverts commit e9f2517a3e18a54a3943c098d2226b245d488801.\n\nCommit e9f2517a3e18 (\"smb: client: fix TCP timers deadlock after\nrmmod\") is intended to fix a null-ptr-deref in LOCKDEP, which is\nmentioned as CVE-2024-54680, but is actually did not fix anything;\nThe issue can be reproduced on top of it. [0]\n\nAlso, it reverted the change by commit ef7134c7fc48 (\"smb: client:\nFix use-after-free of network namespace.\") and introduced a real\nissue by reviving the kernel TCP socket.\n\nWhen a reconnect happens for a CIFS connection, the socket state\ntransitions to FIN_WAIT_1.  Then, inet_csk_clear_xmit_timers_sync()\nin tcp_close() stops all timers for the socket.\n\nIf an incoming FIN packet is lost, the socket will stay at FIN_WAIT_1\nforever, and such sockets could be leaked up to net.ipv4.tcp_max_orphans.\n\nUsually, FIN can be retransmitted by the peer, but if the peer aborts\nthe connection, the issue comes into reality.\n\nI warned about this privately by pointing out the exact report [1],\nbut the bogus fix was finally merged.\n\nSo, we should not stop the timers to finally kill the connection on\nour side in that case, meaning we must not use a kernel socket for\nTCP whose sk-&gt;sk_net_refcnt is 0.\n\nThe kernel socket does not have a reference to its netns to make it\npossible to tear down netns without cleaning up every resource in it.\n\nFor example, tunnel devices use a UDP socket internally, but we can\ndestroy netns without removing such devices and let it complete\nduring exit.  Otherwise, netns would be leaked when the last application\ndied.\n\nHowever, this is problematic for TCP sockets because TCP has timers to\nclose the connection gracefully even after the socket is close()d.  The\nlifetime of the socket and its netns is different from the lifetime of\nthe underlying connection.\n\nIf the socket user does not maintain the netns lifetime, the timer could\nbe fired after the socket is close()d and its netns is freed up, resulting\nin use-after-free.\n\nActually, we have seen so many similar issues and converted such sockets\nto have a reference to netns.\n\nThat's why I converted the CIFS client socket to have a reference to\nnetns (sk-&gt;sk_net_refcnt == 1), which is somehow mentioned as out-of-scope\nof CIFS and technically wrong in e9f2517a3e18, but **is in-scope and right\nfix**.\n\nRegarding the LOCKDEP issue, we can prevent the module unload by\nbumping the module refcount when switching the LOCKDDEP key in\nsock_lock_init_class_and_name(). [2]\n\nFor a while, let's revert the bogus fix.\n\nNote that now we can use sk_net_refcnt_upgrade() for the socket\nconversion, but I'll do so later separately to make backport easy.\n\ud83d\udccf Published: 2025-04-16T14:12:27.882Z\n\ud83d\udccf Modified: 2025-04-22T05:34:52.181Z\n\ud83d\udd17 References:\n1. https://git.kernel.org/stable/c/95d2b9f693ff2a1180a23d7d59acc0c4e72f4c41", "creation_timestamp": "2025-04-22T06:03:21.000000Z"}]}