Program comprehension is one of the most important applications in decompilation. The more abstract the decompilation result the better it is understood. Intrinsic function is introduced by a compiler to reduce the overhead of a function call and is inlined in the code where it is called. When analyzing the decompiled code with lots of inlined intrinsic functions, reverse engineers may be confused by these detailed and repeated operations and lose the goal. In this paper, we propose a method based graph isomorphism to detect intrinsic function on the CFG (Control Flow Graph) of the target function first. Then we identify the boundary of the intrinsic function, determine the parameter and return value and reduce the intrinsic function to a single function call in the disassembled program. Experimental results show that our method is more efficient at reducing intrinsic functions than the state-of-art decompilers such as Hex-Rays, REC and RD (Retargetable Decompiler).
KeywordsProgram ComprehensionDecompilationGraph IsomorphismIntrinsic Function
Van Emmerik, M.J. (2007) Static Single Assignment for Decompilation. The University of Queensland, Brisbane.
Kroustek, J. and Pokorny, F. (2013) Reconstruction of Instruction Idioms in a Retargetable Decompiler. Federated Conference on Computer Science and Information Systems (FedCSIS), Kraków, 8-11 September 2013, 1519-1526.
Chen, G., et al. (2013) A Refined Decompiler to Generate C Code with High Readability. Software: Practice and Experience, 43, 1337-1358. http://dx.doi.org/10.1002/spe.2138
Guilfanov, I. (2008) Decompilers and Beyond. Black Hat USA.
Hex-Rays, IDA F.L.I.R.T Technology: In-Depth. 2015. https://www.hex-rays.com/products/ida/tech/flirt/in_depth.shtml
Fu, J.J. (1997) Directed Graph Pattern Matching and Topological Embedding. Journal of Algorithms, 22, 372-391. http://dx.doi.org/10.1006/jagm.1996.0818
Cordella, L.P., et al. (1999) Performance Evaluation of the VF Graph Matching Algorithm. Proceedings of International Conference on Image Analysis and Processing, Venice, 1999, 1172-1177. http://dx.doi.org/10.1109/iciap.1999.797762
Cifuentes, C. and Van Emmerik, M. (2000) UQBT: Adaptable Binary Translation at Low Cost. Computer, 33, 60-66. http://dx.doi.org/10.1109/2.825697
Aho, A.V., Ullman, J.D. and Sethi, R. (1986) Compilers, Principles, Techniques, and Tools. Addison-Wesley Pub. Co., Reading, MA, 796 p.
Duke, R., Rose, G. and Smith, G. (1995) Object-Z: A Specification Language Advocated for the Description of Standards. Computer Standards & Interfaces, 17, 511-533. http://dx.doi.org/10.1016/0920-5489(95)00024-O
Brumley, D., et al. (2013) Native x86 Decompilation Using Semantics-Preserving Structural Analysis and Iterative Control-Flow Structuring. USENIX, Washington DC, 353-368.
Brumley, D., et al. (2011) BAP: A Binary Analysis Platform. In: Proceedings of the 23rd International Conference on Computer Aided Verification, Springer-Verlag, Snowbird, UT. http://dx.doi.org/10.1007/978-3-642-22110-1_37
Lattner, C. and Adve, V. (2004) LLVM: A Compilation Framework for Lifelong Program Analysis & Transformation. IEEE International Symposium on Code Generation and Optimization, 20-24 March 2004, 75-86. http://dx.doi.org/10.1109/cgo.2004.1281665
Tanenbaum, A.S., Van Staveren, H. and Stevenson, J.W. (1982) Using Peephole Optimization on Intermediate Code. ACM Transactions on Programming Languages and Systems (TOPLAS), 4, 21-36. http://dx.doi.org/10.1145/357153.357155
Ullmann, J.R. (1976) An Algorithm for Subgraph Isomorphism. Journal of the ACM (JACM), 23, 31-42. http://dx.doi.org/10.1145/321921.321925
Katzenelson, J., Pinter, S.S. and Schenfeld, E. (1992) Type Matching, Type-Graphs, and the Schanuel Conjecture. ACM Transactions on Programming Languages and Systems (TOPLAS), 14, 574-588. http://dx.doi.org/10.1145/133233.133247
Holm, K.H. (1990) Graph Matching in Operational Semantics and Typing. In: CAAP’90, Springer, 191-205. http://dx.doi.org/10.1007/3-540-52590-4_49
Khoo, W.M. (2013) Decompilation as Search. University of Cambridge, Cambridge.
Bíly, T. (2006) Replacement Special Loop Form by a Call of Built-in Function. In: Proceedings of the GCC Developers’ Summit 2006.
Cooper, K.D., Harvey, T.J. and Waterman, T. (2002) Building a Control-Flow Graph from Scheduled Assembly Code.
Demme, J. and Sethumadhavan, S. (2012) Approximate Graph Clustering for Program Characterization. ACM Transactions on Architecture and Code Optimization, 8, 1-21. http://dx.doi.org/10.1145/2086696.2086700
Cong, J., Hui, H. and Wei, J. (2010) A Generalized Control-Flow-Aware Pattern Recognition Algorithm for Behavioral Synthesis. Design, Automation & Test in Europe Conference & Exhibition (DATE), Dresden, 8-12 March 2010, 1255-1260. http://dx.doi.org/10.1109/date.2010.5456999
Luo, L., et al. (2014) Semantics-Based Obfuscation-Resilient Binary Code Similarity Comparison with Applications to Software Plagiarism Detection. Proceedings of the 22nd ACM SIGSOFT International Symposium on Foundations of Software Engineering. Hong Kong, China: ACM. http://dx.doi.org/10.1145/2635868.2635900
Kruegel, C., et al. (2006) Polymorphic Worm Detection Using Structural Information of Executables. Proceedings of the 8th International Conference on Recent Advances in Intrusion Detection, Springer-Verlag, Seattle. http://dx.doi.org/10.1007/11663812_11
Liu Zhangpei.xml Test Suite. https://github.com/livenowhy/xml
Ted Nyman.awk test suite. https://github.com/tnm/awk. 2015 March.
Aho, A.V., et al. (1988) The AWK Programming Language. Addison-Wesley, New York.
Coapp-Packages. Grep Test Suite. https://github.com/coapp-packages/grep
Sqlite Test Suite. http://www.sqlite.org/download.html
Durfina, L. and Kolár, D. (2013) Generic Detection of the Statically Linked Code. Proceedings of the Twelfth International Conference on Informatics (INFORMATICS’13), SpisskáNováVes, SK, FEI TU in Kosice, 157-161.
Yan, X. and Han, J. (2002) gSpan: Graph-Based Substructure Pattern Mining. Proceedings of IEEE International Conference on Data Mining, Maebashi, 9-12 December 2002.
Ayres, J., Gehrke, J., Yiu, T. and Flannick, J. (2002) Sequential Pattern Mining Using a Bitmap Representation. In: Proceedings of the 8th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, ACM, Edmonton.