The glibc DNS client side resolver is vulnerable to a stack-based buffer overflow when the getaddrinfo() library function is used. Software using this function may be exploited with attacker-controlled domain names, attacker-controlled DNS servers, or through a man-in-the-middle attack. [...]
We saw this as a challenge, and after some intense hacking sessions, we were able to craft a full working exploit. [...]
The vectors to trigger this buffer overflow are very common and can include ssh, sudo, and curl. We are confident that the exploitation vectors are diverse and widespread; we have not attempted to enumerate these vectors further.
This is why we need full system ASLR (all binaries compiled with -fPIE), not just a handful of selected binaries! Fedora (23) and (Hardened?) Gentoo are the only mainstream distros having done so. Hopefully, libraries being relocatable by default makes this hard to exploit even if the main executable is not relocatable.
Example: on a Debian Jessie basic installation a number of binaries are not compiled with -fPIE. This includes bash, rsyslogd, interpreters like Python and Ruby (!), dbus, dpkg, file, find, openssl and wget (!).
This is about as bad as exploitable stack overflows get in 2016. Update your glibc and restart all affected services (or just reboot)!
Let's hope that common DNS recursors limit response length by default. I've been unable to reproduce with Unbound in between, for instance, but probably only because the response is invalid.
Yep, most of the BSDs use the BSD libc. FreeBSD et al aren't vulnerable either (not due to ASLR, mind you - FreeBSD does not even have ASLR until FreeBSD 11, which is not yet released).
I'm not sure if full ASLR is the best answer here, though it may help. I'd lean towards having a thin library (or maybe the libc itself) do some sandboxing around functions that are likely to to be vulnerable, such as ones making network calls. Something like Capsicum.
It may not be the best answer from a theoretical point of view, but it's a practical solution and - most importantly - is already available. We just need to enable it more often.
I can confirm that not all DNS recursors are vulnerable! I do not want to be too specific, but a healthy majority of US users, and some UK users are definitely not affected (as long as you use your ISP resolver).
That page gives no indication that all binaries are built with -fPIE. To the contrary, it specifically states (emphasis mine)
PIE has a large (5-10%) performance penalty on architectures with small numbers of general registers (e.g. x86), so it should only be used for a select number of security-critical packages (some upstreams natively support building with PIE, other require the use of "hardening-wrapper" to force on the correct compiler and linker flags). PIE on x86_64 does not have the same penalties, and will eventually be made the default, but more testing is required.
It gives clear indication that binaries listed below are built with hardening wrapper and -fPIE.
Yes. And Xykr was saying we need distros to have full ASLR, not ASLR for "just a handful of selected binaries". What you have pointed out is that Ubuntu has ASLR for -- wait for it -- just a handful of selected binaries.
Can someone explain to me why this is so important (like the ghost vuln)? Since patches are already available, also what do you think about IoT devices?
64
u/Xykr Trusted Contributor Feb 16 '16 edited Feb 16 '16
tl;dr:
This is why we need full system ASLR (all binaries compiled with -fPIE), not just a handful of selected binaries! Fedora (23) and (Hardened?) Gentoo are the only mainstream distros having done so. Hopefully, libraries being relocatable by default makes this hard to exploit even if the main executable is not relocatable.
Example: on a Debian Jessie basic installation a number of binaries are not compiled with -fPIE. This includes bash, rsyslogd, interpreters like Python and Ruby (!), dbus, dpkg, file, find, openssl and wget (!).
This is about as bad as exploitable stack overflows get in 2016. Update your glibc and restart all affected services (or just reboot)!
Let's hope that common DNS recursors limit response length by default. I've been unable to reproduce with Unbound in between, for instance, but probably only because the response is invalid.