What are Executables? | bin 0x00

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
finally a series on binary exploitation let's do this [Music] welcome to a new club banger on binary exploitation i'm pretty excited about this whole album we're going to explore the world of low level we're going to try to offend some binary executables and it's going to be a lot of fun all right let's get started before we jump in i'd like to clear one thing why am i making this series well i do know there's good content out there on the internet already but i'm making this because i've got a couple of reasons one of them is that i have little to almost no experience in this field so i wanted to learn and also make videos at the same time about them so that some of you can learn with me it's like taking y'all on a learning quest with me okay maybe i lied that's not the main reason the main reason is because the word pwn is in my name so yeah that's that all right so the goal is to become a pro jedi 1337 samurai ninja warrior yeah that's probably not going to happen but at least we'll be able to understand some core concepts some mind-blowing things and eventually have fun breaking code anyways the prerequisites for this series is very simple if you're a basic linux user and you can read some code not all of it obviously i'll explain line by line in the future videos but at least some code like conditions and loops in any programming language you should be just fine all right with that out of the way let's jump into the ocean [Music] we're going to start with executable files let's try to understand them a little bit executables are basically standalone files that you can run as a process in an operating system we're going to be dealing with linux for now maybe windows and arm in the future but for now just linux this means that we're going to be mostly working with elf file formats which stand for executable and linkable format files these are similar to your exe files in windows well kind of but they're actually more than just executables but we'll be just you know going over the executable types of elf files let's say you have this c program a simple program that just prints out hello world this program is fed into a compiler like gcc which parses the code and then generates some machine executable code then you can go ahead and execute this file to see the output which is hello world makes sense but the compiler just doesn't directly compile your c code into executable machine instructions there's a bunch of intermediate steps that actually happen like generation of assembly code object files and linking them all kinds of stuff before producing the final executable file the l file format and the process life cycle in linux might actually feel a bit complicated at this point in time but i'll try to give you a high level abstraction of these topics i will oversimplify a lot so proceed with caution an l file is basically a binary file and we already know this this binary file is made out of these binary chunks these chunks are basically things like headers and sections headers usually contain meta information that helps the process of execution sections are simply just other chunks of binary data that serve a specific purpose like for example the dot text section has the code that needs to be executed and there's the dot data section which contain initialized variable values when the elf file gets executed it becomes a process and this process has its own memory where all these sections get mapped onto then there's also these different data structures that get allocated on the memory for this program to function properly one of them is stack we'll look at attacking stacks in the future but for now just remember that each process gets its own memory space and it follows some kind of a layout then each of these instructions is read from the dot text section that we talked about which contains the code and then it's executed by the cpu one by one so that's a highly simplified overview of how the l file looks like and also how it executes if you hear the docs barking at this point just remember that it's not coming from the video it's it's all in your head you're you're being compromised your head's just playing tricks on you that's all it is please continue watching the video [Music] now let's take a quick peek inside the elf file i know we've been talking about it but now it's actually time for us to look into it like you know like like like a stalker yeah i've written a simple c program which reads an input from the user and simply outputs uh the same thing with the message let's compile it with gcc we provide source file which is the hello.c and the dash o is for the output file basically the file that's going to be generated by the compiler yeah and also ignore these warnings for now you will learn about them in the upcoming videos but for now just completely ignore them now that we have our executable file let's go ahead and run this we give it some input and we get back the message just as intended let's run strings on this executable file strings is a program that reads the file and outputs only the human readable strings which are present inside the executable file this is actually cool because we can find some strings inside this file like in our case we can find the word hello that we use to print out the message if you want a hexadecimal representation of this file then you can use the command called xxd this will show you a hexadecimal dump of this file and on the left side as you can see we have the hexadecimal bytes of this file and on the right side it's the same but it's ascii also remember that i said elf files have some headers and they list out some sections and stuff like that let's actually check them out there's a program called read elf this will basically parse the elf binary file and outputs this parsed information if we check out the help options we'll see that there's this dash s option which will basically show the sections of a binary so let's go and try that out and surely we do see the sections of course at this point in time we don't really understand what they all mean but it's always fun to poke around also i think it's important to overshoot like this while learning because it's it's going to take your mind to a new territory even if you don't entirely understand the big picture you will still pick up some smaller pieces of this big picture which obviously is going to help you in the future all right that's it for now but i've got a small announcement to make i've created a discord server if you guys have any questions shoot him there myself or kanye west is going to answer your binary questions so that's all for now phone function aka lil endian signing off yeah that's my new rap name by the way all right um i'll see you in the next one peace [Music] [Music] you
Info
Channel: PwnFunction
Views: 184,405
Rating: undefined out of 5
Keywords:
Id: WnqOhgI_8wA
Channel Id: undefined
Length: 8min 34sec (514 seconds)
Published: Fri Mar 12 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.