![]() |
|
[TuT] [HQ] Converting ASM to Shellcode | What is ASM | What is shellcode [HQ] [/TuT] - 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: [TuT] [HQ] Converting ASM to Shellcode | What is ASM | What is shellcode [HQ] [/TuT] (/showthread.php?tid=3388737) |
[TuT] [HQ] Converting ASM to Shellcode | What is ASM | What is shellcode [HQ] [/TuT] - lillix - Apr 6, 2013 In this tutorial we will cover
What is ASM? An assembly programming language is a low-level programming language for computers, be it a mobile device, a microwave, or a personal computer. Every single programmed piece of technology on the planet contains somewhat a large quantity of machine code instruction, which, obviously instructs the piece of technology to do certain things. Machine code is eventually converted into an executable file by a compiler, although other information sources would refer to these as an 'assembler', although if you are just starting, the two objects contain the exact same characteristics. Low level languages have been around for over 60 years, in contrast to high level programming languages, which have been around only 10-20 years. What is shellcode? Shellcode is a small piece of code, rarely used in the programming world, known to more hackers than the 'average joe'. Shellcode can be used to take advantage of exploits, hereby being called the 'payload'. Exploits, payloads and vulnerabilities are separate things: A vulnerability is a flaw in a machine/application's programming. An exploit is a piece of code that someone has discovered that can take advantage of the vulnerability at hand. A payload is a packet which is injected into the exploit, then giving the attacker control of the machine (s)he has compromised. Shellcode isn't always used for bad intentions.
Local shellcode is where an attacker has limited permissions to a machine, but can identify and exploit a possible vulnerability, and if this exploit succeeds, the attacker's permission is raised to a higher level, allowing (s)he to apply more damage to the machine.
Remote shellcode is where the attacker doesn't have local & direct access to the machine (s)he is attempting to access, and instead uses an internet connection to accomplish the goal (s)he is trying to achieve. These type of attacks usually take place through GET and POST packets being distributed back and forth. These packets are malicious and contain code that spawns a shell on the attacker's victim. Windows shell coding (coming soon) Linux shell coding Requirements:
To test our shell code once we have obtained it, we will have to make a new C++ project, so go ahead and make that, then in your main class, put this inside it: Code #include <fcntl.h>If you run it now, it won't work, it will stop working upon the time when it finds no hex's in the char array. To start off easy, we'll just make an exit function. Code ;exit.asmThe above code is ASM, although these languages are hard to comprehend, the power behind them is unbelievable. Open up a text editor, and paste the code in, and save the file as a .asm. Once you have saved the file, open a terminal window, and navigate to where you saved the file. Once you are in the file's directory; execute the following command: Code nasm -f elf filename.asm; ld -o filename filename.o; objdump -d filename;If you executed that command correctly, you should now see a table of hex codes that looks like the following: Code 08048080 <_start>:If you see that, then you're going the right way! The hex numbers: Code b0 01 31 db cd 80Code \xb0\x01\x31\xdb\xcd\x80And remember our char array called shell code? Insert this shell code into that char array, then run your program. If you have successfully undertaken the tasks, you shouldn't be getting any errors. If you're using code::blocks and your getting an error, change your compiler settings to default and you should be fine. Thanks for reading. EDIT: For shellcode exploits, I recommend you venture to http://exploit-db.com That's it for tonight, I'll add more tomorrow when I wake up. * - Makaveli_Tupac - Apr 6, 2013 Thanks for diz you sexi beast, Luv'd eet <3 * - 2564lert - Apr 6, 2013 Thanks, this helped a lot, keep it up! * - ▄█▀ █─█ █ ▀▄▀ █▀█ - Apr 7, 2013 Thanks alot, keep your work up man! ;) * - mibbzz - May 23, 2013 Woah thanks for this, it helped me out A TON!! * - Sadlarry404 - May 23, 2013 Code section .textnasm -f elf /path/to/file.asm ld -o name /path/to/file.o Don't run unless you feel like rebooting your system. * - xMannyG - May 25, 2013 Thanks for the amazing tutorial and the work you went through to make it. :) Vouch Very HQ user. * - curiousclocker - May 25, 2013 How to convert shell code to EXE? Or How to use Shell Code? * - lillix - Jun 1, 2013 (May 25, 2013 10:53 PM)curiousclocker Wrote: How to convert shell code to EXE? Or How to use Shell Code? How to use shell code. If you want a shell code to EXE application, I suggest you look here: http://zeltser.com/reverse-malware/convert-shellcode.html * - ИYYИ - Jun 9, 2013 Nice tutroial <3. Enjoyed it. Hope this helps some peeps. * - Makaveli_Tupac - Jun 9, 2013 Thanks for this. Hope it helps some people. -Makaveli_Tupac * - lillix - Jun 9, 2013 (Jun 9, 2013 05:38 AM)bdfrady1234 Wrote: Nice tutroial <3. Enjoyed it. Thanks. I'll add more to the tutorial later. * - яєaηıмaтıoη™ - Jul 6, 2013 You always have such HQ tutorials, mate! Gotta make sure I don't miss any! 😯 * - Eric Berne - Jul 6, 2013 Nice introduction to shellcodes, doesn't miss out the little details and explains them unlike some other tutorials. Personally I am interested in Windows part and I hope you update it. Anyhow, great tutorials mate. |