What is Polymorphism?
The polymorphism means the ability of an object to take on many forms. In computer science, the term polymorphism also means the ability of different objects/codes to respond in a unique way to the same functionality.
Shellcode Selection
I will use the following shellcode from the Shell-Storm to demonstrate the polymorphic shellcode:
- sys_exit(0) — http://shell-storm.org/shellcode/files/shellcode-623.php
- /bin/sh — http://shell-storm.org/shellcode/files/shellcode-752.php
- /bin/cat /etc/passwd — http://shell-storm.org/shellcode/files/shellcode-571.php
1) sys_exit(0)
The original shellcode from the Shell-Storm is as following:
/*
Name : 8 bytes sys_exit(0) x86 linux shellcode
Date : may, 31 2010
Author : gunslinger_
Web : devilzc0de.com
blog : gunslinger.devilzc0de.com
tested on : linux debian
*/char *bye=
"\x31\xc0" /* xor %eax,%eax */
"\xb0\x01" /* mov $0x1,%al */
"\x31\xdb" /* xor %ebx,%ebx */
"\xcd\x80"; /* int $0x80 */int main(void)
{
((void (*)(void)) bye)();
return 0;
}