Monday 23 December 2013

Access point + beef server + amazon cloud

I wanted to explore the idea of getting devices to automatically connect to my access point. Once connected, they are able to browse as normal, but certain sites trigger a redirect to my apache page. I thought initially to set up a web portal for this purpose, and have everyone redirected to this page before being able to access the internet. At this point I could hook browsers. I ended up doing it a different way and use dnsmasq to redirect specific sites.

So what happens is a user types in a certain address, and dnsmasq redirects them to my apache server. I have it wait for 20 seconds until I hook the browser, then they get redirected to another fake page hosted on the cloud. ( JUST TO NOTE THIS WAS ALL DONE FOR RESEARCH PURPOSES ON MY OWN NETWORK).



Heres the access point script I set up. Note the airbase-ng -P option which basically makes it respond to all probes from devices. The -y means it won't respond to broadcast probes so as to limit its work load. The -C20 relates to how long the probes are sent out. For instance a device sends out a probe for homeWifi. My access point will see this and send out probes saying 'thats me :)' for 20 seconds.

Beef server comes with an option to autostart certain modules. This can be achieved by editing the modules and adding in 'autostart: true' to the config.yaml file. Not all modules work so you can experiment to see which ones do start.

Once the access point and beef is up and running you can try to see if users are being hooked. You have to edit your dnsmasq.conf file to add in the websites you want to spoof. I actually made a separate dnsmasq.hosts file where I add in my pages.
An easy way to get a copy of a page from the web is to use for instance: wget http://www.facebook.com -O test2.htm.
This is what I hosted on my apache server and added in a beef hook to get browsers on my beef server. I also autostarted an invisible iframe to try and keep the browser hooked.. I have the apache page stall for 20 seconds before redirecting the user to my server on the cloud.

Its been fun to mess around with beef server, and have different modules autostart. I'd like to expand on this and look into the metasploit modules that can be integrated into beef. Particularly focusing on getting a meterpreter session on a mobile device. Using my phone as a client I have managed this by directing the iframe to a reverse_tcp payload. It seems once the session is opened, any subsequent commands are not recognized in the meterpreter session. Unknown command shows up. I have to try and fix this.