![]() |
|
[Tutorial] A beginners guide to Shellcoding on Linux w/ Screenshots - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Hacks, Exploits, and Various Discussions (https://hackforums.net/forumdisplay.php?fid=45) +--- Forum: Grayhat • Purple Team • Hybrid Security (https://hackforums.net/forumdisplay.php?fid=449) +---- Forum: Beginner Hacking (https://hackforums.net/forumdisplay.php?fid=4) +----- Forum: Hacking Tutorials (https://hackforums.net/forumdisplay.php?fid=47) +----- Thread: [Tutorial] A beginners guide to Shellcoding on Linux w/ Screenshots (/showthread.php?tid=3119557) |
[Tutorial] A beginners guide to Shellcoding on Linux w/ Screenshots - Illicit - Dec 25, 2012 0x01 - Introduction Shellcode is the machine code payload used to perform task's through Buffer Overflow Exploit's.Common shellcode payloads include : the ability to send root commands from a less privileged user (local root)or a remote TCP Netcat shell. Shellcode takes the following form : ![]() 0x02 - Tools First of all you will need to make sure you have the following programs ready: • nasm (Assembly Compiler, should be installed by default.Check by typing 'nasm' into the command-line.) • codetester.c (A small program you can use to test your shellcode.Just replace 'SHELL CODE HERE' with your shellcode and then compile and run it. Source: (Click to View) • objdump (You should have this by default) 0x03 - Creating your ASM code Shellcode is usually compiled from Assembly , and in this tutorial I will explain how to do it with Assembly. [First of all you should know the basic's of assembly if not check out the Assembly Tutorial in the assembly forum.] Let's start with something simple.A piece of Hello World ASM. PHP Code To compile this run the following commands: nasm -f elf test.asm ld -o test test.o And you will have an executable file called 'test' which will output : Hello World [Note: The two 10's on either side are merely creating a newline and are not necessary.] 0x04 - Turning ASM to shellcode The method I use to convert ASM to shellcode is quite tedious but is the only one I got to work.If you would like to use a tool check out the bin2shell program. First of all after you have compiled you assembly code into an executable run this command: objdump -d <executable-name> And you should receive an output similar to this: Spoiler (Click to View) Now just extract the code in the middle and add a \x for example: 8048079: cd 80 int $0x80 becomes: \xcd\x80 Now just do this for each line until you have your shellcode. 0x04 - Testing your Shellcode To test you shellcode use the previous program like this: PHP Code 0x05 - Conclusion Now that you understand the method used to create shellcode start experimenting. Please remember that the structure used for shellcode in assembly is essential because of the way BoF attacks are exploited. Enjoy and please leave feedback! 🤝 * - maher84 - Dec 25, 2012 thank you redhat I just started learning shellcoding * - Illicit - Dec 25, 2012 (Dec 25, 2012 07:13 AM)maher84 Wrote: thank you redhat I just started learning shellcoding Hope this helped :P And good luck with your shellcoding ! * - Kate Libby - Dec 25, 2012 I decided to show this tutorial to a dear friend of mine, Who?. He provided some comments you may want to hear: Next time write a tutorial on a subject you can fucking understand, you clearly have no idea on what you are talking about. For example: Quote:Shellcode is the machine code payload used to perform task's through Buffer Overflow Exploit's.Common shellcode payloads include : the ability to send root commands from a less privileged user (local root)or a remote TCP Netcat shell. Wait what? No, that is bullshit. What you are talking about in this tutorial is about assembly encoding and that is not at all related to shellcode. And besides, shellcode will not magically give you root or any extra access to a system. And the rest of this "amazing" tutorial is just copypasted bits of code. * - www_webhead - Dec 25, 2012 Nice bro i am just start to learn shell coding thx mate.. * - Illicit - Dec 25, 2012 Good luck with shellcoding then :P & Glad you liked this tutorial. * - Kate Libby - Dec 25, 2012 (Dec 25, 2012 07:21 AM)Red_Hat Wrote: >Wait what? No, that is bullshit. What you are talking about in this tutorial is about assembly encoding and that is not at all related to shellcode. And besides, shellcode will not magically give you root or any extra access to a system. Who? would like to point out that you clearly don't even know what shellcode is. Code char code[] =That is just a hexadecimal representation of machine code, nothing special. Now, why do you decide to encode it in such a way is beyond me. It doesn't matter in what form the machine code is and how it is encoded, as long as it can be decoded to an executable format. * - Illicit - Dec 25, 2012 (Dec 25, 2012 07:29 AM)Kate Libby Wrote: Who? would like to point out that you clearly don't even know what shellcode is. Why did I encode this?In order to create a payload for BoF vulnerabilities. duh. * - Kate Libby - Dec 25, 2012 (Dec 25, 2012 07:32 AM)Red_Hat Wrote: Why did I encode this?In order to create a payload for BoF vulnerabilities. This just proves that you have no idea on what you are talking about. * - alexlandonflicksss - Dec 25, 2012 Bookmarked this tutorial...will read this when I get time....thanks in advance... * - Illicit - Dec 25, 2012 (Dec 25, 2012 07:34 AM)alexlandonflicksss Wrote: Bookmarked this tutorial...will read this when I get time....thanks in advance... Enjoy it later! :P Thanks for bookmarking it! * - Jae - Dec 25, 2012 Didn't you make a thread on how to make shell-code a day before you released this? - https://hackforums.net/showthread.php?tid=3117382 The point of a tutorial is to help people in depth with a certain task. Spend more time learning and then come back and write a detailed tutorial to help others with what you know. 🙂 * - Phizo - Dec 25, 2012 You've been asking all these questions so you can write a tutorial on something you lack experience in? Everything Who? has pointed out is accurate and your method of writing the shellcode is ridiculous; why would you write it out manually? Someone already wrote a something in C to extract the hex from objdump and write it in the appropriate format. PHP Code If you want to be properly educated I suggest reading this. * - puremindd - Dec 25, 2012 (Dec 25, 2012 07:32 AM)Red_Hat Wrote: Why did I encode this?In order to create a payload for BoF vulnerabilities. AHAHHAHAA HOLYFUCK .. you just made my day, you fucking moron <3 (Dec 25, 2012 06:19 PM)Jae Wrote: Didn't you make a thread on how to make shell-code a day before you released this? - https://hackforums.net/showthread.php?tid=3117382 Shut the fuckup and go post some more botnet sources skrub. |