4 ms·
Every time I see these sorts of vulnerabilities I think that these devices are becoming far too complex for their own good --- in this hacking series I've alrea
by userbinator 13y ago
Every time I see these sorts of vulnerabilities I think that these devices are becoming far too complex for their own good --- in this hacking series I've already seen mention of:
- HNAP -> SOAP -> XML
- HTTP
- Linux
The first 2 items above are protocols that are primarily text-based and have no easy way to determine things like lengths. This is bad because it often causes whoever is writing the code to use an arbitrary length that "will probably be big enough", and IMHO that is never a good thing, for various reasons including security.
Making it controlled by a simple, fixed-length (or length-delimited where absolutely required) binary protocol would've reduced or even eliminated many of these overflows, because such protocols are far easier to write correct code for. E.g., if a command is always 8 bytes, then you are always going to use a buffer of 8 bytes and read 8 bytes. Those that need variable-length data can prefix the data bytes with a length, and that must always be read first and acted on, since reading too much or too little just won't work. No need to parse text lines of arbitrary length, (un)escaping, etc. Each additional layer of complexity, each step that needs to be done, is an opportunity for bugs to be introduced.
Also, this is a device that absolutely does not need to be running Linux; its functionality would probably be achievable with an 8-bit microcontroller and WiFi module, running none or maybe a minimal realtime OS. Instead of over 4MB of firmware, a few tens of K would be sufficient. I've seen some very nice and robust embedded devices, and some that seem more like the developers just took a standard Linux devboard, put some code on it that looks like it works, then shipped it. This device is very much one of the latter.
- noonespecial 13y ago>Also, this is a device that absolutely does not need to be running Linux; its functionality would probably be achievable with an 8-bit microcontroller and WiFi module, running none or maybe a minimal realtime OS. This would make it much mode expensive. They just took a router that they already had and added a relay to a gpio pin. The actual cost of the hardware is probably the same. Re-engineering from the ground up? It should be done but the likes of D-Link aren't going to do it.
- snops 13y agoThe CoAP protocol does exactly this and is designed for the exact kind of restricted requirements you specified. It uses similar concepts to Restful HTTP to make the transition easier, but uses a binary protocol instead. You can even get gateways between it and HTTP should you need to use that for some reason (client side JavaScript etc). http://en.wikipedia.org/wiki/Constrained_Application_Protocol http://en.wikipedia.org/wiki/Constrained_Application_Protoco...