I was having a random conversation with Christian. The conversation was based around Kali Nethunter and all the cool stuff that can be done with it. The discussion was revolving around “man in the middle attacks” and I suggested that having BRO running on Nethunter would be awesome. This got him excited and true to his nature, he couldn’t rest till he’d attempted it. Long story short, he did some amazing work and had it running soon afterwards complete with a detailed “how to” guide. Here’s a link to the guide.
With bro running on a phone, a world of exploration is opened up. You now have an enterprise level IDS running on your phone :). I hope you see where this is headed. What do you do with an IDS on your phone? You obviously investigate what your phone communicates with. What interested me most was the rmnet0 interface on android. This is the interface assigned to your data connection. It gets assigned a public IP by your telecommunications provider so no NAT issues.
The set up
This Saturday afternoon I decided to see what my phone communicates to over a one hour period while connected to the mobile data network. This is how I set up things:
>Nethunter running on a Nexus 5 with Android 5.1
>BRO running in standalone mode monitoring rmnet0
>Mobile data connection on the Safaricom network
>ADB connection to a laptop
>shodan-cli to investigate IPs
Once everything was in place I used the phone as I would normally for about 10 minutes or so - browsed a bit and opened a few apps such as Twitter and Facebook. After that I left it idle for about an hour.
Results and Analysis
It was then time to process and analyse the results. Nethunter runs in a chroot environment so I transferred the BRO logs to the sdcard then to my laptop, that’s where adb comes in handy. Lets start with the ports and IPs that were most active during both normal usage of the phone and when it was idle.
1 2 3 4 5 6 7 8 9 10 11
1 2 3 4 5 6 7 8 9 10 11
As expected most traffic is either HTTP (80), HTTPS (443) or DNS (53). NTP traffic (123) also features prominently when the phone is idle.
Of interest is that we can confirm Safaricom uses their own DNS servers, in this case
184.108.40.206. An OpenDNS server
220.127.116.11 was also queried once so they probably have OpenDNS as an option.
The ntp servers were distributed among African countries, Angola -
18.104.22.168, Tunisia -
22.214.171.124, SA -
126.96.36.199 and so on. We can therefore safely say they use the africa.pool.ntp.org pool.
Then comes the interesting bit, there were some Safaricom IPs communicating with the phone on some weird ports, one case is
188.8.131.52, Shodan reveals port
4500 open on whatever is running on that IP. Let’s leave Safaricom for now and look at the other traffic.
The BRO logs are pretty detailed and therefore I needed some way to clean them up to do my own analysis. I therefore wrote a bash script to do some filtering. I then used Shodan-cli to get information of every unique IP and save the output. Here is the script for anyone interested.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
I am going to cut right to the chase as this post is getting too long. The world is being taken over by analytics, advertising and digital content companies! Let me just list a few of the companies that communicated with my phone over that one hour period, remember I left it idle most of that time. Here we go
1 2 3 4 5 6
I usually am not worried about companies using analytics for their marketing purposes but this time something spooked me. Several of these servers are vulnerable to the logjam attack and even more worryingly some are vulnerable to heartbleed. It would therefore not be far-fetched to assume they’ve already been compromised or they will be. With all the traffic going on between my phone and these servers, I had hoped they’d have their security figured out. It’s often said that third parties are some of the most promising targets for hackers and you can see exactly why here.
That was a long post so let’s wrap it up. There were some peculiar IPs that I’ll be investigating in subsequent BRO chronicles. Other random titbits include the discovery that several Instagram servers communicating with my phone are also vulnerable to the logjam attack, Yahoo mail is particularly noisy traffic wise and so on. When going through all that analytics and ad based traffic I remembered a quote by Jeffrey Hammerbacher, one of Facebook’s first 100 employees. I therefore aptly end this post with his quote:
The best minds of my generation are thinking about how to make people click ads. That sucks.