-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TW#12798] components/lwip/apps/dhcpserver: Heap corruption for extended message options #631
Comments
https://github.com/espressif/esp-idf/blob/master/components/lwip/apps/dhcpserver.c#L897 No check for dhcps_msg overflow
Are these packets in spec? How to resolve? Drop the extra bytes? |
https://www.ietf.org/rfc/rfc2131.txt only states a minimum supported option length for the client - 312 octets. No spec for the server if I didn't miss anything there.
I got the recommendation back then to increase the |
Thanks @devsaurus, your analysis is helpful for us, will update you once we have new progress... |
Hi @devsaurus @negativekelvin the fix for this issue is submit, it will be targeted into idf release 2.1 |
Thanks for the fix, @liuzfesp! |
* backport fix for espressif/esp-idf#631 * remove code from intermediate fix
* backport fix for espressif/esp-idf#631 * remove code from intermediate fix
We've experienced and reported the same issue with NodeMCU based on non-OS SDK in the past. It appears to be still present in the IDF's dhcpserver.
Problem description
When the firmware is in soft-AP mode and DHCP server is enabled, the DHCP server will cause a crash when a packet is received that exceeds the expected size for struct dhcp_msg in dhcpserver.h. This blocks certain clients that send such packets from interfacing with the ESP AP.
Steps to reproduce
Download and extract dhcp_msgs.zip.
dhcp.bin
contains a valid DHCP request.dhcp_fault.bin
adds a lot of 0xdeadbeef in the padding section to extend the size of the DHCP request beyond the size of struct dhcp_msg.Connect to the ESP AP from a Linux machine. At the shell execute
This triggers an immediate reset of the firmware.
The text was updated successfully, but these errors were encountered: