Some time ago a friend in infosec asked me to do a strange thing. He asked me to hack him. We will call him Bill, for the sake of anonymity. Other names and places have been changed to protect the innocent. Vendor names have been kept to incriminate the guilty.
Hacking a large corporation is easy(ish). They have information assets that may span the globe, and despite investments in various protection technologies, it’s just hard to keep track of all that stuff. It requires Zen-like discipline to rigorously follow the cycle of scan-patch-repeat day after day, on all assets in an organization, without fail.
Hacking a person can be tough. It’s true that blackhats have the advantage in terms of the asymmetric nature of information security. Sometimes it only takes one bug. But the attack surface area of a single individual is quite small compared to a corporation. In addition, most people trust large vendors with their information and the cloud vendors typically do a decent job of protecting people.
I started with basic recon. I like to use Maltego, along with sites like checkusernames.com, knowem.com, pipl search, and other tools to enumerate online presence. There’s also the classics like Google+, Facebook and Linkedin. It helps to have a fake profile on Facebook for this kind of work. A good bait profile should be tuned to your target. It will help when extracting additional information via social engineering.
In terms of online presence, password reset questions are good low hanging fruit. I’ve seen webmail accounts asking for information that you can pull right out of the target’s Facebook profile. I’m sure most people don’t even make the connection; they may have written their reset questions 5 years ago. None of this stuff was going to work in this case though. My target was an infosec nerd, and he was expecting me.
Time to take the fight to him. First, I checked to see if he is hosting anything on his home Internet connection. He may have been doing this and not even know it. Many apps and devices use UPnP to punch holes in consumer-grade firewalls without much fanfare. Sometimes all it takes is a NAS or media server to open up a backdoor. To find his home IP address, I used a Skype resolver, such as resolvme.org. It worked brilliantly, so I scanned his IP address (and a few neighboring IPs) to see if I could find any services. No dice though… I’m sure he figured I would do this.
Next up, 802.11. Wireless networks are a great attack vector. I have two Radeon 6990’s in an i7 rig that chews through WPA hashes. I use a Markov predictive wordlist generator to feed guesses to oclHashcat. It can achieve an 80% average crack rate over an 8 hour time frame.
So I set about to Bill’s address with various Alfa wifi cards in tow. While in this case I actually know Bill’s address, I may have been able to get this information via recon or social engineering. It’s not exactly a secret. After successfully capturing a WPA handshake, I ran the cracker for a week. Still no dice. This would probably work on most people, but Bill is an infosec guy. His WPA key is probably >32 characters long.
At this point you’re probably wondering why I didn’t just spear-phish him with a Java 0-day and go have my victory beer. The answer is simple — I know my target. He has mastered the mantra of scan-patch-repeat. Java isn’t even installed. And if I did have a browser 0-day in my back pocket, I would have used it to win the pwn2own last week.
After my visit to Bill’s place, I did come away with one useful piece of information. The wireless MAC address (BSSID) of his router: 06:A1:51:E3:15:E3. Since I have the OUI (the first 3 bytes of the MAC), I know that it’s a Netgear router. I also know that Netgear routers have some issues, but Bill was running the latest firmware. That doesn’t mean that all the vulnerabilities were patched in the latest firmware though. The only way to be sure was to buy a Netgear router and test it myself.
Determining the exact model is probably not possible (not remotely anyway). Consumer devices may have a lot of variation between different models as the reference platforms come from SoC vendors such as Broadcom and Atheros. I know that Bill is a bit frugal, so I went with the WNDR3400v3 — the entry level unit.
After reading about some of the vulnerabilities this device has had in the past, I created two Metasploit modules. In the first module, I would use a CSRF bug to POST to the UPnP interface and punch a hole to access the telnet service of the router itself. This issue likely exists in numerous other devices and is worth emphasizing:
If you can spoof UPnP requests via CSRF, you can turn the entire network inside-out.
That’s an important point. I was opening up a single port. You can use Ajax requests from the victim’s browser to configure NAT entries for every IP in a subnet, effectively disabling the firewall. There are hard limits to the number of UPnP NAT entries of course, but most devices will allow enough entries to map a few key ports for a hundred hosts or so.
In order to trick Bill into connecting to my exploit, I sent him an email with an embedded link. Cobalt Strike has a tool to copy an existing email (headers and all), which makes this basically turn-key. All you need to do is modify the links. So what email does everyone always click? What would work even against an infosec guy? Linkedin invites.
EDIT: Some readers have wondered why Bill would fall for this. Even a cursory check of the sender domain or link would have been a dead giveaway. The key to a successful SE campaign is a good pretext. For a background on pretexting, read this article. In this case the invite appeared to be from someone he had a meeting with that afternoon. Well, more of an informal job interview really. I suppose it was confirmation bias — he wanted to believe he got the job.
Now before I sent the email, I needed a follow up payload. By default, the telnet port is enabled on Netgear routers, but the service is unresponsive. You have to connect to the port and send a special unlock key. Public exploits exist for this flaw, but I wrote another MSF module because I love my Ruby (and Metasploit).
Bill clicked the link. As soon as I saw the callback, I triggered the second module and logged into the router via telnet. Once I obtained root access to the router, I immediately changed the DNS settings to point to a DNS server that I control.
Controlling DNS is a powerful thing; it effectively provides you with on-demand man-in-the-middle. There are plenty of MITM attack vectors, but I like Evilgrade for stealth. Evilgrade has been out for years, and still works great (some modifications necessary). It took about a week before Bill decided to upgrade notepad++ to the new version. When he did, he was fed a backdoored version that gave me a Meterpreter shell on his computer. I immediately emailed him a few screen shots and a keystroke log, and he unplugged his computer a few minutes later.
For my efforts, I was rewarded with a six-pack of Ruby ale. I do love my Ruby.