ATTACKING JWT’S WITH A CUSTOM SQLMAP TAMPER SCRIPT
I know the challenge is a website so open up the IP:Port address in a browser. It forwards to
I’m given a simple login screen (user and password) with two buttons, “Login” and “Register”. First, lets see how it is supposed to work and then move to seeing how to find the holes.
Register a User
I enter in some values and click Register. It forwards to the URL:
There is a message on the screen saying “Registered successfully”.
Log in the new user
Re-enter the user and password and click Login. It forwards me to the URL:
A logged in user is given a blank site with a “Message from the developers”. Nothing else is on the page, other than a Logout button. I noticed that the Message is addressed directly to the username that I registered.
Test some false entries
This is standard QA stuff. When you’re developing a product or website, any feature added to the product gets a series of tests that are run to validate that they work as expected. There are a few combinations of data I can try to see how the site will handle input.
- correct username, empty password
- correct username, wrong password
- random username, empty password
- random username, random string for the password
- re-register a user.
- REALLY long username or password
- quote marks (‘). We’ll get to the reason for this in a bit.
These give out some standard responses as you’d expect. Like the Registered User message, they redirect to URL’s like:
What I have already learned
I know the site is vulnerable to something, so where is it? Maybe I’m supposed to log into the site as an existing admin type user. Here’s what I’m thinking at this point. There are already some things that jump out to me as red flags:
- The only data input are username/password fields. The hole in the wall could be in the fields accepting something it shouldn’t.
- Notice that the message displayed on the page for “Registered successfully”, “Invalid username” and others comes from the URL. If that’s the case, It looks like I can get the website to say anything I want:
4. After a successful registration, the URL had another parameter:
&type=success. Does the website code use this to validate a user? Can I trick the site into thinking that something worked, when it didn’t? Load the URL:
This time the message on the screen does not have a red background. It looks like the
type variable only changes the colour of the background–kind of like the type of message.
typedeclared is like the default giving the message a red background. This won’t be very helpful.
This was just surface test of the site. In the next post, I’ll dig deeper into the code and use various tools to look for vulnerabilities.