SQL INJECTION lAB/ SQL LEARNING

Hi Friends, today I am going to blog about SQL injections and how to make your own lab for free, that way you can practice.

First; What is SQL? SQL is basically the language used to work with Databases. if you type in google sql learning you are going to get quite few links. I like w3schools, why I like w3schools? pretty simple, their code has been tested and works. Here is a link to W3 Schools: https://www.w3schools.com/sql/ , Here is another link that you can use to learn SQL. codeacademy there is another one, Tutorials point, if you are a video person here is video one: at this point in the game if you want to learn something you might as well pick your OS, some databases like SQL Server the ones belonging to Windows you are going to need windows. any way. Sql Shack is another good resource: just click it to take you there. The way to learn atleast for me is by doing and installing software into your computer. Every time that I see something new I want to install it in my computer. Some institutions baby sit you and give you this stuff already but in reality you need to install this stuff just so you can learn what drivers are compatible with the database and what makes it work.

I would recommend if you are in the security side of the house or even the development side of the house installing XAMPP. XAMPP is a cross-platform web server that is free and open-source. XAMPP is a short form for Cross-Platform, Apache, MySQL, PHP, and Perl. XAMPP is a popular cross-platform web server that allows programmers to write and test their code on a local webserver. It was created by Apache Friends, and the public can revise or modify its native source code.

Here is a link on video on how to install XAMPP. if you have something other than Windows the only thing that you have to do is Google how to install it.

Why XAMPP, well! Why not! in order to stop some attackers from SQL injections you might want to know how the back end of the application, specially forms work. With XAMPP you can at least you can develop your own script and log in to the database. in this link there is an example script with PHP to log in to the database.

if you have any errors connecting to a database just google something like sql databases connecting errors, or just the error itself. here is another example to connect to the DB with mySQL from w3 Schools.

Any way I like PHP just because of the fact that it is on most web servers, 🙂 Don’t fall into the trap of languages because if you fall into the trap then you are going to make a barrier in your progress for knowledge.

Once you have a script to log into the database with that certain script I would make an input box, what you are going to learn is that everything comes from the html form whether it is a post or get method the fields that go in the form need to match by name the same exact fields in the database. To learn this concept you can google CRUD operations with PHP. CRUD means create, read, update and delete. I like clever techie and I also like Danny Cross, Here is a tutorial how to create a Login system by him.

To understand this you have to separate your mind and think like a developer, once you know how the back end works when it comes to the fields on the html form with either the post or get method then things will make more sense.

To learn about SQL injections I would collect resources first about them for example here is W3schools quick one , Here is guru99 , here is edureka, Here is hacksplaining, here is w3resource, Here is tutorials point, portswigger academy, The thing is that you have to put in the work. my favorite command once I am connected with a system that has a database is basically I tell the computer show me all the databases. Depending on the SQL syntax or which version of SQL you are dealing with a simple search on the internet will give you that result. if you are using mysql just type

SHOW DATABASES;

Here is another example linked:

if you are using sql server you might want to read this:

if you want to play around even more and just move to that database that you want, not that hard you can always type use database name.

USE DATABASE name_of_data_base;

Any way some of the basic things to know when dealing with a database are the following.

Basic Things to Know

1.) create a user

a.) CREATE USER ‘testuser’@’localhost’ IDENTIFIED BY ‘PASSWORD123’;

2.) VIEW all users

a.) Select USER, HOST FROM mysql.user;

3.) PERMISSIONS

  • ALL
  • CREATE
  • DELETE
  • DROP
  • EXECUTE
  • GRANT OPTION
  • INSERT
  • SELECT
  • SHOW DATABASES
  • UPDATE

One of my favorite SQL queries is select table_name FROM all_tables; HAHA! This will actually work on SQL server. This is another one and here is the reference: https://docs.microsoft.com/en-us/sql/relational-databases/system-catalog-views/sys-tables-transact-sql?view=sql-server-ver15

SELECT SCHEMA_NAME(schema_id) AS schema_name
,name AS table_name
FROM sys.tables
WHERE OBJECTPROPERTY(object_id,’TableHasPrimaryKey’) = 0
ORDER BY schema_name, table_name;
GO

Any way Here is a link with a whole bunch of payloads: https://github.com/payloadbox/sql-injection-payload-list

I just use my Google dorks skills to find information. If you can run xamp and make your own database you will be able to practice all this stuff. If you can’t learn how to install this stuff, my advice would be to keep trying. different databases and different systems are going to have their own drivers. I love Java, C#, Python but in reality my favorite is PHP. within the next few months I am going to kind of switch to improve my bash scripting skills, right now they are not the strongest but I can defend my self.

Any Way this is all for now, I hope all the links there help someone.

Very Respectfully,

Santi

3 thoughts on “SQL INJECTION lAB/ SQL LEARNING

  1. Heya are using WordPress for your site platform? I’m new to the blog world but I’m trying to get started and set up my own. Do you require any html coding knowledge to make your own blog? Any help would be really appreciated!

  2. Hey there! I just would like to give you a big thumbs up for your excellent info you have right here on this post. I will be coming back to your website for more soon.

  3. Thanks , I’ve recently been looking for information about this subject for a long time and yours is the best I have found out till now. But, what concerning the conclusion? Are you certain about the source?

Comments are closed.