UnSafengine64: A Safengine Unpacker for 64-Bit Windows Environments and Detailed Analysis Results on Safengine 2.4.0
Abstract
:1. Introduction
2. Preliminaries and Related Work
2.1. (Very Simplified) Unpacking Procedure of Packers
2.2. Overview of Pin [9]
- A mechanism for deciding insertion points where the plug-in code is inserted;
- Plug-in code for execution at the insertion points.
2.3. Related Work
3. UnSafengine64: Safengine Unpacker for 64-Bit Windows Environments
3.1. Overview of UnSafengine64
- Detect It Easy [10]: DIE identifies the type of packer in the executable file and outputs the section information. DIE was used to determine whether the target program was packed with Safengine.
- IDA Pro [11]: IDA Pro is one of the most popular disassemblers for reverse engineering binaries in Windows/Linux environments. The executable file is statically disassembled and displayed, and diverse information, including the function structure and section information, is displayed. Because some malware uses Safengine’s unique signature to cheat DIE, IDA Pro can be used for double-checking in this case.
- x64Dbg [13]: x64Dbg is a widely used debugger for reversing 64-bit Windows environments. We used x64Dbg as an auxiliary tool for executing code chunks to double-check the analysis results from Pin or x64Unpack. In addition, x64Dbg can be used to determine whether UnSafengine64 is properly unpacked. Sometimes, the unpacked version does not execute because of a minor bug; therefore, we can use x64Dbg to fix the minor bugs.
- x64Unpack [12]: This is an application-level hybrid emulator that either directly executes code chunks or emulates them. Using x64Unpack, we can monitor API function calls, examine memory reads/writes, and emulate each instruction for detailed analysis. For further information, refer to [12]. We used x64Unpack to analyze the major functionalities of Safengine, as explained in Section 4. For unpacking, x64Unpack is not required (Figure 2).
3.2. Structure of UnSafengine64
3.3. Pin Plug-In Structure: Image Handler
3.4. Pin Plug-In Structure: Trace Handler
3.5. Pin Plug-In Structure: Thread Handler
3.6. Pin Plug-In Structure: Application Exit Handler
3.7. Pin Plug-In Structure: OEP Detector
3.8. Pin Plug-In Structure: De-Obfuscating Function Calls
- Obfuscation of call/jmp instructions that go to the beginning of the API functions (the first method);
- Obfuscation for the Import Address Table (IAT) (the second method);
- Concealing either a portion or the entirety of the code of the API function body through obfuscation (the third method).
3.9. Pin Plug-In Structure: Anti-Anti-DBI
3.10. Pin Plug-In Structure: Instruction Tracer
3.11. Pin Plug-In Structure: Implementation Issues
4. Experimental Results
5. Detailed Analysis Results of the Packed Files Using Safengine 2.4.0
5.1. Comparison Results on the Sections in the PE File
5.2. Analysis of the API Function Obfuscation
5.3. IAT (Import Address Table) of the Packed File
5.4. Analysis Results of the Unpacking Procedure (Safengine 2.4.0)
6. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Fairley, P. Upgrade Coming to Grid Cybersecurity in U.S. In Technology, Engineering, and Science News; IEEE Spectrum: New York, NY, USA, 2016; Available online: https://spectrum.ieee.org/upgrade-coming-to-grid-cybersecurity-in-us (accessed on 11 January 2024).
- VMSoft. VMProtect Software: VMProtect Virtualizes Code. Available online: http://vmpsoft.com/products/vmprotect/ (accessed on 7 October 2023).
- Safengine. Safengine Protector. Available online: http://www.safengine.com/en-us/ (accessed on 7 October 2023).
- Oreans Technologies. Themida: Advanced Windows Software Protection System. Available online: https://www.oreans.com/Themida.php/ (accessed on 10 January 2024).
- Ferrie, P. The Ultimate Anti-Debugging Reference. Available online: https://anti-reversing.com/Downloads/Anti-Reversing/The_Ultimate_Anti-Reversing_Reference.pdf (accessed on 7 October 2023).
- Chen, P.; Huygens, C.; Desmet, L.; Joosen, W. Advanced or not? A comparative study of the use of anti-debugging and anti-VM techniques in generic and targeted malware. In IFIP International Conference on ICT Systems Security and Privacy Protection; IFIP: Laxenburg, Austria, 2016; pp. 323–336. [Google Scholar]
- OllyDbg. OllyDbg v1.10: 32-Bit Assembler Level Analyzing Debugger for Microsoft Windows. Available online: http://www.ollydbg.de/ (accessed on 7 October 2023).
- Luk, C.; Cohn, R.; Muth, R.; Patil, H.; Klauser, A.; Lowney, G.; Wallace, S.; Raddi, V.J.; Hazelwood, K. Pin: Building customized program analysis tools with dynamic instrumentation. In 2005 ACM SIGPLAN Conference on PLDI; ACM: New York, NY, USA, 2005; pp. 190–200. [Google Scholar]
- Garnett, T. Dynamic Optimization of IA-32 Application under DynamoRIO. Master’s Thesis, MIT, Cambridge, MA, USA, 2003. [Google Scholar]
- Horsicq. Detect-It-Easy: Program for Determining Types of Files for Windows, Linux and MacOS. Available online: https://github.com/horsicq/Detect-It-Easy/ (accessed on 7 October 2023).
- Hex-Rays. IDA Pro: State-of-the-Art Binary Code Analysis Solutions. Available online: https://www.hex-rays.com/products/ida/ (accessed on 7 October 2023).
- Choi, S.; Chang, T.; Kim, C.; Park, Y. x64Unpack: Hybrid Emulation Unpacker for 64-bit Windows Environments and Detailed Analysis Results on VMProtect 3.4. IEEE Access 2020, 8, 127939–127953. [Google Scholar] [CrossRef]
- TitanEngine Community Edition. x64dbg: An Open-Source x64/x32 Debugger for Windows. Available online: https://x64dbg.com/ (accessed on 7 October 2023).
- Choi, S. API Deobfuscator: Resolving Obfuscated API Functions in Modern Packers. In BlackHat USA 2015; BlackHat: Washington, DC, USA, 2015. [Google Scholar]
- Kang, M.G.; Poosankam, P.; Yin, H. Renovo: A Hidden Code Extractor for Packed Executables. In WORM’07; ACM: New York, NY, USA, 2007; pp. 46–54. [Google Scholar]
- Kim, G.M.; Park, J.; Jang, Y.H.; Park, Y. Efficient Automatic Original Entry Point Detection. J. Inf. Sci. Eng. 2019, 35, 887–902. [Google Scholar]
- Holycall. UnSafengine64: Unpack Safengine 2.3.x-2.4.0 Protected Executables. Available online: https://github.com/holycall/UnSafengine64 (accessed on 11 January 2024).
- Huang, H.; Du, R.; Wang, Z.; Li, X.; Yuan, G. A Malicious Code Detection Method Based on Stacked Depthwise Separable Convolutions and Attention Mechanism. Sensors 2023, 23, 7084. [Google Scholar] [CrossRef] [PubMed]
- Shafin, S.S.; Karmakar, G. Obfuscated Memory Malware Detection in Resource-Constrained IoT Devices for Smart City Applications. Sensors 2023, 23, 5348. [Google Scholar] [CrossRef] [PubMed]
- Ahmadon, M.A.B.; Yamaguchi, S. Diffusion of White-Hat Botnet Using Lifespan with Controllable Ripple Effect for Malware Removal in IoT Networks. Sensors 2023, 23, 1018. [Google Scholar] [CrossRef] [PubMed]
- Herrera-Silva, J.A.; Hernández-Álvarez, M. Dynamic Feature Dataset for Ransomware Detection Using Machine Learning Algorithms. Sensors 2023, 23, 1053. [Google Scholar] [CrossRef] [PubMed]
- Hwang, S.F.; Utaliyeva, A.; Kim, J.S.; Choi, Y.H. Bypassing Heaven’s Gate Technique Using Black-Box Testing. Sensors 2023, 23, 9417. [Google Scholar] [CrossRef] [PubMed]
- Babbar, H.; Rani, S.; Sah, D.K.; AlQahtani, S.A.; Bashir, A.K. Detection of Android Malware in the Internet of Things through the K-Nearest Neighbor. Sensors 2023, 23, 7256. [Google Scholar] [CrossRef] [PubMed]
- Bardin, S.; David, R.; Marion, J.Y. Backward-Bounded DSE: Targeting Infeasibility Questions on Obfuscated Codes. In Proceedings of the 2017 IEEE Symposium on Security and Privacy, San Jose, CA, USA, 22–26 May 2017; IEEE: Piscataway, NJ, USA, 2017; pp. 633–651. [Google Scholar]
- Blazytko, T.; Contag, M.; Aschermann, C.; Holz, T. Syntia: Synthesizing the Semantics of Obfuscated Code. In Proceedings of the USENIX Security Symposium 2017, Vancouver, BC, Canada, 16–18 August 2017; USENIX: Berkeley, CA, USA, 2017; pp. 643–659. [Google Scholar]
- Shi, H.; Mirkovic, J. Hiding debuggers from malware with apate. In Proceedings of the Symposium on Applied Computing 2017, Marrakech, Morocco, 3–7 April 2017; ACM: New York, NY, USA, 2017; pp. 1703–1710. [Google Scholar]
- Nethercote, N.; Seward, J. Valgrind: A framework for heavyweight dynamic binary instrumentation. In PLDI’07; ACM: New York, NY, USA, 2007; pp. 89–100. [Google Scholar]
- Hunt, G.; Brubacher, D. Detours: Binary interception of Win32 functions. In Proceedings of the 3rd USENIX Windows NT Symposium, Washington, DC, USA, 12–15 July 1999; USENIX: Berkeley, CA, USA, 1999; p. 14. [Google Scholar]
- Kirsch, J.; Zhechev, Z.; Bierbaumer, B.; Kittel, T. PwIN—Pwning Intel piN: Why DBI is Unsuitable for Security Applications. In ESORICS ’18; Springer: Berlin/Heidelberg, Germany, 2018; LNCS 11098; pp. 363–392. [Google Scholar]
- Polino, M.; Continella, A.; Mariani, S.; D’Alessio, S.; Fontana, L.; Gritti, F.; Zanero, S. Measuring and Defeating Anti-Instrumentation-Equipped Malware. In DIMVA’2017; Springer: Berlin/Heidelberg, Germany, 2017; LNCS 10327; pp. 73–96. [Google Scholar]
- Lee, Y.; Suk, J.; Lee, D. Bypassing Anti-Analysis of Commercial Protector Methods Using DBI Tools. IEEE Access 2021, 9, 7655–7673. [Google Scholar] [CrossRef]
- Heaventools. U.P.X. Unpacker Plug-In: Automatic UPX Unpacking. Available online: http://www.heaventools.com/PE_Explorer_plug-ins.htm (accessed on 7 October 2023).
- Kalysch, A.; Götzfried, J.; Müller, T. VMAttack: Deobfuscating Virtualization-Based Packed Binaries. In ARES’17; ACM: New York, NY, USA, 2017; pp. 1–10. [Google Scholar]
- Stefano, D.; Mariani, S. PinDemonium: A DBI-based generic unpacker for Windows executables. In Blackhat USA’2016; Politecnico: Milan, Italy, 2016. [Google Scholar]
- Choi, S.; Chang, T.; Yoon, S.; Park, Y. Hybrid emulation for bypassing anti-reversing techniques and analyzing malware. J. Supercomput. 2021, 77, 471–497. [Google Scholar] [CrossRef]
- Suk, J.H.; Lee, J.Y.; Jin, H.; Kim, I.S.; Lee, D.H. UnThemida: Commercial obfuscation technique analysis with a fully obfuscated program. Softw. Pract. Exp. 2018, 48, 2331–2349. [Google Scholar] [CrossRef]
- Yin, H.L.; Fu, Y.; Li, C.L.; Weng, C.X.; Li, B.H.; Gu, J.; Lu, Y.S.; Huang, S.; Chen, Z.B. Experimental quantum secure network with digital signatures and encryption. Natl. Sci. Rev. 2023, 10, nwac228. [Google Scholar] [CrossRef] [PubMed]
- Li, B.H.; Xie, Y.M.; Cao, X.Y.; Li, C.L.; Fu, Y.; Yin, H.L.; Chen, Z.B. One-time universal hashing quantum digital signatures without perfect keys. Phys. Rev. Appl. 2023, 20, 044011. [Google Scholar] [CrossRef]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Choi, S.; Chang, T.; Park, Y. UnSafengine64: A Safengine Unpacker for 64-Bit Windows Environments and Detailed Analysis Results on Safengine 2.4.0. Sensors 2024, 24, 840. https://doi.org/10.3390/s24030840
Choi S, Chang T, Park Y. UnSafengine64: A Safengine Unpacker for 64-Bit Windows Environments and Detailed Analysis Results on Safengine 2.4.0. Sensors. 2024; 24(3):840. https://doi.org/10.3390/s24030840
Chicago/Turabian StyleChoi, Seokwoo, Taejoo Chang, and Yongsu Park. 2024. "UnSafengine64: A Safengine Unpacker for 64-Bit Windows Environments and Detailed Analysis Results on Safengine 2.4.0" Sensors 24, no. 3: 840. https://doi.org/10.3390/s24030840
APA StyleChoi, S., Chang, T., & Park, Y. (2024). UnSafengine64: A Safengine Unpacker for 64-Bit Windows Environments and Detailed Analysis Results on Safengine 2.4.0. Sensors, 24(3), 840. https://doi.org/10.3390/s24030840