How I Found My First Website Vulnerability as a Web Pentester
A university academic registration site reflected a basic SQL injection error on its login page and allowed a login bypass by entering a space character in the email and password fields. The registration form also stored an XSS payload in the address field, which executed an alert showing cookie data when the page was reloaded.
Published on medium.com
Hello, folks! This story is about my first experience I found vulnerabilities in a real website.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the login query and the registration form both handled user input without proper validation or output encoding, letting special characters change the query and letting markup be stored and rendered as HTML.
Impact
An attacker could log in without valid credentials and could store a script that runs in other users' browsers and reads their cookies, though the author does not show what a real attacker could do with the stolen session.
What the attacker needed
Access to the public login page; access to the registration form; victim views the stored page
How it was found
- Open the login page and submit a basic SQL injection string to see whether the site uses an SQL database.
- Try further manual SQL injection strings and an automated tool, which the firewall blocked.
- Enter a space character in both the email and password fields and get logged in.
- Put a script payload in the address field of the registration form, which has no length limit.
- Unfocus the input and reload the page.
- See the alert with cookie information and inspect the page source to confirm the payload became an HTML element.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
The login form passed whatever was typed straight into a database query, so odd characters caused errors and a strange input let the author in without valid credentials. The registration form saved text without cleaning it, so a script typed into a field ran in the browser of anyone who later viewed the page. That kind of stored script is called cross-site scripting, and it can be used to read a visitor's session cookie.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.