J-FORCE: FORCED EXECUTION ON JAVASCRIPT
Kyungtae Kim1, I Luk Kim1, Chung-Hwan Kim1, Yonghwi Kwon1, Yunhui Zheng2, Xiangyu Zhang1, Dongyan Xu1
1Department of Computer Science, Purdue University 2IBM T.J. Watson Research Center, USA
J-FORCE : FORCED EXECUTION ON JAVASCRIPT Kyungtae Kim 1 , I Luk Kim - - PowerPoint PPT Presentation
J-FORCE : FORCED EXECUTION ON JAVASCRIPT Kyungtae Kim 1 , I Luk Kim 1 , Chung-Hwan Kim 1 , Yonghwi Kwon 1 , Yunhui Zheng 2 , Xiangyu Zhang 1 , Dongyan Xu 1 1 Department of Computer Science, Purdue University 2 IBM T.J. Watson Research Center, USA
1Department of Computer Science, Purdue University 2IBM T.J. Watson Research Center, USA
User
Exploited Exploited
2
Malicious Server
Phishing email SEO attack Advertising Social network
<html> … <script src=…> … </html>
http://mshops.com/shop.html
function FC3d(DzV, lm8H2) { for(HPFY=0;DVz.length>HPFY;HPF Y+=8)...d5+=String.fromCharCode (...)...return..unescape(d5);}...lTZI 04 = FC3d(VkpZF , MG6V);eval(lTZI04);
http://mcaptains.com/case.js Exploit / Payload Exploit / Payload
k=document[‘createElement’] (‘script’)…k[‘text’]=S5SSQ(“A WFRMWtbFnshSQGIESFJaRB9 4ZxUBXVMbUeEVXXnddR9QG mpXbR9aa....”);...d.appendC hild(k);
http://myattention.net/default.js 3
ieTrue = navigator.userAgent. toLowerCase(); browserType = /msie[\/s]d+/i.test(ieTrue)… if(browserType) { ... /* attack code */ ... }
Ad Network
elem.onmouseover = function() { … head.appendChild(script); }
Deobfuscation Deobfuscation
4
Coverage Evasion Obfuscation Scalability Precision Static analysis Dynamic analysis Symbolic analysis
<html> … <script src=…> … </html>
Exploit / Payload Exploit / Payload 5
ieTrue = navigator.userAgent. toLowerCase(); browserType = /msie[\/s]d+/i.test(ieTrue)… if(browserType) { ... /* malicious */ ... }
Ad Network
elem.onmouseover = function() { … head.appendChild(script); } function FC3d(DzV, lm8H2) { for(HPFY=0;DVz.length>HPFY;HPF Y+=8)...d5+=String.fromCharCode (...)...return..unescape(d5);}...lTZI 04 = FC3d(VkpZF , MG6V);eval(lTZI04);
k=document[‘createElement’] (‘script’)…k[‘text’]=S5SSQ(“A WFRMWtbFnshSQGIESFJaRB9 4ZxUBXVMbUeEVXXnddR9QG mpXbR9aa....”);...d.appendCh ild(k);
Static and symbolic analysis fail to deobfuscate
function FC3d(DzV, lm8H2) { for(HPFY=0;DVz.length>HPFY;HPF Y+=8)...d5+=String.fromCharCode (...)...return..unescape(d5);}...lTZI 04 = FC3d(VkpZF , MG6V);eval(lTZI04);
<html> … <script src=…> … </html>
Exploit / Payload Exploit / Payload 6 Ad Network
elem.onmouseover = function() { … head.appendChild(script); } k=document[‘createElement’] (‘script’)…k[‘text’]=S5SSQ(“A WFRMWtbFnshSQGIESFJaRB9 4ZxUBXVMbUeEVXXnddR9QG mpXbR9aa....”);...d.appendC hild(k);
ieTrue = navigator.userAgent. toLowerCase(); browserType = /msie[\/s]d+/i.test(ieTrue)… if(browserType) { ... /* attack code */ ... }
Dynamic analysis fails due to evasion
predicates
execution
7
<script> btn = document.createElement("button"); btn.id = "mybutton"; if (cond) { btn.innerHTML = "Remove"; } else { btn.innerHTML = "Skip"; } document.body.appendChild(btn); </script>
8
... <script> x = document.getElementById("mybutton"); ... </script> Execution #1
<script> btn = document.createElement("button"); btn.id = "mybutton"; if (cond) { btn.innerHTML = "Remove"; } else { btn.innerHTML = "Skip"; } document.body.appendChild(btn); </script>
9
... <script> x = document.getElementById("mybutton"); ... </script> Execution #2
<script> btn = document.createElement("button"); btn.id = "mybutton"; if (cond) { btn.innerHTML = "Remove"; } else { btn.innerHTML = "Skip"; } document.body.appendChild(btn); </script>
10
... <script> x = document.getElementById("mybutton"); ... </script>
<script> btn = document.createElement("button"); btn.id = "mybutton"; if (cond) { btn.innerHTML = "Remove"; } else { btn.innerHTML = "Skip"; } document.body.appendChild(btn); </script>
11
... <script> x = document.getElementById("mybutton"); ... </script> Execution #3
<html> … <script src=…> … </html>
function FC3d(DzV, lm8H2) { for(HPFY=0;DVz.length>HPFY;HPF Y+=8)...d5+=String.fromCharCode (...)...return..unescape(d5);}...lTZI 04 = FC3d(VkpZF , MG6V);eval(lTZI04);
Exploit / Payload Exploit / Payload
k=document[‘createElement’] (‘script’)…k[‘text’]=S5SSQ(“A WFRMWtbFnshSQGIESFJaRB9 4ZxUBXVMbUeEVXXnddR9QG mpXbR9aa....”);...d.appendC hild(k);
12
ieTrue = navigator.userAgent. toLowerCase(); browserType = /msie[\/s]d+/i.test(ieTrue)… if(browserType) { ... /* attack code */ ... }
J-Force
if(browserType) if(browserType)
…
/*malicious*/ /*malicious*/
J-Force
if(browserType)
…
/*malicious*/
Ad Network
elem.onmouseover = function() { … head.appendChild(script); }
eval(lTZI04):
“elem.onmouseover = function() {…head.appendChild( script);}”
eval(lTZI04):
“elem.onmouseover = function() {…head.appendChild( script);}”
J-Force J-Force eval(lTZI04):
“elem.onmouseover = function() {…head.appendChild( script);}”
J-Force
13
x = new XMLHttpRequest(); ... if (cond) x = null; if (x == null) return; x.send(); x = new XMLHttpRequest(); ... if (cond) x = null; if (x == null) return; x.send();
fault Execution #1 Execution #2
14
crash Execution #2
15
// <- ( Def1 | Def2 ) // -> Def1 // -> Def2
16
17
2 4 6 8 10 Native Rozzle WebEval J-Force SweetOrange Magnitude Nuclear Rig Angler 2 4 6 8 10 Native Rozzle WebEval J-Force SweetOrange Magnitude Nuclear Rig Angler
# of Handled Obfuscations # of Handled Evasions
18
100 200 300 400 Hulk Expector WebEval J-Force Information Leak Ad-Injection
J-Force: 352 cases Others: less than 209 cases
19
J-Force: 95% coverage Concolic: less than 70% J-Force (L-path): 2-8 times J-Force (E-path): 2-300 times Concolic: 10-10,000 times
20
21