В ядре Linux устранена следующая уязвимость:
crypto: algif_skcipher — принудительно выполнить синхронную обработку деревьев без ctx->state
Путь AIO/async в skcipher_recvmsg() передает ctx->iv для всего сокета.
непосредственно в запрос skcipher. После io_submit() блокировка сокета
отброшен, и запрос обрабатывается асинхронно, поэтому одновременный
sendmsg(ALG_SET_IV) может перезаписать ctx->iv и выполнить запрос в реальном времени.
запустить под контролируемым злоумышленником IV. Для режимов CTR/стрима это
Повторное использование IV/ключевого потока и позволяет непривилегированному пользователю восстановить открытый текст
одновременная операция.
Снимки ctx->iv в хранилище каждого запроса для асинхронного пути не поддерживаются.
достаточно. Для шифров с размером состояния == 0, включая cbc и ctr,
цепочка IV между частями MSG_MORE осуществляется исключительно на месте
обратная запись req->iv, которую снимок перенаправляет в память для каждого запроса,
af_alg_free_resources() освобождается по завершении, молча выдавая неправильные
выход. Запись IV обратно из обратного вызова завершения не является
возможно: для этого потребуется lock_sock(), но обратный вызов может
запускаться в контексте softirq/atomic, поэтому он не должен спать.
Вместо этого сделайте операцию синхронной, что устранит как гонку IV, так и
любая гонка обратной записи. Это эквивалентно восходящему разрешению, зафиксируйте
fcc77d33a34c («net: Удалить поддержку AIO в сокетах»), что удалило
Путь сокета AIO через сеть/полностью и, таким образом, создает одно и то же конечное состояние для
этот файл. Этот патч намеренно отклоняется от этого коммита: вместо
удаление поддержки сокетов AIO в масштабе дерева, что было бы слишком инвазивно для
стабильный, он удаляет только ветку AIO в файле crypto/algif_skcipher.c.
io_submit() теперь выполняется синхронно; AF_ALG async редко используется в
практика.
Проверка -EIOCBQUEUED в skcipher_recvmsg() теперь неактивна, но безвредна.
и остается в покое, чтобы исправление было минимальным. Протестировано на версии 6.6.y: инъекция атакующего IV снижена с 2296/200000 до 0/200000.
после изменения; MSG_MORE фрагментированный выходной CTR, идентичный одноразовому.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: crypto: algif_skcipher - force synchronous processing on trees without ctx->state The AIO/async path in skcipher_recvmsg() passes the socket-wide ctx->iv directly into the skcipher request. After io_submit() the socket lock is dropped and the request is processed asynchronously, so a concurrent sendmsg(ALG_SET_IV) can overwrite ctx->iv and make the in-flight request run under an attacker-controlled IV. For CTR/stream modes this is IV/keystream reuse and lets an unprivileged user recover the plaintext of a concurrent operation. Snapshotting ctx->iv into per-request storage for the async path is not sufficient. For ciphers with statesize == 0 - which includes cbc and ctr - the MSG_MORE inter-chunk IV chaining is carried solely by the in-place req->iv writeback, which a snapshot redirects into per-request memory that af_alg_free_resources() releases on completion, silently producing wrong output. Writing the IV back from the completion callback instead is not possible either: that would require lock_sock() there, but the callback can run in softirq/atomic context, so it must not sleep. Make the operation synchronous instead, which removes both the IV race and any writeback race. This is equivalent to the upstream resolution, commit fcc77d33a34c ("net: Remove support for AIO on sockets"), which removed the AIO socket path across net/ entirely and so produces the same end state for this file. This patch deviates from that commit deliberately: rather than removing AIO socket support tree-wide, which would be far too invasive for stable, it removes only the AIO branch in crypto/algif_skcipher.c. io_submit() now completes synchronously; AF_ALG async is rarely used in practice. The -EIOCBQUEUED check in skcipher_recvmsg() is now dead but harmless, and is left alone to keep the fix minimal. Tested on 6.6.y: attacker IV injection dropped from 2296/200000 to 0/200000 after the change; MSG_MORE chunked CTR output bit-identical to single-shot.
Характеристики атаки
Последствия
Строка CVSS v3.1
Уязвимые продукты 8
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
4.14
|
5.10.261
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
4.14
|
5.15.212
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
4.14
|
6.1.178
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
4.14
|
6.6.145
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
4.14
|
6.12.97
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
4.14
|
6.18.40
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
4.14
|
7.1.5
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
4.14
|
7.2-rc1
|