Basic Shellcode Exploitation

Francesco Pastore
5 min readOct 9, 2022

Shellcode is one of the main techniques used in binary challenges, usually to obtain a reverse shell.

In this tutorial, we will see what is a shellcode and how to use it by looking at a simple example.

But first, there are some questions to ask.

Shellcode, syscall, and other awesome stuff

What is a shellcode?

A shellcode is a sequence of assembly instructions. Usually, it is inserted in memory and then executed by exploiting a vulnerability.

It is called shellcode because at the beginning it was used only to obtain a shell. Nowadays, shellcodes are used to execute whatever sequence of instructions.

When is it useful to use a shellcode?

A shellcode is useful when you have a vulnerability but nothing to use inside the binary. For example, you could have found a buffer overflow but there isn’t any function to call.

What is necessary for a shellcode exploit?

To write a shellcode you need an executable place in memory and you must know the start address of it. It could be everywhere and the address could be leaked during the execution.

--

--

Francesco Pastore

An engineering student in Milan and a web developer for an IT company. Write about programming and cybersecurity topics.