Malicious JavaScript Detection Based on Bidirectional LSTM Model
Source abstract
Abstract
JavaScript has been widely used on the Internet because of its powerful features, and almost all the websites use it to provide dynamic functions. However, these dynamic natures also carry potential risks. The authors of the malicious scripts started using JavaScript to launch various attacks, such as Cross-Site Scripting (XSS), Cross-site Request Forgery (CSRF), and drive-by download attack. Traditional malicious script detection relies on expert knowledge, but even for experts, this is an error-prone task. To solve this problem, many learning-based methods for malicious JavaScript detection are being explored. In this paper, we propose a novel deep learning-based method for malicious JavaScript detection. In order to extract semantic information from JavaScript programs, we construct the Program Dependency Graph (PDG) and generate semantic slices, which preserve rich semantic information and are easy to transform into vectors. Then, a malicious JavaScript detection model based on the Bidirectional Long Short-Term Memory (BLSTM) neural network is proposed. Experimental results show that, in comparison with the other five methods, our model achieved the best performance, with an accuracy of 97.71% and an F1-score of 98.29%.
Source: crossref · Quality: baseline
Research context
OpenAlex topics: Advanced Malware Detection Techniques · Spam and Phishing Detection · Web Application Security Vulnerabilities
SciVX discovery tags are terminology-based. OpenAlex topics are source-provided classifications.
Affiliations
School of Cyberspace Security, Beijing University of Posts and Telecommunications, Beijing 100876, China
National Engineering Laboratory for Mobile Network Security, Beijing 100876, China
School of Computer Science, Beijing University of Posts and Telecommunications, Beijing 100876, China
Funding
Beijing Natural Science Foundation(4204107), the Fundamental Research Funds for the Central Universities (No. 500419810), Funds of “YinLing” and in part by the China Postdoctoral Science Foundation
References (54)
Show source-provided references
1. (2019, December 29). JavaScript. Available online: https://developer.mozilla.org/en-US/docs/Web/JavaScript.
2. Bichhawat, A., Rajani, V., Garg, D., and Hammer, C. (2014, January 5–13). Information flow control in WebKit’s JavaScript bytecode. Proceedings of the International Conference on Principles of Security and Trust, Grenoble, France.10.1007/978-3-642-54792-8_9 ↗
3. Zhou, Y., and Evans, D. (2015, January 17–21). Understanding and monitoring embedded web scripts. Proceedings of the IEEE Symposium on Security and Privacy, San Jose, CA, USA.10.1109/SP.2015.57 ↗
4. (2019, November 19). Symantec Security Center. Available online: https://www.symantec.com/security-center/threat-report.
5. Tanaka, Y., and Kashima, S. (2019, January 14–17). SeedsMiner: Accurate URL Blacklist-Generation Based on Efficient OSINT Seed Collection. Proceedings of the IEEE/WIC/ACM International Conference on Web Intelligence, Thessaloniki, Greece.10.1145/3358695.3361751 ↗
6. Egele, M., Wurzinger, P., Kruegel, C., and Kirda, E. (2009, January 9–10). Defending Browsers against Drive-by Downloads: Mitigating Heap-Spraying Code Injection Attacks. Proceedings of the Conference on Detection of Intrusions and Malware, and Vulnerability Assessment, Como, Italy.10.1007/978-3-642-02918-9_6 ↗
7. Sachin, V., and Chiplunkar, N.N. (2012, January 25–27). SurfGuard JavaScript instrumentation-based defense against Drive-by downloads. Proceedings of the International Conference on Recent Advances in Computing and Software Systems, Chennai, India.10.1109/RACSS.2012.6212679 ↗
8. Hallaraker, O., and Vigna, G. (2005, January 16–20). Detecting malicious JavaScript code in Mozilla. Proceedings of the 10th IEEE International Conference on Engineering of Complex Computer Systems, Shanghai, China.
9. Xu, W., Zhang, F., and Zhu, S. (2013, January 18–20). Jstill: Mostly static detection of obfuscated malicious JavaScript code. Proceedings of the Malicious JavaScript Detection using Statistical Language Model, San Antonio, TX, USA.10.1145/2435349.2435364 ↗
10. Research on malicious JavaScript detection technology based on LSTM10.1109/ACCESS.2018.2874098 ↗
11. Stokes, J.W., Agrawal, R., McDonald, G., and Hausknecht, M. (2019). ScriptNet: Neural Static Analysis for Malicious JavaScript Detection. arXiv.10.1109/MILCOM47813.2019.9020870 ↗
12. Hao, Y., Liang, H., Zhang, D., Zhao, Q., and Cui, B. (2014, January 8–10). JavaScript Malicious Codes Analysis Based on Naive Bayes Classification. Proceedings of the International Conference on P2P, Parallel, Grid, Cloud and Internet Computing, Guangdong, China.10.1109/3PGCIC.2014.147 ↗
13. Fass, A., Krawczyk, R.P., Backes, M., and Stock, B. (2018, January 28–29). JaSt: Fully Syntactic Detection of Malicious (Obfuscated) JavaScript. Proceedings of the International Conference on Detection of Intrusions and Malware, and Vulnerability Assessment, Saclay, France.10.1007/978-3-319-93411-2_14 ↗
14. Liang, H., Yang, Y., Sun, L., and Jiang, L. (2019, January 14–19). JSAC: A Novel Framework to Detect Malicious JavaScript via CNNs over AST and CFG. Proceedings of the 2019 International Joint Conference on Neural Networks, Budapest, Hungary.10.1109/IJCNN.2019.8851760 ↗
15. Cova, M., Kruegel, C., and Vigna, G. (2010, January 26–30). Detection and analysis of driveby-download attacks and malicious javascript code. Proceedings of the 19th International Conference on World Wide Web, Raleigh, NC, USA.10.1145/1772690.1772720 ↗
16. Kyungtae, K., Kim, I.L., Kim, C.H., Kwon, Y., Zheng, Y., Zhang, X., and Xu, D. (2017, January 3–7). J-Force: Forced Execution on JavaScript. Proceedings of the 26th international conference on World Wide Web, Perth, Australia.
17. Efficient and effective realtime prediction of drive-by download attacks10.1016/j.jnca.2013.03.009 ↗
18. Detecting Malicious Behaviors in JavaScript Applications10.1109/ACCESS.2018.2795383 ↗
19. Canali, D., Cova, M., Vigna, G., and Kruegel, C. (April, January 28). Prophiler: A Fast Filter for the Large-scale Detection of Malicious Web Pages. Proceedings of the International Conference on World Wide Web, Hyderabad, India.
20. Curtsinger, C., Livshits, B., Zorn, B.G., and Seifert, C. (2011, January 8–12). ZOZZLE: Fast and precise in-browser JavaScript malware detection. Proceedings of the 20th USENIX Security Symposium, San Francisco, CA, USA.
21. Likarish, P., Jung, E., and Jo, I. (2009, January 13–14). Obfuscated malicious JavaScript detection using classification techniques. Proceedings of the Proceedings of the Third ACM conference on Data and Application Security and Privacy, Quebec, AB, Canada.10.1109/MALWARE.2009.5403020 ↗
22. Laskov, P., and Šrndić, N. (2011, January 5–9). Static Detection of Malicious JavaScript-Bearing PDF Documents. Proceedings of the 27th Annual Computer Security Applications Conference, Orlando, FL, USA.10.1145/2076732.2076785 ↗
23. Stock, B., Livshits, B., and Zorn, B. (July, January 28). Kizzle: A SignatureCompiler for Detecting Exploit Kits. Proceedings of the 46th Annual IEEE/IFIP International Conference on Dependable Systems and Networks, Toulouse, France.
24. 2016. SQLiGoT: Detecting SQL injection attacks using graph of tokens and SVM10.1016/j.cose.2016.04.005 ↗
25. Kapravelos, A., Shoshitaishvili, Y., Cova, M., Kruegel, C., and Vigna, G. (2013, January 14–16). Revolver: An Automated Approach to the Detection. Proceedings of the 22nd USENIX Conference on Security, Berkeley, CA, USA.
26. He, X., Xu, L., and Cha, C. (2018, January 4). Malicious JavaScript Code Detection Based on Hybrid Analysis. Proceedings of the 25th Asia-Pacific Software Engineering Conference, Nara, Japan.10.1109/APSEC.2018.00051 ↗
27. Ndichu, S., Ozawa, S., Misu, T., and Okada, K. (2018, January 8–13). A machine learning approach to malicious JavaScript detection using fixed length vector representation. Proceedings of the 2018 International Joint Conference on Neural Networks, Rio de Janeiro, Brazil.10.1109/IJCNN.2018.8489414 ↗
28. Fass, A., Backes, M., and Stock, B. (2019, January 9–13). JStap: A static pre-filter for malicious JavaScript detection. Proceedings of the 35th Annual Computer Security Applications Conference, San Juan, PR, USA.10.1145/3359789.3359813 ↗
29. Fass, A., Backes, M., and Stock, B. (2019, January 11–15). Hidenoseek: Camouflaging malicious javascript in benign ASTs. Proceedings of the 2019 ACM SIGSAC Conference on Computer and Communications Security, London, UK.10.1145/3319535.3345656 ↗
30. Malware with your Mocha? Obfuscation and antiemulation tricks in malicious JavaScript
31. Xu, W., Zhang, F., and Zhu, S. (2012, January 16–18). The power of obfuscation techniques in malicious JavaScript code: A measurement study. Proceedings of the 7th International Conference on Malicious and Unwanted Software, Fajardo, PR, USA.10.1109/MALWARE.2012.6461002 ↗
32. (2019, November 19). JSDetox-A Javascript Malware Analysis Tool Using Static Analysis. Available online: http://www.relentless-coding.org/projects/jsdetox.
33. (2019, November 19). ECMAScript Parsing Infrastructure for Multipurpose Analysis. Available online: https://esprima.org/index.html.
34. Rieck, K., Krueger, T., and Dewald, A. (2010, January 6–10). Cujo: Efficient detection and prevention of drive-by-download attacks. Proceedings of the 26th Annual Computer Security Applications Conference, Austin, TX, USA.10.1145/1920261.1920267 ↗
35. Xu, Q. (2014). Research on the Methods for Javascript Malicious Code Detection. [Master’s Thesis, Southwest Jiaotong University].
36. Machine vision technology for agricultural applications10.1016/S0168-1699(02)00100-X ↗
37. Deep neural networks for acoustic modeling in speech recognition10.1109/MSP.2012.2205597 ↗
38. Krizhevsky, A., Sutskever, I., and Hinton, G.E. (2012, January 3–6). Imagenet classification with deep convolutional neural networks. Proceedings of the Advances in Neural Information Processing Systems, Lake Tahoe, NV, USA.
39. Gibert, L.D. (2016). Convolutional Neural Networks for Malware Classification. [Master’s Thesis, Universitat Politècnica de Catalunya].
40. Mikolov, T., Karafiát, M., Burget, L., Černocký, J., and Khudanpur, S. (2010, January 26–30). Recurrent neural network based language model. Proceedings of the 11th annual Conference of the International Speech Communication Association, Makuhari, Chiba, Japan.10.21437/Interspeech.2010-343 ↗
41. Cho, K., Van Merriënboer, B., Gulcehre, C., Bahdanau, D., Bougares, F., Schwenk, H., and Bengio, Y. (2014, January 25–29). Learning phrase representations using RNN Encoder-Decoder for statistical machine translation. Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing, Doha, Qatar.10.3115/v1/D14-1179 ↗
42. Li, Z., Zou, D., Xu, S., Ou, X., Jin, H., Wang, S., and Zhong, Y. (2018). VulDeePecker: A Deep Learning-Based System for Vulnerability Detection. arXiv.10.14722/ndss.2018.23158 ↗
43. Guo, N., Li, X., Yin, H., and Gao, Y. (2019, January 15–17). VulHunter: An Automated Vulnerability Detection System Based on Deep Learning and Bytecode. Proceedings of the International Conference on Information and Communications Security, Beijing, China.10.1007/978-3-030-41579-2_12 ↗
44. Kolen, J.F., and Kremer, S.C. (2001). Gradient flow in recurrent nets: The difficulty of learning long-term dependencies. Field Guide Dyn. Recurr. Netw., 237–243.
45. Cho, K., Van Merriënboer, B., Bahdanau, D., and Bengio, Y. (2014). On the properties of neural machine translation: Encoder-decoder approaches. arXiv.10.3115/v1/W14-4012 ↗
46. Long short-term memory10.1162/neco.1997.9.8.1735 ↗
47. Framewise phoneme classification with bidirectional LSTM and other neural network architectures10.1016/j.neunet.2005.06.042 ↗
48. (2019, November 19). Hynek Petrak. Available online: https://github.com/HynekPetrak/javascript-malware-collection.
49. (2019, November 19). Geeksonsecurity. Available online: https://github.com/geeksonsecurity/js-malicious-dataset.
50. (2019, November 19). Wang Wei’s Home Page. Available online: http://infosec.bjtu.edu.cn/wangwei/?page_id=85.
51. (2019, November 19). Alexa. Available online: https://www.alexa.com/.
52. Skolka, P., Staicu, C.A., and Pradel, M. (2019, January 13–17). Anything to Hide? Studying Minified and Obfuscated Code in the Web. Proceedings of the World Wide Web Conference, San Francisco, CA, USA.10.1145/3308558.3313752 ↗
53. Kingma, D., and Ba, J. (2014). Adam: A method for stochastic optimization. arXiv.
54. (2020, February 21). ClamAV. Available online: https://www.clamav.net/.