Capture!
Can you bypass the login form?
Recon
Let's start with a nmap scan.
It reveals just the port 80 running a http server.
Upon visiting the site we are greeted with a login page.


The error message "Error: The user ‘rachel’ does not exist" allows us to enumerate valid usernames within the application, which violates the OWASP Authentication Guidelines.
The first step is to enumerate the usernames. Once we identify a valid username, we can proceed to brute force the corresponding password.
Capturing Existing Users
Currently, we have identified two error messages to handle: If we receive a captcha but fail to solve it, we encounter the error "Error: Invalid captcha". Alternatively, entering an incorrect username with the correct captcha results in the error message "Error: The user ‘USERNAME’ does not exist."
We need to include the variables username, password, and captcha in an HTTP POST request.
To extract the error messages and captcha, regex can be used. Crafting regex patterns can be challenging, but tools like regex101 make it easier:
Regex for retrieving captchas: [0-9]{1,3}\s[+-*:/]\s[0-9]{1,3}
Regex for retrieving error messages non existing user: The user '.*' does not exist.
But we need to URL encode it.
Running our script takes a second and we get the user natalie.
Capturing the Right Password
Let's begin by submitting the username "natalie" with a valid captcha to observe and capture the error message related to an invalid password. This will help us craft a suitable regex pattern to detect this specific error.
For finding the correct password, we can reuse our previous loop with slight modifications.

We can login with the credentials and check the flag.

Last updated
Was this helpful?