В ядре Linux устранена следующая уязвимость:
Tipc: исправление использования плит после освобождения. Прочтите в Tipc_aeaad_decrypt_done.
Tipc_aad_decrypt() переходит прямо от Tipc_bearer_hold(b) к
crypto_aad_decrypt(req) без обращения к сети, в отличие от
путь шифрования. Когда crypto_aad_decrypt() выгружается асинхронно
(например, оболочка SIMD, стоящая в очереди к cryptd), рабочий cryptd запускается
Tipc_aad_decrypt_done() позже.
Если сеть носителя разорвана в
тем временем, cleanup_net() -> Tipc_exit_net() -> Tipc_crypto_stop() освобождает
per-netns Tipc_crypto, а затем автодополнение считывает его:
Tipc_aeaad_decrypt_done() разыменовывает aead->crypto->stats и
разыменования aead->crypto->net и Tipc_crypto_rcv_complete()
aead->crypto->aad[] и таблица узлов — чтение освобожденной памяти. Раскодированный сплат KASAN (v7.1-rc7, CONFIG_KASAN_INLINE + TIPC + TIPC_CRYPTO):
ОШИБКА: KASAN: slab-use-after-free в Tipc_aad_decrypt_done (net/tipc/crypto.c:999)
Чтение размера 8 по адресу ffff8881056258a8 с помощью задачи kworker/u16:2/51. Рабочая очередь: event_unbound
Отслеживание вызова:
Tipc_aad_decrypt_done (net/tipc/crypto.c:999)
process_one_work (ядро/workqueue.c:3314)
рабочий_поток (kernel/workqueue.c:3397 kernel/workqueue.c:3478)
kthread (ядро/kthread.c:436)
ret_from_fork (arch/x86/kernel/process.c:158)
ret_from_fork_asm (arch/x86/entry/entry_64.S:245)
Выделено заданием 169:
__kasan_kmalloc (mm/kasan/common.c:398 мм/kasan/common.c:415)
Tipc_crypto_start (net/tipc/crypto.c:1502)
Tipc_init_net (net/tipc/core.c:72)
ops_init (net/core/net_namespace.c:137)
setup_net (net/core/net_namespace.c:446)
copy_net_ns (net/core/net_namespace.c:579)
create_new_namespaces (ядро/nsproxy.c:132)
__x64_sys_unshare (ядро/fork.c:3316)
do_syscall_64 (arch/x86/entry/syscall_64.c:63)
запись_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121)
Освобожден заданием 8:
свободный (мм/слуб.с:6566)
Tipc_exit_net (net/tipc/core.c:119)
Cleanup_net (net/core/net_namespace.c:704)
process_one_work (ядро/workqueue.c:3314)
kthread (ядро/kthread.c:436)
Это тот же класс ошибок, которые вызывают ошибку e279024617134 ("net/tipc: fix
slab-use-after-free Прочитать в Tipc_aad_encrypt_done") исправлено для шифрования
сторона.
Путь шифрования принимает Maybe_get_net(aad->crypto->net) перед
crypto_aad_encrypt() и удаляет его с помощью put_net() в синхронном
пути возврата и в Tipc_aad_encrypt_done(); -EINPROGRESS/-EBUSY
return сохраняет ссылку на асинхронный обратный вызов для выпуска. Расшифровка
путь остался без равноценной охраны. Отразите исправление на стороне шифрования на пути расшифровки: возьмите сетевую ссылку
перед crypto_aad_decrypt() (не работает с -ENODEV и соответствующим
оферта на предъявителя, если ее невозможно приобрести), держите ее поперек
-EINPROGRESS/-EBUSY асинхронный возврат и поместите его с помощью put_net() в
синхронный возврат успеха/ошибки и в конце
Tipc_aad_decrypt_done().
Воспроизведено под KASAN на v7.1-rc7: UDP-носитель с ключом кластера
заполненный созданными зашифрованными кадрами от неизвестного узла (управляющий
путь расшифровки кластерного ключа), в то время как сеть носителя неоднократно разрывается
вниз. Завершение должно выполняться асинхронно, чтобы пережить
Tipc_crypto_stop(); на x86 стандартный aesni gcm(aes) теперь расшифровывает
синхронно, поэтому асинхронный путь выполнялся через разгрузку cryptd.
незащищенное разыменование aead->crypto в Tipc_aeaad_decrypt_done() - это
непропатченный восходящий путь; Tipc_aad_decrypt() все еще отсутствует
Maybe_get_net(aad->crypto->net), поэтому завершение может пережить свободное
в любой конфигурации, где crypto_aad_decrypt() работает асинхронно. Обнаружен с помощью автоматизированного инструмента исследования безопасности 0sec (https://0sec.ai).
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: tipc: fix slab-use-after-free Read in tipc_aead_decrypt_done tipc_aead_decrypt() goes straight from tipc_bearer_hold(b) to crypto_aead_decrypt(req) without taking a reference on the netns, unlike the encrypt path. When crypto_aead_decrypt() is offloaded asynchronously (e.g. the SIMD aead wrapper queuing to cryptd), the cryptd worker runs tipc_aead_decrypt_done() later. If the bearer's netns is torn down in the meantime, cleanup_net() -> tipc_exit_net() -> tipc_crypto_stop() frees the per-netns tipc_crypto, and the completion then reads it: tipc_aead_decrypt_done() dereferences aead->crypto->stats and aead->crypto->net, and tipc_crypto_rcv_complete() dereferences aead->crypto->aead[] and the node table -- reading freed memory. Decoded KASAN splat (v7.1-rc7, CONFIG_KASAN_INLINE + TIPC + TIPC_CRYPTO): BUG: KASAN: slab-use-after-free in tipc_aead_decrypt_done (net/tipc/crypto.c:999) Read of size 8 at addr ffff8881056258a8 by task kworker/u16:2/51 Workqueue: events_unbound Call Trace: tipc_aead_decrypt_done (net/tipc/crypto.c:999) process_one_work (kernel/workqueue.c:3314) worker_thread (kernel/workqueue.c:3397 kernel/workqueue.c:3478) kthread (kernel/kthread.c:436) ret_from_fork (arch/x86/kernel/process.c:158) ret_from_fork_asm (arch/x86/entry/entry_64.S:245) Allocated by task 169: __kasan_kmalloc (mm/kasan/common.c:398 mm/kasan/common.c:415) tipc_crypto_start (net/tipc/crypto.c:1502) tipc_init_net (net/tipc/core.c:72) ops_init (net/core/net_namespace.c:137) setup_net (net/core/net_namespace.c:446) copy_net_ns (net/core/net_namespace.c:579) create_new_namespaces (kernel/nsproxy.c:132) __x64_sys_unshare (kernel/fork.c:3316) do_syscall_64 (arch/x86/entry/syscall_64.c:63) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:121) Freed by task 8: kfree (mm/slub.c:6566) tipc_exit_net (net/tipc/core.c:119) cleanup_net (net/core/net_namespace.c:704) process_one_work (kernel/workqueue.c:3314) kthread (kernel/kthread.c:436) This is the same class of bug that commit e279024617134 ("net/tipc: fix slab-use-after-free Read in tipc_aead_encrypt_done") fixed for the encrypt side. The encrypt path takes maybe_get_net(aead->crypto->net) before crypto_aead_encrypt() and drops it with put_net() on the synchronous return paths and in tipc_aead_encrypt_done(); the -EINPROGRESS/-EBUSY return keeps the reference for the async callback to release. The decrypt path was left without the equivalent guard. Mirror the encrypt-side fix on the decrypt path: take a net reference before crypto_aead_decrypt() (failing with -ENODEV and the matching bearer put if it cannot be acquired), keep it across the -EINPROGRESS/-EBUSY async return, and drop it with put_net() on the synchronous success/error return and at the end of tipc_aead_decrypt_done(). Reproduced under KASAN on v7.1-rc7: a UDP bearer with a cluster key is flooded with crafted encrypted frames from an unknown peer (driving the cluster-key decrypt path) while the bearer's netns is repeatedly torn down. The completion must run asynchronously to outlive tipc_crypto_stop(); on x86 the stock aesni gcm(aes) now decrypts synchronously, so the async path was exercised via cryptd offload. The unguarded aead->crypto dereference in tipc_aead_decrypt_done() is the unpatched upstream path; tipc_aead_decrypt() still lacks maybe_get_net(aead->crypto->net), so the completion can outlive the free on any config where crypto_aead_decrypt() goes async. Found by 0sec automated security-research tooling (https://0sec.ai).
Характеристики атаки
Последствия
Строка CVSS v3.1
Тип уязвимости (CWE)
Уязвимые продукты 7
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.5
|
5.10.260
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.11
|
5.15.211
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.16
|
6.1.177
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.2
|
6.6.144
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.7
|
6.12.95
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.13
|
6.18.38
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
6.19
|
7.1.3
|