who? Everybody. And welcome to the exact number 19 off the icy speakers. SQL injection.
My name is Sandra Gina and I'll be instructor for today's session.
The learning objectivity of this session is to understand the concepts behind the SQL injection attack and apply the techniques to implement this thing this attack.
So let's get down to business. Shall we
let me first give you some background about about this attack? You know, an SQL injection attack? Insist off. You know, actually, in certain or injecting es que es que ele quer ese
beyond any input in the client application or deserve real application itself. Ah, successful SQL injection exploits can read data. You know, sensitive data from the database modified the database or even execute operations on the database.
You can't even get to the point to actually execute commands on the upper the system. The database is running Well, see? Died later in this video, we also have you know, this attack You know the plane SQL injection, attack
infers or suppose that you already know the database. I mean, you know that the
maybe that the table name or did that of his name or you know
any name Mary Debut Ning. But you know, most of the time this is not true. Most of the time
trying to guess what it's behind is that of a So, uh, there's another attack which is blind SQL injection. And this is basically asking the database true or false questions to see the answer. And, you know, maybe
in for some information from that from from the answer we get back from the database
this attack is often used when the way application is configured to show generic error messages. Because in some applications, when you actually trying to see if if the application is actually vulnerable to SQL.
If the error module was not properly created or, you know, properly handled,
you can actually see some information about the database. For example, saying the data vase with name love a lot doesn't exist or the table name you're trying to access is I don't know, whatever these error messages can actually give you. Some,
you know, indicators about that of its information, but another in other cases, this is not true. In other cases, did you see Jerry ever messages saying that
e I know that this could not be access it or, you know, just the work ever, and that's it. So when an attacker exploited the SQL injections, sometimes the way application displays
these are generic errors, said you have you just have to go to, you know, asking true or false questions to see if
you know you get information or to see how many tables there are or how many feels are included in a specific table. Or, you know, that's that's point, um,
you know, other than that blind SQL injection and you know, playing or normal SQL injections are nearly the same again. The only difference is that how did that have the data retrieved from database again playing SQL injection? You just
no. How did the table name or did that of his name? Or,
you know, do you have information about the database but mean blind skill injections? You go and ask true or false questions, see what's replied, or to see what's the behavior. And, you know, trying thio
get as much information as possible with these questions. But that's it.
That's the only I mean, that's the main difference between these two types of attacks. But in general, the point is, you're will be
basically stopping the query or the normal functionality of the query. Maybe the worry was just to ah
get ah ah, Logan or get some information from the table. So just could cut that maybe in the middle and performed your own query or change the behavior of the query itself.
will be I will be showing you how to do that. Remember that in the previous video we saw SQL injecting. I'm sorry. Cross site scripting. Ah, what we have Or Windows here. Which again, if you go to the welcome page, it launched the message Precise script in and it downloads that them
the executed will file.
Remember that, Um, but we'll be using that for for for for this
exercise, eh? So we don't have any any way we can ill again, remember? Because we didn't have,
um, let me just Oppen it here in our local web browser.
the cookie, but became, you know, actually Ah, Le Guin Here in applied, you know, a different cookie. Ah, and actually
go to the Logan weapon. It shall way.
Let me just I would just tied the buzzword to discuss. Well, Ray, now, arguments just give you this example and guess you forgot about it
now, biggie. Because we already have the query executed. I'm sorry. The Christian scripting executing, and it's it's already sending us cookies back to us. So we just need to wait for a cookie to send to go back to us.
If you there remember, I, you know,
encouraged you to go back to the cross. I scripting
BDO and see how well we actually
got to this point. I mean, how can we actually retrieve Ah, cookie. Ah, Bali. Kiki from from the server and actually bypass this look in
a web page that we have right now.
Let me see. I I I I have a cookie. Okay, we got a cookie right now, so we just go here
and we just get your cookie manager for the current page. We're D days
cuppa tea. Bali. Kiki, we close this out and
okay. Yeah, I know that.
Go home. We go to London and we're already in. So, uh, here we have, you know, our normal regulation to the weapons and we have delete Ended it. But you guys go to a dit. I can see this. And I can see there's
the weapon. A I mean, the u R l has
input variable here so I can just to see fact something's actually vulnerable to Chris. I scripting attack.
You can just tie palm.
You can see some information and you can actually see Let me just stop this. It's not fair with server anymore
s Oh, yeah, you can see that actually, putting this, which will cut their common the common behavior of the quarry it actually show us on exception so we can be is interested in the exception. I mean, maybe cities, Or maybe I know that
this is the page or whatever.
We can actually see that way. We can also know that from this point forward,
this is actually vulnerable to escalate injection. So we already found on SQL injection. Um,
for example I know Need thio I timeline. I know we're acquiring a table here, obviously. Ah, but I need to know how many columns are in the table being used you know about this query. So I just go and put that like something like this,
um, order by one and then ignored the rest of the query.
And I didn't get any mess and any ever message. So I go, you know, incremental my one to see how many. Um,
Okay. Now, remember, ever message so far to see how many fields are in this table, so
Oh, Okay. Um, warning, you know, a message. So therefore feels or four registries in this unstable. So now that I know that I can use, like, I don't know, maybe some unis elect to get info on each field. For example, I can yes.
and gets put something like union. Oh, sorry.
one going to come a tree come before
and he didn't fail. So I know need to know which feel uses, you know,
is displaying this message, Miss what would feel it is played in the title bucks and which feel is play in attacks box. So for di, I can use comments like Burson, for example like Kingo here version instead of feel one.
Nothing changed. So obviously feel number one is not being used for that.
Okay, nothing changed here.
So I can, you know, just
changed peace again.
And but here feel number. Tree
Oh, nothing's changing. Let me just try it with you, sir.
Nothing's actually changing unless I'm missing something.
Oh, it's not changing. You guys. Sorry about that. It's not changing because I'm already using a table that actually contains information. So if I go here and put number tree just, you know, we're all ready now that this is not something that I'm just cutting. Cut these in here
and just to save it. Number 10
number one. He goes to this to the welcome. Number two goes to the test
and number. Tree obviously will not got to nothing at the end. It doesn't contain any feel.
Okay. There you go. Feels number. Field number two. And you, sir, just root at local host.
Okay. The version of the database and the user that is being used to execute the database. Instance. So yeah, we can retrieve information.
You can even use something light load file
in the use of things at the end. The user feel hats has more space, so we can just use something like
Like the instruction load
And they just just ah,
for example, for the password.
Hope that's how did you write it?
01 exception. What happened?
Oh, I didn't. But I'm sorry about that. You guys
and you, you can actually get the information from the operating system so you can see how harmful this could. Because at the end, he can dump maybe a buzzword file. Or maybe if the permissions are not properly established, you can actually dump sshh keys or, you know, certificates or whatever.
Uh, you can actually perform a lot of malicious stuff. You can. You basically have,
um, some, like, skinning the cat command or something like that in the operating system through me be Ah, an SQL injection. You guys. I mean, I'm not
ah saying any reversal here, but you can actually do that.
now that we know that we actually did this manually, we can actually use tools for that. Ah, what was the cookie? Okay, this is just this one.
at the end is about the cookie. We'll use this cookie and just
use the SQL map too.
So then you just got the basic man and explaining to you
we just made a mind This
so excuse, Ma. I'm telling the u R l to go to which at the end is you know,
uh, nothing here to actually show
you go to this euro. That's what I'm telling right now in the euro section because I already know this is worthy. SQL injection was happening. So
and then we tell. Okay, use the cookie because there will be Allah again if I If I don't tell that let me just, um,
execute this. And, you know,
it gave me some information and told me that actually available is actually, um,
vulnerable to this, you know?
And it's telling me some information, you know,
that I will be interested in and like, the SQL. My sq I know is my sq I'm some other generic information about this. Uh,
but what will happen if I raise the cookie? It We will tell me that that look in I mean, it's asking for logging or something like that.
uh, okay. Reject to fill a game. Paige, do you want to follow? If I tell him? Yes.
Well, I said already have Bali cookie, but, you know, that's the point. We're just passing the cookie as we do, but, you know, whatever. Think. And we actually perform here, we can actually say dump.
And you will dump the information of database.
You know, and we'll see more information. And that's the thing. I ve wants to stored ashes to a temporary file for eventually for your persistent the tools. Now, I don't want to. Do you want to crack them be a dictionary? Base attacks? That's amazing. Yeah, I wonder.
Okay, so it cracked some passwords and some, you know, documents.
And that's the point. I mean, um,
cookies like this. You can actually get some information
from from that with a single command you can actually get. This depends. Um,
always dash shell. This depends on the permissions. You, uh, the database is running on the operator systems. Some, uh,
database I running with road permissions or administrator permissions. So you can easily get a shell because you will. At the end, you will You will be uploaded. And remember that we saw a Ph. B. River Shal. You will be allowed in a PHP to to the directory that I was running to.
So if that doesn't have permission to write tonight
toe that directory or to create service's most likely you will not get a Rochelle or oh, is shell. But, you know, we can try.
I know his speech piece. I just out with number four in here.
And yeah, it looks like the file was not has not been written. Usually occurs for the death of this process. Has no right privileges of permissions on the destination, but yeah, that's kind of expected, but you can see that s fuel injection. It's a real thing. And we can You can actually, uh,
you know, see how are harmful. This could be. And you can dump passwords. You conduct the database itself. Geeking, Actually, you know, thinking for the other things that we are really watching. What? We ride to the previews, um,
s previous video, But But you get the point. You can get Basel words you can get. Okay, We'll have here, for example. I mean password. Ah, and we already know spas work, so let's just try it out.
if I look out from here, I go to admin, and I just put at men
the carpet's bottler, India.
I already have that buzz word. So
as you can see, this could be really harmful to to anyone actually being victims of this attack.
Post assistant questions. What is the difference between SQL injection and Blind SQL injection? Or they're almost the same, but with blind school injections? You will be asking true or false questions to the server to see what's the behavior in, you know, inferring information from that answer. But that's it.
And we actually gained remote control to this attack. Yeah, we can actually can if that there's a Miss configuration allowing the database to write files to specific location or two. Uh uh, have root or administrator privileges. You can definitely get a reverse shell from from that
from using, for example, at the SQL map tool or any other tools.
Perform this SQL injection attacks
in this video will learn the concepts behind the SQL injection attack and we implemented something makes to execute this attack, and we also saw how maliciously set that can be
supplements materials again, wth this entire module. There's no other way to go, huh?
Another, You know, with all their supplements, materials, other that the hacker playbook. I think this is an amazing book. You should definitely rated it will contain this and more information. I mean about other attacks. And, you know, again every possible source you confined in Google and YouTube there's there's no
grown or good way to go here, you guys,
and looking forward in the next video, we'll cover. Ah, local filing, collusion and remote flight file inclusion.
Well, that's it for today, folks, I hope in your video and talk to you soon.