In the Linux kernel, the following vulnerability has been resolved: net: ipconfig: bound DHCP option construction ic_dhcp_init_options() appends the hostname (option 12), vendor-class (option 60) and client-ID (option 61) options into the fixed 312-byte bootp_pkt.exten[] buffer. Только ветка с идентификатором клиента проверила оставшееся пространство; имя хоста и записи класса поставщика были неограниченными. 64-байтное имя хоста вместе с максимальным 252-байтным dhcpclass идентификатором требует 18 + (2 + 64) + (2 + 252) 338 из 312 доступных байтов еще до окончания маркера END, поэтому memcpy класса поставщика проходит мимо конца exten. С CONFIG_FORTIFY_SOURCE это сообщается как запись с расширением поля и, когда ядро загружается с panic_on_warn=1, прерывает загрузку с паникой.
Маршрутизируйте дополнительные опции через общий помощник, который гарантирует, что опция, ее 2-байтовый заголовок и маркер END подходят и удаляют опцию, которая не подходит. Конфигурации с короткими опциями продолжают отправлять точно такие же байты, как и раньше.
Показать оригинальное описание (EN)
In the Linux kernel, the following vulnerability has been resolved: net: ipconfig: bound DHCP option construction ic_dhcp_init_options() appends the hostname (option 12), vendor-class (option 60) and client-ID (option 61) options into the fixed 312-byte bootp_pkt.exten[] buffer. Only the client-ID branch checked the remaining space; the hostname and vendor-class writes were unbounded. A 64-byte hostname together with the maximum 252-byte dhcpclass= identifier needs 18 + (2 + 64) + (2 + 252) = 338 of the 312 available bytes even before the terminating END marker, so the vendor-class memcpy runs past the end of exten[]. With CONFIG_FORTIFY_SOURCE this is reported as a field-spanning write and, when the kernel is booted with panic_on_warn=1, aborts boot with a panic. Route the optional options through a common helper that makes sure the option, its 2-byte header and the END marker all fit and drops an option that would not. Configurations with short options keep sending exactly the same bytes as before.