I'm brand new to OpenWRT, and I was attracted to it by its modularity. I started getting my feet wet with an old WNR2000V3. I wanted to see if I could produce a stripped down version to use it as a dumb AP. No DHCP or anything.
I love how easy it is to tweak everything while debugging, and now that I had some success with a simple setup, I will start working with a couple of newer routers.
One issue I ran into, though, was enabling stronger hashing algorithms than MD5. I was able to disable the hack and set the default algorithm to SHA256. When I log in using SSH, everything works as expected. I can also successfully change the password from Luci. /etc/shadow shows the correct format.
However, once I enter a new password in Luci, I'm locked out of the router. The password verification function is broken, so entering the correct password doesn't do any good.
We know now that MD5 is very weak and should not be used, so at the very least, SHA256 should be the default algorithm for password hashing in OpenWRT. Can you please provide assistance on how to fix this? I've never programmed in Lua. I'm not sure that the problem is in Luci or in another library (Nixio? Maybe even busybox?)
My suggestion is now to really consider enabling SHA256 or SHA512 as the default password hashing algorithm for OpenWRT. It can even be enabled in a 4MB flash system, albeit with a minimal setup.
As a rough estimate of how much SHA256 improves password security over MD5, we can use the Hashcat benchmarks from an 8 GPU system used in hash cracking competitions:
Hash Type: Number or Hashes per second
If it takes someone one week to crack an MD5 hash, it'll take them 6 months to crack a SHA256, and about 16 months for a SHA512. All we need to do is change a few settings to gain much higher security.
While you are certainly not wrong about MD5 being less strong than other algorithms, I honestly do not see how it actually matters in an OpenWrt single-user scenario. If somebody is in a position to access the password hash for root, the whole system has already been thoroughly compromised and there is nothing further to gain from knowing the root password (unless you use the same password across multiple devices which you shouldn't do anyway.)
Not necessarily, there could be a vulnerability (in uhttpd, for example) that could allow an attacker to read arbitrary files, but not execute code, for instance. It all goes back to the idea of security being like an onion, composed of many layers. We want to make it as hard as possible for an adversary to get access to anything and everything in our system.
I agree 100%, but if you have Luci installed, you have to use passwords. And even if you don't, the /etc/shadow file is still sitting in there in your router. Why not harden it, when it doesn't really cost anything to do it?
P.S. @hnyman pointed out to me that it should be easier than I originally thought. It should be possible to enable hardened passwords by simply disabling the hack, selecting the proper SHA functions, rebuilding the toolchain, and rebuilding OpenWrt. uClibc is not the culprit, as I believed.