LogoCaptive Portal Pentest
Personal9/2019 - 1/2020

Summary
This is a blog post about my experience pentesting a captive portal at my college. I wanted to access the internet without any restrictions, so I decided to pentest the captive portal. I wrote a simple Python script to brute force the passwords of hundreds of students in a few minutes. I informed the college authorities about the vulnerability, and they were very grateful. This experience taught me a lot about cybersecurity and how important it is to report vulnerabilities to the right people.Scenaio

I was studying in my first year at GIET, University. It was a secluded place with no internet connectivity. The only way to access the internet was through the college's captive portal. The captive portal was a web page that required the user to log in with their credentials to access the internet. The captive portal was a simple web page with a username and password field.

The username was the student's roll number, and the password was a random set of 4 digit. The password was generated by the college's server and was unique for each student. The students were free to change their password anytime they wanted, however, since this had to be done through the college's server room, many students didn't bother to change it.

My motivation behind the pentest

The provided data was 1GB per day, which would often get exhausted by the evening. It was not enough for students like me who wanted to learn more, watch tutorials, and do research. I wanted to access the internet without any restrictions.

I had a few great professors who would often share their passwords with me, but I didn't want to rely on them. As they often had their own work to do and I didn't want to bother them, also they shared their password with many students, and having only one session at a time, I would often get disconnected.

Pentesting the captive portal

I started by analyzing the captive portal's web page. I saw that the web page was a simple HTML form with a username and password field. The form was submitted to the server using the POST method.

I had never written a web application or script before, so I started learning about how I could automate the login process. I learned about Python and how I could use the requests library to send HTTP requests to the server.

Since I had always been interested in learning cybersecurity, I understood that the password was small enough to brute force, but I did not know how to write a script to do that. I had always been a script kiddie, using existing tools to hack into systems. I tried a few tools, like Hydra, but I couldn't customize them to work with the captive portal.

Finally, I decided to write my own script. I started by writing a simple Python script that would send a POST request to the server with the username and password. I used the requests library to send the request and then simply parsed the response to check if the login was successful. There was a specific error message that was displayed when the login was unsuccessful, so I used that to check if the login was successful or not. The script was very simple, it would simply accept a roll number and would try all possible 4 digit passwords.

Conclusion

I ran the script and it worked! I was able to easily brute force passwords of hundreds of students in a few minutes. I showed this to my professor, and he was impressed. He told me that I had a bright future in cybersecurity and that I should continue learning.

I informed the college authorities about the vulnerability in their captive portal. They were very grateful and thanked me for bringing this to their attention.