I wrote this script just to demonstrate that how some one with a fair knowledge of web-development can exploits weak passwords. I chose our college captive portal for experiment but same principle can be applied to any website which are vulnerable to attack. This is just for education purpose and I do not intend to steal any information.
A dictionary attack is based on trying all the strings in a pre-arranged listing, typically derived from a list of words such as in a dictionary. In this demo, I am going to use a text file passwords_jhon.txt (see the file above) containing approx 3000 common passwords. Dictionary attacks often succeed because many people have a tendency to choose short passwords that are ordinary words or common passwords, or simple variants obtained, for example, by appending a digit or punctuation character.
Students of NIT Kurukshetra are too lazy to choose a strong password for captive portal 😛 Also cyberoam does not block multiple login requests from same ip-address within a short span of time.
- To execute this script you must have nodejs installed.
- Download zip file (or make git clone) and extract to hard disk
- Open terminal/cmd
- Move to script directory (where you extracted zip file) using
cd /path/to/repository
- Run
npm install
to install all nodejs dependencies - Once all the dependencies has been installed type
node main.js 1130328 passwords_jhon.txt
- Replace 1130328 with any valid Roll no on which you want to perform attack (see screenshots)
- Sit back and enjoy coffee. If victim's password is weak, it will be cracked and saved to cracked.txt file.
- You can see progress on your screen (see screenshots- it will take some minutes).
- How to exceute-
- Progress-
- Password successfully guessed-
- 1130328 password in password file-
- Saved password in file-
This script tries all passwords from passwords_jhon.txt one by one for supplied username and simulate login to Captive portal i.e. make HTTP Post requests. To make http post requests you need an URL and Form data. To check URL and Form data made during post requests i.e. when you signin to portal, perform following steps-
- Visit http://172.16.0.1:8090/ (User portal)
- Choose inspect from right click or press Ctrl + Shift + I
- Select Network tab from opened window
- Now perform login using your roll no and password and check network tab
- You will see an http request made by your browser. Click on login.xml and check Headers
- You will see url to be http://172.16.0.1:8090/login.xml -
- scroll a little bit and check Form data.
- You will see different parameters and their values.
- 'mode' 191 is for login (193 for logout) and parameter 'a' is timestamp
- Using this url and form parameters, this script make http post request (as if an user is trying to login)
- Once you have successfully logged in, Check the preview section
- Browser receives an XML response on successful login.
- Script validate against this response to decide if attack was successful.
You can use different and customized password files (of different lengths) to have successful attack. This script make each request per 100 milliseconds. You can decrease it for a faster execution. Initially I had used 60 ms but I was getting random Time-out error so I chose 100ms. For more details see source code of main.js file. Reference: I downloaded password file from this repo- https://github.com/danielmiessler/SecLists/tree/master/Passwords