in this series. We're gonna be talking about SQL injections.
I scale injections are vulnerabilities that can
be found in web applications but before
we explain how to discover them and exploit them and what SQL is.
Let's just zoom out very quickly and remember what a website is.
So a website is basically just a web application installed on a server
and a server is simply just a computer.
So right now we have this computer it could be any computer,
it could be a personal computer.
And when we say it's a server it just has certain
applications on it that allow it to act as a server.
Now.
Generally servers on the internet are accessible from any computer on the
internet so they're hosted on the cloud as they call them now.
And basically it has a real I. P.
And then anybody connected to the internet
is able to communicate with this computer
because this computer has a specific application that allow it to act as a server.
We call it a server.
But if you strip everything down it's basically just
a computer with special programs installed on it.
Then we make that computer accessible over the cloud over the internet.
Which makes it very appropriate.
Use as a web server or a server that
can be accessed from other computers or other locations.
A very common application that could make it act as a server is a web server.
What is the web server?
It's basically an application that you can install on any computer.
So the computer doesn't even have to be exposed to the internet.
You can install it on your own local computer even
if it's not connected to the internet is just an application
and what that application does,
it specifies a certain location within your file system
and in that location you can host files.
So anybody connected to the same network as you.
Or if this computer is exposed to the Internet and
anybody that is on the internet will be able to access
the files stored within the web route or the file that
the web server uses to serve files to the users.
Web servers usually also contained the Web application files.
So a web application is similar to any application.
The only difference is is designed to run on a web server
and designed to be served over the internet to another computer.
So the web server can execute Web application
languages similar to PHP python and ruby.
So you would have the web application files stored within the web server.
Because like I said,
the initial goal of the web server is to be able to serve
files to remote computers using a web browser using the http protocol.
The web application files contain code. So the website files could be images.
That could be normal html files so that they don't really contain code.
But the web application files,
they actually contain code written in a programming language that
can process information and manipulate it and do useful tasks.
So it would be written in languages like PHP python, ruby and so on.
And most websites that actually do something useful other than websites.
Just that just simply display information like a shop website.
They would actually be written in a programming language such as these.
Now another very common component of a website is the database.
So the web server contains the files like images, styling files, html files.
These are all just used to display the website to render the website.
And then you have the web application files which is
the ones run on the server site to process data.
But the data is usually stored in a
different application which is called a database.
Now the database contains a number of tables and we have in here a sample of a table.
We're assuming that this table contains products that
are being sold on a shop website.
So you can see, we have the idea of the products, we have the title.
So this is an iphone and ipad a mouse and the price,
we have the price in here for each of these products.
So the web server contains the html pages.
The beautiful pages that you actually see, the ones with.
The it contains the images.
So the images for the iphones, the ipad's the mouse is that this website is selling.
It also contains a web application that interacts with
the database to display all of these products.
So the web application itself doesn't contain the products.
The product information is stored in the database.
Now the database contains the number of tables. This is just one example of a table.
It will contain tables,
for example for the users and it will contain the
user names and passwords and then users when they log again
the Web application with communicate with the database to check
if the user that you're trying to log in with exists
in the database and checks if the user name
you supplied is the same one as the password.
So it's very important to understand the role of the database
Web application stored on the web server.
It just communicates with the database gets information and
then displays it or does something useful with it.
But the data itself is not stored on the
web server is not stored within the Web application.
It's actually stored on the database.
The Web application communicates with the database
using a markup language called SQL.
So whenever you load the products page, for example in a shop website,
for example at the security, if you go to the shop page,
it's going to communicate with our database and it's going to
retrieve all of the products that we have on our store
and it does that using a language called SQL
If the web application itself is vulnerable as a hacker,
you're going to be able to inject your
own SQL statements and retrieve data from the database
that you're not supposed to see. So you're supposed to see the products.
That's fine because the shop website shows it
to you but you're not supposed to see the
data and the users table for example because
that will expose the users the other emails,
their phone numbers and possibly their passwords.
But if you're able to inject your own SQL queries,
you'll be able to manipulate this web application and
communicate with the database and access the users table,
possibly read the admin and log into the website as the administrator.
And then you'll be able to do whatever that the admin can do on the website.
But anyway usually when you're at that stage when
you're able to inject whatever SQL statement you want,
you don't even need to log in as admin in
many cases because you already have access to the database.
And the database usually contains all the information you need.
It contains all the users,
it contains all of their data and it contains all
of the data that is stored on that website.
Whatever you need from that website, it's usually stored in the database.
It's not really stored in the web server.
And even if it is stored on the web server you'll be able to log
in as admin and then access the web server and the files on it.
In many cases you'll be able to execute code,
you'll be able to upload your own files and again upload the shell and gain access.
You can do so much with SQL injections and we'll see that as we go through the series.