В ядре Linux устранена следующая уязвимость:
Отменить «smb: client: исправить взаимоблокировку таймеров TCP после rmmod»
Это отменяет фиксацию e9f2517a3e18a54a3943c098d2226b245d488801. Commit e9f2517a3e18 («smb: client: исправить взаимоблокировку таймеров TCP после
rmmod") предназначен для исправления разыменования null-ptr в LOCKDEP, что
упоминается как CVE-2024-54680, но на самом деле ничего не исправляет;
Проблему можно воспроизвести поверх нее. [0]
Кроме того, он отменил изменение, выполнив коммит ef7134c7fc48 ("smb: client:
Исправить использование после освобождения сетевого пространства имен.») и представил реальную
проблема путем восстановления TCP-сокета ядра. Когда происходит повторное подключение для соединения CIFS, состояние сокета
переходит к FIN_WAIT_1.
Затем inet_csk_clear_xmit_timers_sync()
в tcp_close() останавливает все таймеры сокета. Если входящий пакет FIN потерян, сокет останется в состоянии FIN_WAIT_1.
навсегда, и такие сокеты могут попасть в net.ipv4.tcp_max_orphans. Обычно одноранговый узел может повторно передать FIN, но если одноранговый узел прерывает
связь, вопрос вступает в реальность.
Я предупредил об этом в частном порядке, указав точный отчет [1], но фиктивное исправление было наконец добавлено. Таким образом, нам не следует останавливать таймеры, чтобы окончательно разорвать соединение. в этом случае наша сторона, а это означает, что мы не должны использовать сокет ядра для TCP, у которого sk->sk_net_refcnt равен 0. Сокет ядра не имеет ссылки на свои netns, чтобы сделать его можно снести netns, не очищая в нем все ресурсы.
Например, туннельные устройства внутренне используют сокет UDP, но мы можем
уничтожьте netns, не удаляя такие устройства, и дайте ему завершиться
во время выхода. В противном случае произойдет утечка данных netns при последнем приложении.
умер. Однако это проблематично для сокетов TCP, поскольку TCP имеет таймеры для
корректно закройте соединение даже после того, как сокет будет close()d.
время жизни сокета и его netns отличается от времени жизни
лежащее в основе соединение.
Если пользователь сокета не поддерживает время жизни netns, таймер может
запускаться после того, как сокет close()d и его netns освобождены, что приводит к
в использовании-после-бесплатно. На самом деле, мы видели очень много подобных проблем и конвертировали такие сокеты
иметь ссылку на netns. Вот почему я преобразовал клиентский сокет CIFS, чтобы иметь ссылку на
netns (sk->sk_net_refcnt == 1), который почему-то упоминается как выходящий за рамки
CIFS и технически неверно в e9f2517a3e18, но ** входит в область действия и верно
исправить**.
Что касается проблемы LOCKDEP, мы можем предотвратить выгрузку модуля,
увеличение счетчика ссылок модуля при включении ключа LOCKDDEP
sock_lock_init_class_and_name(). [2]
Давайте на время отменим фиктивное исправление. Обратите внимание, что теперь мы можем использовать sk_net_refcnt_upgrade() для сокета.
преобразование, но я сделаю это позже отдельно, чтобы упростить бэкпорт.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: Revert "smb: client: fix TCP timers deadlock after rmmod" This reverts commit e9f2517a3e18a54a3943c098d2226b245d488801. Commit e9f2517a3e18 ("smb: client: fix TCP timers deadlock after rmmod") is intended to fix a null-ptr-deref in LOCKDEP, which is mentioned as CVE-2024-54680, but is actually did not fix anything; The issue can be reproduced on top of it. [0] Also, it reverted the change by commit ef7134c7fc48 ("smb: client: Fix use-after-free of network namespace.") and introduced a real issue by reviving the kernel TCP socket. When a reconnect happens for a CIFS connection, the socket state transitions to FIN_WAIT_1. Then, inet_csk_clear_xmit_timers_sync() in tcp_close() stops all timers for the socket. If an incoming FIN packet is lost, the socket will stay at FIN_WAIT_1 forever, and such sockets could be leaked up to net.ipv4.tcp_max_orphans. Usually, FIN can be retransmitted by the peer, but if the peer aborts the connection, the issue comes into reality. I warned about this privately by pointing out the exact report [1], but the bogus fix was finally merged. So, we should not stop the timers to finally kill the connection on our side in that case, meaning we must not use a kernel socket for TCP whose sk->sk_net_refcnt is 0. The kernel socket does not have a reference to its netns to make it possible to tear down netns without cleaning up every resource in it. For example, tunnel devices use a UDP socket internally, but we can destroy netns without removing such devices and let it complete during exit. Otherwise, netns would be leaked when the last application died. However, this is problematic for TCP sockets because TCP has timers to close the connection gracefully even after the socket is close()d. The lifetime of the socket and its netns is different from the lifetime of the underlying connection. If the socket user does not maintain the netns lifetime, the timer could be fired after the socket is close()d and its netns is freed up, resulting in use-after-free. Actually, we have seen so many similar issues and converted such sockets to have a reference to netns. That's why I converted the CIFS client socket to have a reference to netns (sk->sk_net_refcnt == 1), which is somehow mentioned as out-of-scope of CIFS and technically wrong in e9f2517a3e18, but **is in-scope and right fix**. Regarding the LOCKDEP issue, we can prevent the module unload by bumping the module refcount when switching the LOCKDDEP key in sock_lock_init_class_and_name(). [2] For a while, let's revert the bogus fix. Note that now we can use sk_net_refcnt_upgrade() for the socket conversion, but I'll do so later separately to make backport easy.
Характеристики атаки
Последствия
Строка CVSS v3.1
Тип уязвимости (CWE)
Уязвимые продукты 10
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.6.68
|
6.6.88
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.12.7
|
6.12.25
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.13.1
|
6.14.4
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.13:-:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.13:rc4:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.13:rc5:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.13:rc6:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.13:rc7:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.15:rc1:*:*:*:*:*:*
|
— | — |
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:6.15:rc2:*:*:*:*:*:*
|
— | — |