sequel injection authentication, bypass practical scenario are learning objective is one understand how to bypass authentication with a sequel injection
so your mind might be spinning right now if you're not used to looking at sequel injections and you just saw that demo and you might be like Clint, How did you even figure that out?
A lot of Googling? I'm not a master at sequel or my sequel database and a database administrator.
It just took a lot of research which is the basis of Oh SCP right is enumeration is figuring this stuff out is googling it.
So let's take a step back. You know I think we have a process down here and it all starts with scanning, right?
we find a web server that we can go to with our browser.
Um We identify the possible version of the software, we use Apple Isar. Um We can enumerate things with cookies so remember to keep enumerating and figuring out what the underlying technology is
and then we try to find vulnerabilities for that software.
So that application that we did in the last block is a custom application, there's no C D E that I know for it.
But like I told you, I like to make labs. So in this case I downloaded some vulnerable software. Well I already know what the vulnerability is because I downloaded it. But for the sake of this example, let's say you come across this website. Free student management system. Free sms version 2.1 point two
free smS. We could curl this because you know, it's a nice pretty web web page. If we curled up we got we get more of the source
Of the page. Um but we can either Google for that exact now my Google's going off, we can google for that exact um you know, free sms student management system, version 2.1.2.
Or we can use exploit DB or search flight.
So if we use search exploit, I'm using searchlight here. I'm using free sms 2.1.2. And as we can see it's there's a sequel injection authentication bypass.
So you can see here I use the tack em option. It just copies it to the desktop because that's the directory I'm in.
So it will copy that python script to the desktop. Now we should always read what the script does. Right? So we wouldn't understand what it does. That's also very important for Oh SCP. We can see the password parameter has a bullying based blind sequel injection vulnerability. Right?
I I would encourage you to read the whole thing and it will tell you exactly what it does. So well the XY will create a new password for a known user.
If I don't know who the user is then it's not gonna work.
So I'm gonna guess I'm going to guess that there's an advent.
Um and in fact I think there is an admin by default in this database.
So I run the script. I do username admin,
I have a used password for password and it says authentication bypass was successful. Try trying to change the password and you can see that a new password was created for password
and using that I was able to successfully log in
as the admin with the pastor that I created
from that python script.
What happens if the script fails? This may happen to you. You might find a vulnerability on test day
and you find a really nifty script for it
and you realize that doesn't work. Well that's why it's important to understand what the script does.
So because I know that it's a form and that there are various bypasses. Can I manually bypass it without having to use the script?
So I did, I used this admin
double quote or one, you know another or statement or one equals one
I bypassed the login in the user name field
So here's a great sheet sheet for uh for authentication bypass, it gives you a whole bunch of them, you can make your own script, you can use burp suite like I showed you you can use intruder with sniper
enter that into these forms
or some of the other payloads I showed you as well. Not just sniper.
just in general for sequel injections, test everything that could be vulnerable parameters, fields, forms, logins,
like I told you enumeration is the key. What is the technology? What is the service? What is the you know, just take a look, take a look at that. We saw was SMS in the version and we and we found the vulnerability right there
are single quote is the main attack vector. If it's going to be an error based or in in band uh sequel injection vulnerability then we will see a verbose output saying there's an error, a sequel error
blinder obviously harder to find.
Also something of note is you saw or and and statements that I use. There are there are alternatives to that and and can be an alternative for and
and double pipe can be an alternative for or so keep that in mind because add that to your tool belt, add that to your fuzzing payload list as well, not just in an or statements.
So in summary uh we should now understand how to bypass authentication with a sequel injection.