Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Sqli-labs building

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

We agreed to start from scratch, so let's start with the most basic sql injection.

# # An introduction to SQL injection

What is SQL injection?

SQL Injection: by inserting the SQL command into the Web form to submit or enter the query string of the domain name or page request, the server is eventually deceived into executing malicious SQL commands.

In fact, I think that as long as the statement is not executed according to the intention of the website designer, it can be regarded as an injection statement, regardless of whether the information is stolen or not.

What cause SQL injection?

1. String concatenation is used in the development to combine SQL instructions, etc, which will be understood when you swipe sqlilabs later.

two。 Use an overly privileged account when linking to a database (for example, many developers prefer to connect to the database with the most privileged system administrator account, such as the common root,sa, etc.).

3. Unnecessary but over-powerful functions are opened in the database (such as xp_cmdshell extended stored programs or OLE Automation stored programs in Microsoft SQL Server database)

4. Too much trust in the data entered by the user, no limit on the number of characters entered, and no check of potential instructions for the data entered by the user.

What will SQL ingjection cause?

1. Leakage of data in data sheets, such as personal confidential data, account data, passwords, etc.

two。 The data structure is explored and can be taken further (for example, SELECT * FROM sys.tables).

3. The database server has been tampered with and the system administrator account has been tampered with (e.g. ALTER LOGIN sa WITH PASSWORD='xxxxxx'). In fact, once the database server is used, considering that we can get the information in the database from the aspect of sql injection, on the other hand, we can get a server, and we can find more intranet facilities through the configuration of the server, and * * go to the intranet.

4. After obtaining higher privileges of the system, it is possible to add malicious links, malicious code and XSS to the web page.

Operating system support provided by the database server allows * * to modify or control the operating system (e.g. xp_cmdshellnet stop iisadmin can stop the server's IIS service), destroy hard disk data, and paralyze the whole system (e.g. xp_cmdshell FORMAT C:)

Some relevant information collected before

Http://blog.csdn.net/u012763794/article/category/6210965

Sqli-labs environment building

Injection of MySQL into Tianshu (highly recommended)

Video (video of an Indian uncle on youtube)

OK, three what should be able to roughly explain what SQL injection is, and then let's do an experiment in an environment.

# # Environment used

-vmware virtual machine

-download the kali-linux-2017.3-vm-amd64 address and unzip it, then open it in vmware. User root, password is toor.

# Open apache service

Sudo service apache2 start

Verify:

Visit http://127.0.0.1 and display the page, which means that apache starts successfully.

# Mysql configuration

Sudo service mysql start

The mysql-uroot-p password is empty. If you can link to mysql, you will ok.

Here we'd better set a password, which is easy to use later.

SET PASSWORD FOR 'root'@'localhost' = PASSWORD (' new password')

# install sqli-labs

Cd / var/www/htmlgit clone [https://github.com/Audi-1/sqli-labs.git](https://github.com/Audi-1/sqli-labs.git) sqli-labs

Next,

Cd sql-connections/vi db-creds.inc

Under vim, use the I key to switch the write mode, press esc to switch to the command mode after writing, and type: wq to save

You can see the platform page by visiting http://127.0.0.1/sqli-labs/, at this time.

Click setup db to create the database as well as tables and data, and the learning process follows.

Enjoy your tour!

However, there is a slight problem with the new version of kali linux. Please see other blog posts to solve the problem. If you don't want to keep messing around with children's shoes, you can download phpstudy directly and use the php5.0 version.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 222

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report