В ядре Linux устранена следующая уязвимость:
net/sched: act_gact, act_police: проверка диапазона резервного управляющего действия
Диапазон tcf_action_check_ctrlact() проверяет основное действие элемента управления:
если (!опкод)
ret = действие > TC_ACT_VALUE_MAX? -ЭИНВАЛ: 0;
TC_ACT_VALUE_MAX — это TC_ACT_TRAP, поэтому внутренние вердикты ядра над ним
нельзя установить таким образом. Но act_gact и act_police несут по секунде,
независимое управляющее действие, предоставляемое пользовательским пространством, которое никогда не достигает этого
помощник — TCA_GACT_PROB.paction и TCA_POLICE_RESULT. Оба только отвергают
TC_ACT_GOTO_CHAIN, поэтому любое другое значение сохраняется дословно и возвращается
дословно из действия.
В частности, пользовательское пространство может хранить TC_ACT_CONSUMED, что
TC_ACT_VALUE_MAX + 1 и намеренно не является частью значения UAPI.
диапазон. Этот вердикт сообщает каждому звонящему, что действие взяло на себя ответственность за
skb, поэтому его никто не освобождает: sch_handle_ingress(), sch_handle_egress() и
tcf_qevent_handle() намеренно пропускают бесплатное для него. Результат
одна утечка sk_buff плюс его буфер данных на каждый пакет, проходящий через фильтр,
неограниченный, для всего трафика в цепочке, включая генерируемый ядром
пакеты.
Оба тривиально детерминированы. act_gact ограничивает tcfg_pval значением >= 1, поэтому
с pval = 1 gact_determ() возвращает резервный вариант для каждого пакета.
act_police не имеет обязательной скорости, поэтому скорость = 0 оставляет tcfp_mtu = ~0 и
tcf_police_mtu_check() всегда проходит.
TC_ACT_CONSUMED был добавлен коммитом 720f22fed81b («net: sched: refactor
reinsert action"), после того как оба охранника goto-chain были написаны:
commit 9469f375ab09 ("net/sched: act_gact: запретить 'цепочку перехода' на
резервное управляющее действие") и
commit c08f5ed5d625 ("net/sched: act_police: запретить 'цепочку перехода' на
резервное управляющее действие»). Ни одна из охран не была расширена, когда новый
приговор появился. Учитывайте существующую проверку диапазона из tcf_action_check_ctrlact() как
tcf_action_valid() и примените его к обоим резервным вариантам.
Помощник не может позвонить
tcf_action_check_ctrlact() напрямую, поскольку при этом также выделяется
goto_chain, а это именно то, чего не должны делать эти два сайта. Воспроизведено в версии 7.2-rc6: kmemleak сообщает об одной утечке 232-байта.
skbuff_head_cache плюс его 704-байтовый буфер данных на пакет. С
в этом патче обе конфигурации отклоняются с помощью -EINVAL и kmemleak.
не сообщает ни одного.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: net/sched: act_gact, act_police: range check the fallback control action tcf_action_check_ctrlact() range checks the primary control action: if (!opcode) ret = action > TC_ACT_VALUE_MAX ? -EINVAL : 0; TC_ACT_VALUE_MAX is TC_ACT_TRAP, so kernel-internal verdicts above it cannot be set that way. But act_gact and act_police each carry a second, independent control action supplied by user space that never reaches that helper - TCA_GACT_PROB.paction and TCA_POLICE_RESULT. Both only reject TC_ACT_GOTO_CHAIN, so any other value is stored verbatim and returned verbatim from the action. In particular user space can store TC_ACT_CONSUMED, which is TC_ACT_VALUE_MAX + 1 and is deliberately not part of the UAPI value range. That verdict tells every caller the action took ownership of the skb, so nobody frees it: sch_handle_ingress(), sch_handle_egress() and tcf_qevent_handle() all deliberately skip the free for it. The result is one leaked sk_buff plus its data buffer per packet traversing the filter, unbounded, for all traffic on the chain including kernel-generated packets. Both are trivially deterministic. act_gact clamps tcfg_pval to >= 1, so with pval = 1 gact_determ() returns the fallback for every packet. act_police has no mandatory rate, so rate = 0 leaves tcfp_mtu = ~0 and tcf_police_mtu_check() always passes. TC_ACT_CONSUMED was added by commit 720f22fed81b ("net: sched: refactor reinsert action"), after both goto-chain guards were written: commit 9469f375ab09 ("net/sched: act_gact: disallow 'goto chain' on fallback control action") and commit c08f5ed5d625 ("net/sched: act_police: disallow 'goto chain' on fallback control action"). Neither guard was widened when the new verdict appeared. Factor the existing range test out of tcf_action_check_ctrlact() as tcf_action_valid() and apply it to both fallbacks. The helper cannot call tcf_action_check_ctrlact() directly because that also allocates a goto_chain, which is exactly what these two sites must not do. Reproduced on v7.2-rc6: kmemleak reports one leaked 232-byte skbuff_head_cache object plus its 704-byte data buffer per packet. With this patch both configurations are rejected with -EINVAL and kmemleak reports none.
Уязвимые продукты 8
| Конфигурация | От (включительно) | До (исключительно) |
|---|---|---|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.3
|
5.10.266
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.3
|
5.15.216
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.3
|
6.1.183
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.3
|
6.6.152
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.3
|
6.12.104
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.3
|
6.18.45
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.3
|
7.1.9
|
|
Linux Linux_Kernel
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
|
5.3
|
7.2
|