SlideShare a Scribd company logo
1
Introduction to
Procedural
Debugging through
Binary Libification
August 2024
Pr. Jonathan Brossard
WOOT'24
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
2
Motivation
Problem Statement
Introduction to Libification
Libification Process
Automation
Validation
Conclusion & Future Work
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
3
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
4
Software Bill of Materials are becoming mandatory
Software Bill of Materials (SBOMs) contain lists
of CPEs or Package URLS (purl) describing all
the components of a given Software.
They allow to perform vulnerability
assessments by comparing the CPEs to the
dictionaries published by the NIST for each CVE.
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
5
Software Bill of Materials are becoming mandatory
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
6
6
SBOMs provide possible CVES.
For each vulnerability : is it true ?
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
7
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
8
Industry standard to Prove exploitability : Write an exploit
This bar is too high.
If we decompose an exploit into 3 problems:
- Reach the vulnerable function
- Trigger the vulnerability
- Achieve code execution/Weaponize
The first step alone is already undecidable ("reachability problem").
Undecidable
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
9
Let's do only step 2:
If we decompose an exploit into 3 problems:
- Reach the vulnerable function
- Trigger the vulnerability
- Achieve code execution/Weaponize
This a reasonable heuristic to determine vulnerability of the application.
We'd like to be able to call the vulnerable function directly.
Problem : How to do this out of context ?
Proposal : Let's turn the vulnerable application into a shared library !
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
10
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
11
Source Code Compiler Assembly
Code (.S)
Assembler
Static Link Editor
Shared Libraries
Executables
Object Files (.o)
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
12
Source Code Compiler Assembly
Code (.S)
Assembler
Static Link Editor
Executables
Object Files (.o)
Disassembly
Shared Libraries
Undecidable
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
13
Source Code Compiler Assembly
Code (.S)
Assembler
Static Link Editor
Shared Libraries
Executables
Object Files (.o)
Decompilation
Undecidable
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
14
Source Code Compiler Assembly
Code (.S)
Assembler
Static Link Editor
Shared Libraries
Executables
Object Files (.o)
Libification
(wld)
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
Same headers, same segments, same
sections. They mostly differ through
their metadata (various ELF headers)
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
Same headers, same segments, same
sections. They mostly differ through
their metadata (various ELF headers)
Modify the various ELF headers to
turn an Executable into a Shared
Library
The work to be done:
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
17
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
Libification Oracle
Let's modify a test binary
(ls) until we manage to
load it in memory...
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
typedef struct elf64_hdr {
unsigned char e_ident[EI_NIDENT]; /* ELF "magic number" */
Elf64_Half e_type; = ET_DYN
Elf64_Half e_machine;
Elf64_Word e_version;
Elf64_Addr e_entry; /* Entry point virtual address */
Elf64_Off e_phoff; /* Program header table file offset */
Elf64_Off e_shoff; /* Section header table file offset */
Elf64_Word e_flags;
Elf64_Half e_ehsize;
Elf64_Half e_phentsize;
Elf64_Half e_phnum;
Elf64_Half e_shentsize;
Elf64_Half e_shnum;
Elf64_Half e_shstrndx;
} Elf64_Ehdr;
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
Modify the ELF type from ET_EXEC
to ET_DYN in the ELF header.
typedef struct elf64_shdr {
Elf64_Word sh_name; /* Section name, index in string tbl */
Elf64_Word sh_type; SHT_DYNAMIC
Elf64_Xword sh_flags; /* Miscellaneous section attributes */
Elf64_Addr sh_addr; /* Section virtual addr at execution */
Elf64_Off sh_offset; /* Section file offset */
Elf64_Xword sh_size; /* Size of section in bytes */
Elf64_Word sh_link; /* Index of another section */
Elf64_Word sh_info; /* Additional section information */
Elf64_Xword sh_addralign; /* Section alignment */
Elf64_Xword sh_entsize; /* Entry size if section holds table */
}
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
Parse the array of section headers,
identify the section with .dynamic
section with type SHT_DYNAMIC
If section headers are missing,
parsing the array of segments and
identifying the PT_DYNAMIC
segment leads to the same
.dynamic content.
typedef struct {
Elf64_Sxword d_tag;
union {
Elf64_Xword d_val;
Elf64_Addr d_ptr;
} d_un;
} Elf64_Dyn;
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
The .dynamic section contains an
array of Elf64_Dyn entries.
Replace any optional DT_BIND_NOW entry with a d_tag = DT_NULL
entry and a pointer of value d_ptr = –1.
If the binary features a DT_FLAGS_1 entry, remove the flags Remove
DF_1_NOOPEN and DF_1_PIE flags if present:
dyn->d_un.d_val = dyn->d_un.d_val & ~DF_1_NOOPEN;
dyn->d_un.d_val = dyn->d_un.d_val & ~DF_1_PIE;
Optionally ignore constructors and destructors by zeroing the d_val
values associated with DT_INIT_ARRAYSZ, DT_INIT_ARRAY and
DT_FINI_ARRAYSZ, DT_FINI_ARRAY respectively.
22
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
https://zenodo.org/doi/10.5281/
zenodo.11298208
URL: https://github.com/endrazine/wcc
License: MIT/BSD-2
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
24
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
25
Test Repository:
https://github.com/endrazine/wcc-tests
Test Plan:
Libify The 435 binaries of a default Ubuntu 24.04 amd64 LTS distribution
Time taken (total) : 3 seconds
Libification Test Count
Passed 435
Failed 0
https://zenodo.org/doi/10.5281/
zenodo.11301408
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
26
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
27
Source Code Compiler Assembly
Code (.S)
Assembler
Static Link Editor
Executables
Object Files (.o)
Libification
Decompilation
Disassembly
Shared Libraries
Undecidable
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
28
Source Code Compiler Assembly
Code (.S)
Assembler
Static Link Editor
Shared Libraries
Executables
Object Files (.o)
Unlinking
(wcc)
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
29
- Libify ELF executables
- Make ELF executables scriptable
- Call arbitrary functions
(procedural debugging)
URL: https://github.com/endrazine/wcc
License: MIT/BSD-2
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
30
The ability to turn ELF
executables into libraries
will allow us to create
partial proofs of
vulnerabilities in the form
of WSH test scripts.
31
18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA

More Related Content

PDF
DEFCON 27 - ALEXANDRE BORGES - dot net malware threats
PDF
.NET MALWARE THREATS -- BHACK CONFERENCE 2019
PPTX
Enterprise Linux Exploit Mapper (ELEM) Demo
PDF
.NET MALWARE THREAT: INTERNALS AND REVERSING DEF CON USA 2019
PDF
Porting your favourite cmdline tool to Android
PDF
MODERN MALWARE THREAT: HANDLING OBFUSCATED CODE -- CONFIDENCE CONFERENCE (2019)
PDF
PTS2022-Talk-19-MobSF-for-penetration-testers_0.pdf
PDF
Asert threat-intelligence-brief-2014-07-illuminating-etumbot-apt
DEFCON 27 - ALEXANDRE BORGES - dot net malware threats
.NET MALWARE THREATS -- BHACK CONFERENCE 2019
Enterprise Linux Exploit Mapper (ELEM) Demo
.NET MALWARE THREAT: INTERNALS AND REVERSING DEF CON USA 2019
Porting your favourite cmdline tool to Android
MODERN MALWARE THREAT: HANDLING OBFUSCATED CODE -- CONFIDENCE CONFERENCE (2019)
PTS2022-Talk-19-MobSF-for-penetration-testers_0.pdf
Asert threat-intelligence-brief-2014-07-illuminating-etumbot-apt

Similar to [USENIX-WOOT] Introduction to Procedural Debugging through Binary Libification (20)

PDF
ScilabTEC 2015 - Irill
PDF
Software Preservation: challenges and opportunities for reproductibility (Sci...
PPT
Using Zend_Tool to Establish Your Project's Skeleton
PPTX
OpenDDR
PDF
(130105) #fitalk trends in d forensics (dec, 2012)
PPTX
The Veil-Framework
PDF
Emulate virtual machines to avoid malware infections - GrrCON 2014
PDF
Emulate virtual machines to avoid malware infections - GrrCON 2014
PDF
FlutterNinjas 2024: Exploring Full-Stack Dart for Firebase Server-Side Develo...
PDF
Virus Bulletin 2015: Exposing Gatekeeper
PDF
MarkLogic Overview and Use Cases
PDF
MarkLogic Overview and Use Cases
PPTX
How to get along with HATEOAS without letting the bad guys steal your lunch?
PDF
Bugs Ex Ante by Kristaps Dzonsons
PDF
Null safety in dart and flutter , the whole story!
PDF
BSides IR in Heterogeneous Environment
PDF
Win32/Flamer: Reverse Engineering and Framework Reconstruction
PDF
Matrosov, rodionov win32 flamer. reverse engineering and framework reconstr...
PDF
FRIDA 101 Android
PDF
SmartphoneHacking_Android_Exploitation
ScilabTEC 2015 - Irill
Software Preservation: challenges and opportunities for reproductibility (Sci...
Using Zend_Tool to Establish Your Project's Skeleton
OpenDDR
(130105) #fitalk trends in d forensics (dec, 2012)
The Veil-Framework
Emulate virtual machines to avoid malware infections - GrrCON 2014
Emulate virtual machines to avoid malware infections - GrrCON 2014
FlutterNinjas 2024: Exploring Full-Stack Dart for Firebase Server-Side Develo...
Virus Bulletin 2015: Exposing Gatekeeper
MarkLogic Overview and Use Cases
MarkLogic Overview and Use Cases
How to get along with HATEOAS without letting the bad guys steal your lunch?
Bugs Ex Ante by Kristaps Dzonsons
Null safety in dart and flutter , the whole story!
BSides IR in Heterogeneous Environment
Win32/Flamer: Reverse Engineering and Framework Reconstruction
Matrosov, rodionov win32 flamer. reverse engineering and framework reconstr...
FRIDA 101 Android
SmartphoneHacking_Android_Exploitation
Ad

More from Moabi.com (20)

PDF
[USENIX-WOOT] Introduction to Procedural Debugging through Binary Libification
PPTX
[Defcon24] Introduction to the Witchcraft Compiler Collection
PDF
[Blackhat2015] FileCry attack against Internet Explorer
PDF
[Blackhat2015] FileCry attack against Java
PDF
[Blackhat2015] SMB : SHARING MORE THAN JUST YOUR FILES... #Whitepaper
PDF
[Blackhat2015] SMB : SHARING MORE THAN JUST YOUR FILES...
PDF
[2013 syscan360] Jonathan Brossard_katsuni理论介绍以及在沙盒和软件仿真方面的应用
ODP
[Defcon] Hardware backdooring is practical
ODP
Hardware backdooring is practical : slides
PDF
Hardware backdooring is practical
PDF
[Hackito2012] Hardware backdooring is practical
PPT
[CCC-28c3] Post Memory Corruption Memory Analysis
PDF
[Ruxcon Monthly Sydney 2011] Proprietary Protocols Reverse Engineering : Rese...
PDF
[Ruxcon 2011] Post Memory Corruption Memory Analysis
PDF
[Kiwicon 2011] Post Memory Corruption Memory Analysis
PDF
[HITB Malaysia 2011] Exploit Automation
PPT
[h2hc] Generic exploitation of invalid memory writes
PDF
[Ruxcon] Breaking virtualization by switching the cpu to virtual 8086 mode
PPT
[HackInTheBox] Breaking virtualization by any means
PDF
[DEFCON] Bypassing preboot authentication passwords by instrumenting the BIOS...
[USENIX-WOOT] Introduction to Procedural Debugging through Binary Libification
[Defcon24] Introduction to the Witchcraft Compiler Collection
[Blackhat2015] FileCry attack against Internet Explorer
[Blackhat2015] FileCry attack against Java
[Blackhat2015] SMB : SHARING MORE THAN JUST YOUR FILES... #Whitepaper
[Blackhat2015] SMB : SHARING MORE THAN JUST YOUR FILES...
[2013 syscan360] Jonathan Brossard_katsuni理论介绍以及在沙盒和软件仿真方面的应用
[Defcon] Hardware backdooring is practical
Hardware backdooring is practical : slides
Hardware backdooring is practical
[Hackito2012] Hardware backdooring is practical
[CCC-28c3] Post Memory Corruption Memory Analysis
[Ruxcon Monthly Sydney 2011] Proprietary Protocols Reverse Engineering : Rese...
[Ruxcon 2011] Post Memory Corruption Memory Analysis
[Kiwicon 2011] Post Memory Corruption Memory Analysis
[HITB Malaysia 2011] Exploit Automation
[h2hc] Generic exploitation of invalid memory writes
[Ruxcon] Breaking virtualization by switching the cpu to virtual 8086 mode
[HackInTheBox] Breaking virtualization by any means
[DEFCON] Bypassing preboot authentication passwords by instrumenting the BIOS...
Ad

Recently uploaded (20)

PPT
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
PDF
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
PDF
SASE Traffic Flow - ZTNA Connector-1.pdf
PDF
How to Ensure Data Integrity During Shopify Migration_ Best Practices for Sec...
PPT
Design_with_Watersergyerge45hrbgre4top (1).ppt
PDF
Unit-1 introduction to cyber security discuss about how to secure a system
PPTX
Slides PPTX World Game (s) Eco Economic Epochs.pptx
PPTX
Job_Card_System_Styled_lorem_ipsum_.pptx
PDF
The Internet -By the Numbers, Sri Lanka Edition
PDF
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
PPTX
presentation_pfe-universite-molay-seltan.pptx
PPTX
Introuction about ICD -10 and ICD-11 PPT.pptx
PDF
Tenda Login Guide: Access Your Router in 5 Easy Steps
PPTX
E -tech empowerment technologies PowerPoint
PPTX
Digital Literacy And Online Safety on internet
PDF
Slides PDF The World Game (s) Eco Economic Epochs.pdf
PPTX
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
PPTX
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
PDF
Introduction to the IoT system, how the IoT system works
PPTX
Module 1 - Cyber Law and Ethics 101.pptx
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
SASE Traffic Flow - ZTNA Connector-1.pdf
How to Ensure Data Integrity During Shopify Migration_ Best Practices for Sec...
Design_with_Watersergyerge45hrbgre4top (1).ppt
Unit-1 introduction to cyber security discuss about how to secure a system
Slides PPTX World Game (s) Eco Economic Epochs.pptx
Job_Card_System_Styled_lorem_ipsum_.pptx
The Internet -By the Numbers, Sri Lanka Edition
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
presentation_pfe-universite-molay-seltan.pptx
Introuction about ICD -10 and ICD-11 PPT.pptx
Tenda Login Guide: Access Your Router in 5 Easy Steps
E -tech empowerment technologies PowerPoint
Digital Literacy And Online Safety on internet
Slides PDF The World Game (s) Eco Economic Epochs.pdf
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
Introduction to the IoT system, how the IoT system works
Module 1 - Cyber Law and Ethics 101.pptx

[USENIX-WOOT] Introduction to Procedural Debugging through Binary Libification

  • 1. 1 Introduction to Procedural Debugging through Binary Libification August 2024 Pr. Jonathan Brossard WOOT'24 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
  • 2. 2 Motivation Problem Statement Introduction to Libification Libification Process Automation Validation Conclusion & Future Work 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
  • 3. 3 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
  • 4. 4 Software Bill of Materials are becoming mandatory Software Bill of Materials (SBOMs) contain lists of CPEs or Package URLS (purl) describing all the components of a given Software. They allow to perform vulnerability assessments by comparing the CPEs to the dictionaries published by the NIST for each CVE. 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
  • 5. 5 Software Bill of Materials are becoming mandatory 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
  • 6. 6 6 SBOMs provide possible CVES. For each vulnerability : is it true ? 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
  • 7. 7 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
  • 8. 8 Industry standard to Prove exploitability : Write an exploit This bar is too high. If we decompose an exploit into 3 problems: - Reach the vulnerable function - Trigger the vulnerability - Achieve code execution/Weaponize The first step alone is already undecidable ("reachability problem"). Undecidable 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
  • 9. 9 Let's do only step 2: If we decompose an exploit into 3 problems: - Reach the vulnerable function - Trigger the vulnerability - Achieve code execution/Weaponize This a reasonable heuristic to determine vulnerability of the application. We'd like to be able to call the vulnerable function directly. Problem : How to do this out of context ? Proposal : Let's turn the vulnerable application into a shared library ! 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
  • 10. 10 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
  • 11. 11 Source Code Compiler Assembly Code (.S) Assembler Static Link Editor Shared Libraries Executables Object Files (.o) 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
  • 12. 12 Source Code Compiler Assembly Code (.S) Assembler Static Link Editor Executables Object Files (.o) Disassembly Shared Libraries Undecidable 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
  • 13. 13 Source Code Compiler Assembly Code (.S) Assembler Static Link Editor Shared Libraries Executables Object Files (.o) Decompilation Undecidable 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
  • 14. 14 Source Code Compiler Assembly Code (.S) Assembler Static Link Editor Shared Libraries Executables Object Files (.o) Libification (wld) 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
  • 15. Same headers, same segments, same sections. They mostly differ through their metadata (various ELF headers) 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
  • 16. Same headers, same segments, same sections. They mostly differ through their metadata (various ELF headers) Modify the various ELF headers to turn an Executable into a Shared Library The work to be done: 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
  • 17. 17 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
  • 18. Libification Oracle Let's modify a test binary (ls) until we manage to load it in memory... 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
  • 19. typedef struct elf64_hdr { unsigned char e_ident[EI_NIDENT]; /* ELF "magic number" */ Elf64_Half e_type; = ET_DYN Elf64_Half e_machine; Elf64_Word e_version; Elf64_Addr e_entry; /* Entry point virtual address */ Elf64_Off e_phoff; /* Program header table file offset */ Elf64_Off e_shoff; /* Section header table file offset */ Elf64_Word e_flags; Elf64_Half e_ehsize; Elf64_Half e_phentsize; Elf64_Half e_phnum; Elf64_Half e_shentsize; Elf64_Half e_shnum; Elf64_Half e_shstrndx; } Elf64_Ehdr; 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA Modify the ELF type from ET_EXEC to ET_DYN in the ELF header.
  • 20. typedef struct elf64_shdr { Elf64_Word sh_name; /* Section name, index in string tbl */ Elf64_Word sh_type; SHT_DYNAMIC Elf64_Xword sh_flags; /* Miscellaneous section attributes */ Elf64_Addr sh_addr; /* Section virtual addr at execution */ Elf64_Off sh_offset; /* Section file offset */ Elf64_Xword sh_size; /* Size of section in bytes */ Elf64_Word sh_link; /* Index of another section */ Elf64_Word sh_info; /* Additional section information */ Elf64_Xword sh_addralign; /* Section alignment */ Elf64_Xword sh_entsize; /* Entry size if section holds table */ } 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA Parse the array of section headers, identify the section with .dynamic section with type SHT_DYNAMIC If section headers are missing, parsing the array of segments and identifying the PT_DYNAMIC segment leads to the same .dynamic content.
  • 21. typedef struct { Elf64_Sxword d_tag; union { Elf64_Xword d_val; Elf64_Addr d_ptr; } d_un; } Elf64_Dyn; 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA The .dynamic section contains an array of Elf64_Dyn entries. Replace any optional DT_BIND_NOW entry with a d_tag = DT_NULL entry and a pointer of value d_ptr = –1. If the binary features a DT_FLAGS_1 entry, remove the flags Remove DF_1_NOOPEN and DF_1_PIE flags if present: dyn->d_un.d_val = dyn->d_un.d_val & ~DF_1_NOOPEN; dyn->d_un.d_val = dyn->d_un.d_val & ~DF_1_PIE; Optionally ignore constructors and destructors by zeroing the d_val values associated with DT_INIT_ARRAYSZ, DT_INIT_ARRAY and DT_FINI_ARRAYSZ, DT_FINI_ARRAY respectively.
  • 22. 22 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
  • 23. https://zenodo.org/doi/10.5281/ zenodo.11298208 URL: https://github.com/endrazine/wcc License: MIT/BSD-2 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
  • 24. 24 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
  • 25. 25 Test Repository: https://github.com/endrazine/wcc-tests Test Plan: Libify The 435 binaries of a default Ubuntu 24.04 amd64 LTS distribution Time taken (total) : 3 seconds Libification Test Count Passed 435 Failed 0 https://zenodo.org/doi/10.5281/ zenodo.11301408 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
  • 26. 26 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
  • 27. 27 Source Code Compiler Assembly Code (.S) Assembler Static Link Editor Executables Object Files (.o) Libification Decompilation Disassembly Shared Libraries Undecidable 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
  • 28. 28 Source Code Compiler Assembly Code (.S) Assembler Static Link Editor Shared Libraries Executables Object Files (.o) Unlinking (wcc) 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA
  • 29. 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA 29 - Libify ELF executables - Make ELF executables scriptable - Call arbitrary functions (procedural debugging) URL: https://github.com/endrazine/wcc License: MIT/BSD-2
  • 30. 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA 30 The ability to turn ELF executables into libraries will allow us to create partial proofs of vulnerabilities in the form of WSH test scripts.
  • 31. 31 18th USENIX WOOT Conference on Offensive Technologies, August 12-13th 2024 Philadelphia, PA, USA