DOI QR코드

DOI QR Code

Improved Original Entry Point Detection Method Based on PinDemonium

PinDemonium 기반 Original Entry Point 탐지 방법 개선

  • 김경민 (한양대학교 컴퓨터소프트웨어학부) ;
  • 박용수 (한양대학교 컴퓨터소프트웨어학부)
  • Received : 2018.03.12
  • Accepted : 2018.05.03
  • Published : 2018.06.30

Abstract

Many malicious programs have been compressed or encrypted using various commercial packers to prevent reverse engineering, So malicious code analysts must decompress or decrypt them first. The OEP (Original Entry Point) is the address of the first instruction executed after returning the encrypted or compressed executable file back to the original binary state. Several unpackers, including PinDemonium, execute the packed file and keep tracks of the addresses until the OEP appears and find the OEP among the addresses. However, instead of finding exact one OEP, unpackers provide a relatively large set of OEP candidates and sometimes OEP is missing among candidates. In other words, existing unpackers have difficulty in finding the correct OEP. We have developed new tool which provides fewer OEP candidate sets by adding two methods based on the property of the OEP. In this paper, we propose two methods to provide fewer OEP candidate sets by using the property that the function call sequence and parameters are same between packed program and original program. First way is based on a function call. Programs written in the C/C++ language are compiled to translate languages into binary code. Compiler-specific system functions are added to the compiled program. After examining these functions, we have added a method that we suggest to PinDemonium to detect the unpacking work by matching the patterns of system functions that are called in packed programs and unpacked programs. Second way is based on parameters. The parameters include not only the user-entered inputs, but also the system inputs. We have added a method that we suggest to PinDemonium to find the OEP using the system parameters of a particular function in stack memory. OEP detection experiments were performed on sample programs packed by 16 commercial packers. We can reduce the OEP candidate by more than 40% on average compared to PinDemonium except 2 commercial packers which are can not be executed due to the anti-debugging technique.

많은 악성프로그램은 역공학을 막기 위해 다양한 상용 패커를 사용해 압축 혹은 암호화를 했기 때문에 악성코드 분석가는 압축해제 혹은 복 호화를 먼저 수행해야 한다. OEP(Original Entry Point)는 암호화되거나 압축되어 있는 실행파일을 다시 원본 바이너리 상태로 되돌린 후 실행된 첫 번째 명령어의 주소이다. 여러 언패커는 OEP가 나타나기 전까지 패킹된 파일을 실행하며 주소를 기록한다. 그리고 기록된 주소들 중에 OEP를 찾는다. 그러나 일부 언패커에서 제공하는 OEP 후보들은 비교적 큰 OEP 후보 집합을 제공하거나 후보들 중에 OEP가 없는 경우가 있다. 이에 악성코드 분석가들은 더 적은 OEP 후보 집합을 제공하는 도구가 필요한 실정이다. 본 논문에서는 PinDemonium이라 불리는 언패커에 두 가지 OEP 탐지방법을 추가하여 더 적은 OEP 후보 집합을 제공하는 도구를 만들었다. 첫 번째 방법은 패킹된 프로그램이 완전히 원본 바이너리상태로 되돌아 간 후에는 원프로그램 함수 호출과 동일하다는 것을 활용한 OEP 탐지방법이다. C/C++ 언어로 작성된 프로그램은 바이너리 코드로 언어를 변환하는 컴파일 과정을 거친다. 컴파일 과정을 거친 프로그램에는 특정 시스템 함수들이 추가된다. 이 시스템 함수들은 컴파일러 별로 다르다. 컴파일러 별로 사용되는 시스템 함수를 조사한 후, 패킹된 프로그램에서 호출되는 시스템 함수와 패턴매칭하여 언패킹 작업이 끝났는지 탐지하는 방법이다. 두 번째 방법은 패킹된 프로그램이 완전히 원본 바이너리 상태로 돌아간 후 시스템함수에서 사용되는 매개 변수가 원프로그램과 동일하다는 것을 활용한 OEP 탐지방법이다. 시스템함수에서 사용되는 매개변수의 값을 이용해 OEP를 찾는 방법이다. 본 연구는 16종의 상용 패커로 압축된 샘플 프로그램을 대상으로 OEP 탐지 실험을 했다. 본 연구에선 안티 디버깅 기법으로 프로그램을 실행하지 못하는 경우인 2종을 제외하고 PinDemonium 대비 평균 40% 이상 OEP후보를 줄일 수 있었다.

Keywords

References

  1. AV-TEST, publication [internet], https://www.av-test.org/fileadmin/pdf/publications/blackhat_2006_avtest_presentation_runtime_packers-the_hidden_problem.pdf
  2. W. Yan, Z. Zhang, and N. Ansari, "Revealing packed malware," ieee seCurity & PrivaCy, Vol.6, No.5, 2008.
  3. J. Lenoir, "Implementing your own generic unpacker."
  4. Wikipedia, Entry point [Internet], https://en.wikipedia.org/wiki/Entry_point
  5. R. Isawa, D. Inoue, and K. Nakao, "An original entry point detection method withcandidate-sorting for more effective generic unpacking," IEICE TRANSACTIONS on Information and Systems, Vol.98, No.4, pp.883-893, 2015.
  6. Hex-ray, Universal PE Unpacker [Internet], https://www.hex-rays.com/products/ida/support/tutorials/unpack_pe/index.shtml
  7. P. Royal, M. Halpin, and D. Dagon, "PolyUnpack: Automating the Hidden-Code Extraction of Unpack-ExecutingMalware," In Computer Security Applications Conference, 2006. ACSAC'06. 22nd Annual, IEEE, pp.289-300, 2006.
  8. D'ALESSIO, S. T. E. F. A. N. O., and S. MARIANI, "PinDemonium: a DBI-based generic unpacker for Windows executables," Black hat, 2016.
  9. Intel, Pin User Manual [Internet], https://software.intel.com/sites/landingpage/pintool/docs/71313/Pin/html/
  10. Scylla, NtQuery Scylla - x64/x86 Imports Reconstruction, [internet], https://github.com/NtQuery/Scylla
  11. Jibz, Qwerton, XineohPSnaker, and PEiD BOB. "Peid." Availablein: http://www.peid.info/, 2011.
  12. YARA group, yara [internet], https://virustotal.github.io/yara/
  13. Microsoft, MSDN [internet], https://msdn.microsoft.com
  14. X. Hu, K. G. Shin, S. Bhatkar, and K. Griffin, "MutantX-S: Scalable Malware Clustering Based on Static Features," USENIX Annual Technical Conference, pp.187-198, 2013.
  15. AHTeam, Quick Unpack 2.2 [Internet], http://qunpack.ahteam.org/?author=1