Uncrackable Program? Finding a Parser Differential in loading ELF - Part 2/2 - bin 0x08

LiveOverflow · Intermediate ·🌐 Frontend Engineering ·10y ago

Key Takeaways

The video demonstrates a technique to make a program uncrackable by finding a parser differential in loading ELF files, using fuzzing to modify the executable and making it difficult for debuggers like GDB and Radare to parse it.

Full Transcript

we can use static analysis and reverse engineer the license check algorithm and write a key again to generate valid Keys obviously this algorithm also can become very complex but generally if you put a lot of work in it you can figure it out now you tell her that your manager but he's a smartass and tells you then you should stop people from being able to reverse Eng the binary uh then you direct yourself back to the desk and you come up with a new creative way how to stop somebody from debugging and reversing it because you are a pro you understand that an executable is a very complicated file format with object dump we have seen that this executable has a lot of information in there that is needed to load and execute it but you also realized that a program like GDB has to parse the executable to be able to disassemble and debug it as as well and radara has to read and part the executable file to show us stuff so could you modify the executable in a way that you can still execute it with Linux but GDB and radar tell you that something is broken what we are looking for is a parcel differential we hope that the parcel from XX from Linux differs from GDB parcel we hope that the parsel from execve and Linux differs from the GDB parsel in an ideal world every program that reads input would do it in the exact same way but every tool implements a parsing algorithm a bit different so if you screw with the input a Linux might see a valid file and executes it while the GDB says it's broken and cannot be disassembled let me show you a very naive way how to find something like that with fuzzing so let's create a new python script called f.p first we import some modules we need import random and and import OS first function you'll write is called flip bite as a parameter it takes a big string which will be the whole executable file later then we select the random index I between zero and the maximum length of this input then we select a random character that we will use to overwrite the bite in the program so character bite from a random number between zero and FF which is 255 then we return the original bytes up to this index I the next character will be the random created one instead of the original character I at this point and we append the remaining original bytes if you want to understand this fancy bracket colon index stuff in Python just Google python list so just a quick example of this function print flip bytes and a string with Yi you can copy this line and with P you can paste it multiple times and now you can see that a random character got changed to something else with TD you can delete those lines again now we want a function that copies the original binary but flips a bite and saves it in another file we call this function copy binary so we open the normal license 2 and a copy license 2 fuzz with right access now we read the whole original file pass those bytes to the flip bite function now this returns a copy of all license 2 executable just with a random bite flip and then we write this to the new copy now obviously we flip weird stuff and the file might not be executable anymore so we should check if the program still works the same way this means that it should print access granted with a valid key so this output should be the same for the original and the first program that's why I redirect this output to a file called Original output now let's write a python function that runs the fuss binary once a bite got flipped and let's check if its output is the same thing a really ugly way how I do this now just because it's less code I execute the same command like I just did just pipe the output into fuss output now I add a function to compare the original output with the fuss output and also let the result return from the check output function okay so this function checks if the binary still executes normally now let's think about how we can check if GDB still works basically we don't want people to disassemble main so you can use Echo and pipe the disassemble main command into GDB to get the output so this Echo basically just types the command and with the PIP we redirect this into the input of GDB this looks good so let's simply redirect this output also to a file uh that I will call original GDB now let's basically create the same function with check GDB and then we compare those two files again now let's do the same for RAR 2 here we just use commands AA then seek to the main function and PDF and also store this output in a file and now again we create a check radar function you can use shift V which you can use to highlight multiple lines and with Y you can copy it and paste it with P again okay almost there now let's create an endless loop where we first create a new copy then we check if the executable still works if that works we want radara and GDP to fail so not check GDB and not check radara if you we reach this here we print success and we also print the tail of the radara and GDB output just to have a visual check if the dis assembly really failed with raw input we can hold the Python program until we hit enter now let's run it um another small mistake this should be F1 instead of fn1 and I just discovered another mistake okay it found something but we clearly see disassembly there so let's continue until we find an output without disassembly ooh that looks good let's investigate the binary still works GDB can't find the main function and radara also has problems H that's cool admit this is very ugly this is not a real good technique you should use in practice but that is basically how fuzzing works and how you might discover cool new tricks to hide your malware and make it harder for people to analyze it if you want to learn more about this you can read this one block here which calls this a novel technique but it's not really new and there's a bit more in-depth research on L file format from ioactive and you can go even deeper and read even more crazy elf file format tricks in the Holy International Journal of proof of concept or get the out issue zero my binary can be found in in the GitHub repository and you can try different tools like Hopper or Ida and see if they still analyze it automatically but I suspect they do so this is just one small trick which can annoy somebody trying to analyze it now you can go back to your manager and tell him that he should hire some web developers and move the product into the cloud so that the code only runs on the servers you control [Music] [Applause] [Music]

Original Description

Can programs be uncrackable? Let's try to find some anti-debugging tricks. https://www.sentinelone.com/blog/breaking-and-evading/ http://blog.ioactive.com/2012/12/striking-back-gdb-and-ida-debuggers.html?m=1 PoC||GTFO Journal # 0x00 -=[ 🔴 Stuff I use ]=- → Microphone:* https://geni.us/ntg3b → Graphics tablet:* https://geni.us/wacom-intuos → Camera#1 for streaming:* https://geni.us/sony-camera → Lens for streaming:* https://geni.us/sony-lense → Connect Camera#1 to PC:* https://geni.us/cam-link → Keyboard:* https://geni.us/mech-keyboard → Old Microphone:* https://geni.us/mic-at2020usb US Store Front:* https://www.amazon.com/shop/liveoverflow -=[ ❤️ Support ]=- → per Video: https://www.patreon.com/join/liveoverflow → per Month: https://www.youtube.com/channel/UClcE-kVhqyiHCcjYwcpfj9w/join -=[ 🐕 Social ]=- → Twitter: https://twitter.com/LiveOverflow/ → Website: https://liveoverflow.com/ → Subreddit: https://www.reddit.com/r/LiveOverflow/ → Facebook: https://www.facebook.com/LiveOverflow/ -=[ 📄 P.S. ]=- All links with "*" are affiliate links. LiveOverflow / Security Flag GmbH is part of the Amazon Affiliate Partner Programm.
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from LiveOverflow · LiveOverflow · 10 of 60

1 LiveOverflow - Trailer
LiveOverflow - Trailer
LiveOverflow
2 Introduction to Linux - Installation and the Terminal - bin 0x01
Introduction to Linux - Installation and the Terminal - bin 0x01
LiveOverflow
3 Writing a simple Program in C
Writing a simple Program in C
LiveOverflow
4 Writing a simple Program in Python - bin 0x03
Writing a simple Program in Python - bin 0x03
LiveOverflow
5 Live Hacking - Twitch Recording overthewire.org - Vortex 0x01-0x03 (3h)
Live Hacking - Twitch Recording overthewire.org - Vortex 0x01-0x03 (3h)
LiveOverflow
6 Reversing and Cracking first simple Program - bin 0x05
Reversing and Cracking first simple Program - bin 0x05
LiveOverflow
7 Abusing the exception handler to leak flag - 32C3CTF readme (pwnable 200)
Abusing the exception handler to leak flag - 32C3CTF readme (pwnable 200)
LiveOverflow
8 ROP with a very small stack - 32C3CTF teufel (pwnable 200)
ROP with a very small stack - 32C3CTF teufel (pwnable 200)
LiveOverflow
9 Uncrackable Programs? Key validation with Algorithm and creating a Keygen - Part 1/2 - bin 0x07
Uncrackable Programs? Key validation with Algorithm and creating a Keygen - Part 1/2 - bin 0x07
LiveOverflow
Uncrackable Program? Finding a Parser Differential in loading ELF - Part 2/2 - bin 0x08
Uncrackable Program? Finding a Parser Differential in loading ELF - Part 2/2 - bin 0x08
LiveOverflow
11 Syscalls, Kernel vs. User Mode and Linux Kernel Source Code - bin 0x09
Syscalls, Kernel vs. User Mode and Linux Kernel Source Code - bin 0x09
LiveOverflow
12 Smashing the Stack for Fun and Profit - setuid, ssh and exploit.education - bin 0x0B
Smashing the Stack for Fun and Profit - setuid, ssh and exploit.education - bin 0x0B
LiveOverflow
13 Live Hacking - EFF-CTF 2016 - Level 0-4 (Enigma Conference)
Live Hacking - EFF-CTF 2016 - Level 0-4 (Enigma Conference)
LiveOverflow
14 First Stack Buffer Overflow to modify Variable - bin 0x0C
First Stack Buffer Overflow to modify Variable - bin 0x0C
LiveOverflow
15 First Exploit! Buffer Overflow with Shellcode - bin 0x0E
First Exploit! Buffer Overflow with Shellcode - bin 0x0E
LiveOverflow
16 Buffer Overflows can Redirect Program Execution - bin 0x0D
Buffer Overflows can Redirect Program Execution - bin 0x0D
LiveOverflow
17 Doing ret2libc with a Buffer Overflow because of restricted return pointer - bin 0x0F
Doing ret2libc with a Buffer Overflow because of restricted return pointer - bin 0x0F
LiveOverflow
18 Reverse engineering C programs (64bit vs 32bit) - bin 0x10
Reverse engineering C programs (64bit vs 32bit) - bin 0x10
LiveOverflow
19 pwnable.kr - Levels: fd, collision, bof, flag
pwnable.kr - Levels: fd, collision, bof, flag
LiveOverflow
20 Reverse Engineering and identifying Bugs - BKPCTF cookbook (pwn 6) part 1
Reverse Engineering and identifying Bugs - BKPCTF cookbook (pwn 6) part 1
LiveOverflow
21 Leaking Heap and Libc address - BKPCTF cookbook (pwn 6) part 2
Leaking Heap and Libc address - BKPCTF cookbook (pwn 6) part 2
LiveOverflow
22 Arbitrary write with House of Force (heap exploit) - BKPCTF cookbook (pwn 6) part 3
Arbitrary write with House of Force (heap exploit) - BKPCTF cookbook (pwn 6) part 3
LiveOverflow
23 Live Hacking - Internetwache CTF 2016 - web50, web60, web80
Live Hacking - Internetwache CTF 2016 - web50, web60, web80
LiveOverflow
24 Live Hacking - Internetwache CTF 2016 - crypto60, crypto70, crypto90
Live Hacking - Internetwache CTF 2016 - crypto60, crypto70, crypto90
LiveOverflow
25 A simple Format String exploit example - bin 0x11
A simple Format String exploit example - bin 0x11
LiveOverflow
26 NEW VIDEOS ARE COMING - loopback 0x00
NEW VIDEOS ARE COMING - loopback 0x00
LiveOverflow
27 HTML + CSS + JavaScript introduction - web 0x00
HTML + CSS + JavaScript introduction - web 0x00
LiveOverflow
28 The HTTP Protocol: GET /test.html - web 0x01
The HTTP Protocol: GET /test.html - web 0x01
LiveOverflow
29 Building Poor Man's Logic Analyzer with an Arduino - Reverse Engineering A/C Remote part 1
Building Poor Man's Logic Analyzer with an Arduino - Reverse Engineering A/C Remote part 1
LiveOverflow
30 What is PHP and why is XSS so common there? - web 0x02
What is PHP and why is XSS so common there? - web 0x02
LiveOverflow
31 Introducing the AngularJS Javascript Framework - XSS with AngularJS 0x00
Introducing the AngularJS Javascript Framework - XSS with AngularJS 0x00
LiveOverflow
32 Sandbox Bypass in Version 1.0.8 - XSS with AngularJS 0x1
Sandbox Bypass in Version 1.0.8 - XSS with AngularJS 0x1
LiveOverflow
33 Capturing & Analyzing Packets with Saleae Logic Pro 8 - Reverse Engineering A/C Remote part 2
Capturing & Analyzing Packets with Saleae Logic Pro 8 - Reverse Engineering A/C Remote part 2
LiveOverflow
34 XSS Contexts and some Chrome XSS Auditor tricks - web 0x03
XSS Contexts and some Chrome XSS Auditor tricks - web 0x03
LiveOverflow
35 Previous Bypass is now fixed in version 1.4.7 - XSS with AngularJS 0x2
Previous Bypass is now fixed in version 1.4.7 - XSS with AngularJS 0x2
LiveOverflow
36 New Sandbox Bypass in 1.4.7 - XSS with AngularJS 0x3
New Sandbox Bypass in 1.4.7 - XSS with AngularJS 0x3
LiveOverflow
37 The Heap: what does malloc() do? - bin 0x14
The Heap: what does malloc() do? - bin 0x14
LiveOverflow
38 The Heap: How to exploit a Heap Overflow - bin 0x15
The Heap: How to exploit a Heap Overflow - bin 0x15
LiveOverflow
39 Reverse Engineering with Binary Ninja and gdb a key checking algorithm - TUMCTF 2016 Zwiebel part 1
Reverse Engineering with Binary Ninja and gdb a key checking algorithm - TUMCTF 2016 Zwiebel part 1
LiveOverflow
40 Scripting radare2 with python for dynamic analysis - TUMCTF 2016 Zwiebel part 2
Scripting radare2 with python for dynamic analysis - TUMCTF 2016 Zwiebel part 2
LiveOverflow
41 Live Hacking - Internetwache CTF 2016 - exp50, exp70, exp80
Live Hacking - Internetwache CTF 2016 - exp50, exp70, exp80
LiveOverflow
42 Sandbox bypass for the latest AngularJS version 1.5.8 - XSS with AngularJS 0x4
Sandbox bypass for the latest AngularJS version 1.5.8 - XSS with AngularJS 0x4
LiveOverflow
43 Channel is growing and Riscure hardware CTF starting soon - loopback 0x01
Channel is growing and Riscure hardware CTF starting soon - loopback 0x01
LiveOverflow
44 Explaining Dirty COW local root exploit - CVE-2016-5195
Explaining Dirty COW local root exploit - CVE-2016-5195
LiveOverflow
45 What is CTF? An introduction to security Capture The Flag competitions
What is CTF? An introduction to security Capture The Flag competitions
LiveOverflow
46 The Heap: How do use-after-free exploits work? - bin 0x16
The Heap: How do use-after-free exploits work? - bin 0x16
LiveOverflow
47 The Browser is a very Confused Deputy - web 0x05
The Browser is a very Confused Deputy - web 0x05
LiveOverflow
48 The Heap: Once upon a free() - bin 0x17
The Heap: Once upon a free() - bin 0x17
LiveOverflow
49 Simple reversing challenge and gaming the system - BruCON CTF part 1
Simple reversing challenge and gaming the system - BruCON CTF part 1
LiveOverflow
50 int0x80 from DualCore lent me his lockpicking set and I'm a horse - BruCON CTF part 2
int0x80 from DualCore lent me his lockpicking set and I'm a horse - BruCON CTF part 2
LiveOverflow
51 The Heap: dlmalloc unlink() exploit - bin 0x18
The Heap: dlmalloc unlink() exploit - bin 0x18
LiveOverflow
52 MD5 Length Extension and Blind SQL Injection - BruCON CTF part 3
MD5 Length Extension and Blind SQL Injection - BruCON CTF part 3
LiveOverflow
53 TCP Protocol introduction - bin 0x1A
TCP Protocol introduction - bin 0x1A
LiveOverflow
54 Socket programming in python and Integer Overflow - bin 0x1B
Socket programming in python and Integer Overflow - bin 0x1B
LiveOverflow
55 Linux signals and core dumps - bin 0x1C
Linux signals and core dumps - bin 0x1C
LiveOverflow
56 [Live] Remote oldschool dlmalloc Heap exploit - bin 0x1F
[Live] Remote oldschool dlmalloc Heap exploit - bin 0x1F
LiveOverflow
57 Riscure Embedded Hardware CTF setup and introduction - rhme2 Soldering
Riscure Embedded Hardware CTF setup and introduction - rhme2 Soldering
LiveOverflow
58 Rooting a CTF server to get all the flags with Dirty COW - CVE-2016-5195
Rooting a CTF server to get all the flags with Dirty COW - CVE-2016-5195
LiveOverflow
59 How to learn hacking? ft. Rubber Ducky
How to learn hacking? ft. Rubber Ducky
LiveOverflow
60 Format String to dump binary and gain RCE - 33c3ctf ESPR (pwn 150)
Format String to dump binary and gain RCE - 33c3ctf ESPR (pwn 150)
LiveOverflow

The video teaches how to use fuzzing to find a parser differential in loading ELF files, making it difficult for debuggers to parse the executable, and demonstrates how to implement anti-debugging tricks to make a program uncrackable.

Key Takeaways
  1. Create a Python script to fuzz the executable
  2. Use the flip_bytes function to modify the executable
  3. Check if the modified executable still works
  4. Use GDB and Radare to test the modified executable
  5. Compare the outputs to find a parser differential
💡 Fuzzing can be used to find a parser differential in loading ELF files, making it difficult for debuggers to parse the executable.

Related AI Lessons

Had my Frontend Developer interview with Capgemini (Application Developer) today, and I wanted to…
Prepare for a frontend developer interview with Capgemini by reviewing JavaScript fundamentals and practicing common interview questions
Medium · JavaScript
10 Frontend Developer Tools to Boost Productivity in 2026
Boost frontend productivity with 10 essential tools for modern web app development
Medium · Programming
10 Frontend Developer Tools to Boost Productivity in 2026
Boost frontend productivity with top 10 developer tools in 2026
Medium · JavaScript
The US Frontend Engineer Market in 2026: A Data-Driven Reality Check (and the Bias That Stops Us Seeing It)
US frontend engineer hiring demand peaked in 2022 and remains flat-depressed in 2026, contrary to common assumptions
Dev.to AI
Up next
The masks we wear | Zora Krstić | TEDxLuxembourgCity
TEDx Talks
Watch →