S09_Shellcode
S09_Shellcode
Outline
• Challenges in writing shellcode
• Two approaches
• 32-bit and 64-bit Shellcode
Introduction
• In code injection attack: need to inject binary code
• Shellcode is a common choice
• Its goal: get a shell
– After that, we can run arbitrary commands
• Written using assembly code
Writing a Simple Assembly Program
• Invoke exit()
• Compilation (32-bit)
…. code omitted …
This address is
pushed into stack
by “call”
Data Preparation
• Putting a zero at the end of the shell string