DNS Rebinding, Part 2
Coming into this and learning about DNS rebinding, I decided I wanted to build my own attack platform.
After doing some research it was clear how dangerous this could be: getting a victim's LAN IP is trivial, and port scanning from a browser via WebSockets is even more trivial.
The idea of identifying LAN-based services and generating payloads against them (even bypassing CSRF tokens, thanks to DNS rebinding) was just something I couldn't resist. I went straight into building it, and along the way found that the BeEF project (which I hadn't used since 2013) had been heading in exactly the same direction, and was already achieving the kind of crazy I'd been dreaming of: a reverse shell from a web browser with nothing more than JavaScript. Good to know I was on the right track.
Funnily enough, back when I was more active in the information security scene, I felt XSS and CSRF weren't taken seriously enough, and I still feel a lot of developers don't take them seriously, when they can lead to full-scale network compromise. It's been proven time and time again: with enough payloads for common networks, you can pull off MITM attacks on routers, reverse shells on insecure systems, and more.
Some software (and its users) relies on the idea that if you're accessing it from the same system it runs on (127.0.0.1), authorization shouldn't be needed. Attacks like this get around the fact that those things live on the inside of the network, so chaining issues together, such as CSRF plus code execution, leads to actual network compromise.
I'd already identified a few pieces of software that allow this kind of exploitation today, and was going to ship them with my platform as example payloads. Since BeEF already covers the delivery side, the plan now is to report the issues to the vendors, then write them up as payloads for BeEF.
The fun part about some of these systems is that even when minor CSRF protection is in place (mostly tokens), it can be bypassed with attacks like DNS rebinding. Vendors need to start being more responsible about what they let devices do and the code they write, even if it's only meant to run on localhost or a LAN.
You commonly see on forums for smaller open-source projects that "this should never be exposed to the WAN", meaning they're aware of issues in their systems and, instead of fixing them, say the software just shouldn't be reachable from WAN interfaces.
One system in that category is SABnzbd, which tons of people run. In a penetration test there was a point where its post-processing system was abused (I won't go into how just yet), and it essentially let us deploy backdoored versions of both CouchPotato and SABnzbd, allowing us to browse files, take screenshots and more, all embedded within the existing Python.
That said, I'll be following up this article with the CSRF-to-code-execution vulnerabilities I've identified in a popular NAS software. The issue is post-auth, but in previous versions a buddy of mine also found an overflow that allowed both an auth bypass (it overwrote the "isauthed" byte) and code execution via ROP, calling libc's system(). That's since been patched, but there's still a DoS vulnerability in the server code itself, which I'll also be covering.
I'd highly suggest checking out the BeEF project if you haven't in a while: beefproject.com. They're doing some amazing things with it now, and it's good to see I'm not the only one with the mindset of abusing the browser's capabilities to attack devices, platforms and software on the network, getting deeper access from nothing more than a bit of JS.

Comments