lief library to instrument executable formats table of
play

LIEF: Library to Instrument Executable Formats Table of Contents - PowerPoint PPT Presentation

Romain Thomas - rthomas@quarkslab.com LIEF: Library to Instrument Executable Formats Table of Contents Introduction Architecture Demo Conclusion About Romain Thomas - Security engineer at Quarkslab Working on obfuscation and software


  1. Romain Thomas - rthomas@quarkslab.com LIEF: Library to Instrument Executable Formats

  2. Table of Contents Introduction Architecture Demo Conclusion

  3. About ◮ Romain Thomas - Security engineer at Quarkslab ◮ Working on obfuscation and software protection, reverse engineering ◮ Contributor to the Triton project ( https://triton.quarkslab.com )

  4. Layers of information Tools Format pefile, readelf, otool, LLVM . . . ELF, PE, Mach-O, COFF, XCOFF... Content LLVM, IDA, diStorm . . . Disassembler: x86, ARM, MIPS, AArch64 ... Behavior Intel PIN, Qemu, DBI, emulator, sandbox, debugger gdb, Triton . . . ... Figure: Layer of information in an executable

  5. Howto? ◮ Get assembly code? ◮ Get symbols? ◮ Get imported functions?

  6. Executable File Formats in a Nutshell

  7. Executable File Formats in a Nutshell Executable file format gives information such as: ◮ First instruction address to execute. ◮ Libraries used ◮ Target architecture ( x86 , ARM . . . )

  8. Executable File Formats in a Nutshell The three mainstream formats: ◮ ELF : Linux, Android . . . ◮ PE : Windows ◮ Mach-O : OS-X, iOS, . . .

  9. Modification Format modifications can be a starting point to: ◮ Packing ◮ Watermarking ◮ Hooking: Perform interposition on functions ◮ Persistent code injection ◮ Malware analysis (static unpacking . . . )

  10. Purpose of LIEF ◮ Provide a cross-platform library to parse ELF, PE and Mach-O formats ◮ Abstract common features from the different formats (section, header, entry point, symbols . . . ) ◮ Enable format modifications ◮ Provide an API for different languages (Python, C++, C . . . )

  11. Howto? (answers) Get assembly code?

  12. Howto? (answers) Get assembly code? 1 import lief 2 binary = lief.parse("C:\\ Windows \\ explorer.exe") # PE 3 asm = binary. get_section (".text")

  13. Howto? (answers) Get symbols?

  14. Howto? (answers) Get symbols? 1 import lief 2 binary = lief.parse("/bin/ls") # ELF 3 for symbol in binary.symbols: 4 print(symbols)

  15. Howto? (answers) Get imported functions?

  16. Howto? (answers) Get imported functions? 1 import lief 2 binary = lief.parse("/usr/lib/libc ++ abi.dylib") # Mach -O 3 for function in binary. imported_functions : 4 print(function)

  17. Table of Contents Introduction Architecture Demo Conclusion

  18. Overview LIEF ELF PE Mach-O ELF::Binary ELF::Parser ELF::Builder PE::Binary PE::Parser PE::Builder MACHO::Binary MACHO::Parser MACHO::Builder Abstract layer C++ Python / C Figure: Global architecture

  19. Modification process LIEF object LIEF object Header Header Sections Sections .text .text Modification .data .data .new section Segments Segments LOAD LOAD DYNAMIC DYNAMIC Parser Builder /bin/ls /bin/ls (modified)

  20. Table of Contents Introduction Architecture Demo Conclusion

  21. Demo!

  22. Table of Contents Introduction Architecture Demo Conclusion

  23. Roadmap Some ideas for next versions: ◮ Graphical User Interface (Work in progress) ◮ Handle the OAT format (subset of the ELF format) ◮ PE API to hook functions ◮ PE/Mach-O fuzzer ◮ Handle the Dwarf format

  24. ◮ Source code is available on GitHub: https://github.com/lief-project ( Apache 2.0 license) ◮ Website: https://lief.quarkslab.com

  25. ◮ Source code is available on GitHub: https://github.com/lief-project ( Apache 2.0 license) ◮ Website: https://lief.quarkslab.com Missing feature or bug?

  26. ◮ Source code is available on GitHub: https://github.com/lief-project ( Apache 2.0 license) ◮ Website: https://lief.quarkslab.com Missing feature or bug? lief@quarkslab.com or Open an issue / pull request

  27. Thank you!

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend