-
Notifications
You must be signed in to change notification settings - Fork 2
Lab 06 Injection
In a previous lab, we noticed that the username/password verification subsystem appears to be vulnerable to SQL injection. Now, we're going to try using some basic SQL injection to see if we can exploit the vulnerability.
- Go to the login form.
- Enter
' or 1=1;--as the email and any password. - Login.
- Check if the system treats you as a logged in user, e.g. by going to the administration view.
- What happened on the back-end during this scenario?
- What do you think the SQL code looked like that got executed?
In this lab, we're going to try logging in as a specific user (Jim). First, you need to get Jims user name. Fortunately, the Juice Shop lists all registered users in the administration view. For a different application, you could try finding Jim on LinkedIn and then guessing Jims email address based on his current employer. You could also use some sort of social engineering to get hold of his user name.
For this lab, we're going to use the administration view though.
- Login as any user. Create a new user if you need to.
- Go to the administration view. Note Jims email address there.
- Log out.
- Go to the login form.
- Enter Jims email address followed by
';--as the email and any password. - Check if the system treats you as a logged in user, e.g. by going to the administration view.
- What do you think the SQL code looked like that got executed?
- Login as any user. Create a new user if you need to.
- Open the network tab of your developer tools in your browser.
- Search for
';--in the Juice Shop. - Notice that the developer tools shows a failed request.
- Click the request in the developer tools to inspect it.
Depending on which browser/version you're using, you might need to expand the response to view all of it.
- Notice how the response contains the SQL statement being used (and where your search input was inserted).
- Use this information to craft a new search string that short-circuits the "DeletedAt" filter in the SQL.
- Add the "Christmas Super-Surprise-Box (2014 Edition)" to your basket.
- Checkout.
- What is the risk to the Juice Shop during this scenario?
- What is the risk to a general Web app for this type of scenario?