Клиент Zephyr TFTP в subsys/net/lib/tftp/tftp_client.c не проверяет, откуда поступает ответ на его запрос. После отправки запроса на чтение или запись на сконфигурированный сервер send_request() принимает первую дейтаграмму UDP, которая поступает на сокет клиента с любого адреса и порта. Затем он вызывает zsock_connect () этому отправителю, поэтому отправитель становится равноправным для остальной части передачи.
RFC 1350 требует, чтобы клиент отбрасывал дейтаграммы, источник которых не соответствует ожидаемой передаче ID. Хост, который может отправить дейтаграмму UDP на эфемерный порт клиента, прежде чем реальные ответы сервера смогут принять передачу. Он может отвечать со своего собственного адреса и не нуждается в подмене сервера.
Узел в том же сегменте сети, который видит запрос, может сделать это легко. Злоумышленник должен угадать рандомизированный эфемерный порт и выиграть гонку, что проще, когда сервер медленный или недоступный. Никакая аутентификация или взаимодействие с пользователем не требуется за пределами устройства, начинающего передачу через tftp_get() или tftp_put(), например, из приложения или команды оболочки net tftp.
Для tftp_get() злоумышленник выбирает весь контент, переданный обратному вызову данных приложения. Для tftp_put() весь буфер загрузки отправляется злоумышленнику. Коррупции памяти нет.
Сам TFTP не имеет аутентификации, и после исправления злоумышленник, который может подделать адрес сервера IP, все еще может помешать передаче. Fix проверяет адрес сервера на первом ответе, полный адрес и порт на каждой последующей дейтаграмме и удаляет несоответствия, не используя повторные попытки передачи.
Показать оригинальное описание (EN)
The Zephyr TFTP client in subsys/net/lib/tftp/tftp_client.c does not check where the reply to its request comes from. After sending a read or write request to the configured server, send_request() accepts the first UDP datagram that arrives on the client's socket from any address and port. It then calls zsock_connect() to that sender, so the sender becomes the peer for the rest of the transfer. RFC 1350 requires a client to discard datagrams whose source does not match the transfer ID it expects. A host that can send a UDP datagram to the client's ephemeral port before the real server replies can take over the transfer. It can reply from its own address and does not need to spoof the server. A host on the same network segment that sees the request can do this easily. An off-path attacker must guess the randomized ephemeral port and win the race, which is easier when the server is slow or unreachable. No authentication or user interaction is needed beyond the device starting a transfer through tftp_get() or tftp_put(), for example from an application or the net tftp shell command. For tftp_get(), the attacker chooses the entire content handed to the application's data callback. For tftp_put(), the whole upload buffer is sent to the attacker. There is no memory corruption. TFTP itself has no authentication, and after the fix an attacker who can spoof the server's IP address can still interfere with a transfer. The fix checks the server's address on the first reply and the full address and port on every later datagram, and drops mismatches without using up the transfer's retries.
Характеристики атаки
Последствия
Строка CVSS v3.1