Domain 3Exploit Dev & AV EvasionCORE

Immunity Debugger Usage

Complete guide to Immunity Debugger for exploit development covering remote debugging setup, essential controls, register analysis, crash reading, memory inspection, and integration with Mona.py.

Domain: Domain 3: Exploit Mechanics & AV Evasion•Updated: 2026-09-01
#immunity-debugger#remote-debugging#reverse-engineering#oscp

Immunity Debugger Usage

Domain: Fixing Exploits (Module 10) | Difficulty: Core

Prerequisites: Understanding of x86 assembly basics, stack memory layout, and the exploitation lifecycle.


Table of Contents

  1. Introduction to Immunity Debugger
  2. Remote Debugging Architecture
  3. Step-by-Step Setup
  4. Essential Debugger Controls
  5. Key Registers and Their Roles
  6. Reading a Crash — Systematic Approach
  7. Memory Dump Window
  8. Stack Window
  9. Breakpoints
  10. Common Debugging Scenarios
  11. Immunity Debugger Plugins
  12. Troubleshooting
  13. Quick Reference Cheat Sheet

1. Introduction to Immunity Debugger

What is Immunity Debugger?

Immunity Debugger is a professional-grade, Windows-based x86 debugger specifically designed for malware analysis and exploit development. It was created by Immunity Inc. (now part of Cymmetria) and has become the de facto standard debugger for OSCP exploit development.

Why Immunity Debugger over OllyDbg?

Both are excellent debuggers, but Immunity Debugger has several advantages for exploit work:

Feature Immunity Debugger OllyDbg
Scripting API Python-based (immunitydebugger module) Limited macro scripting
Remote debugging Built-in Script Server Requires third-party plugins
Plugin ecosystem Rich (Mona.py, etc.) Smaller ecosystem
CLI automation Full programmatic control Manual interaction focused
Crash analysis Structured crash reading Manual interpretation
License Free for non-commercial Free

Core Architecture

Immunity Debugger consists of three main components:

┌─────────────────────────────────────────────────┐
│              Immunity Debugger                   │
│                                                  │
│  ┌─────────────┐  ┌──────────────┐              │
│  │  GUI Front-  │  │  Debugging   │              │
│  │  End         │  │  Engine      │              │
│  │  (Windows)   │  │  (WinAPI)    │              │
│  └──────┬──────┘  └──────┬───────┘              │
│         │                │                       │
│  ┌──────┴────────────────┴───────┐              │
│  │     Python Scripting Engine   │              │
│  │     (immunitydebugger API)    │              │
│  └──────────────────────────────┘              │
└───────────────────┬───────────────────────────┘
                    │  TCP / Localhost
                    │  Port 9999 (default)
┌───────────────────┴───────────────────────────┐
│           Script Server (server.dll)           │
│           Runs on target machine               │
│           Attaches to vulnerable process       │
└───────────────────────────────────────────────┘

When to Use Immunity Debugger

Use Immunity Debugger when you need to:

  1. Remotely debug a vulnerable service on a Windows target
  2. Analyze crash states to determine exploitability
  3. Inspect registers and memory after a buffer overflow
  4. Set breakpoints on specific instructions or memory locations
  5. Step through execution to understand program flow
  6. Integrate with Mona.py for advanced analysis

2. Remote Debugging Architecture

How Remote Debugging Works

Remote debugging allows you to control a debugger on one machine (your attack box) while the debugged process runs on another machine (the target). This is the primary workflow for OSCP exploit development.

Network Topology

graph LR
    A[Attacker Kali Linux] -->|SSH Tunnel / Direct TCP| B[Script Server]
    B -->|WinAPI Debugging| C[Vulnerable Process]
    D[Immunity Debugger GUI] -->|TCP Port 9999| B

    subgraph "Target: Windows VM"
        B[server.dll]
        C[ VulnApp.exe ]
    end

    subgraph "Attacker: Kali VM"
        A[exploit.py / netcat]
        D[Immunity Debugger]
    end

Communication Flow

Step 1:  Script Server starts on target → listens on port 9999
Step 2:  Immunity Debugger on attacker → connects to target:9999
Step 3:  Script Server attaches to / launches target process
Step 4:  Attacker sends exploit payload → process crashes
Step 5:  Script Server pauses execution at crash
Step 6:  Immunity Debugger shows crash state (registers, stack, memory)
Step 7:  Attacker analyzes crash → iterates on exploit

The Script Server (server.dll)

The Script Server is a Windows DLL that:

  • Listens for incoming TCP connections on a configurable port (default: 9999)
  • Accepts debugging commands from the connected client
  • Uses Windows Debugging API (DebugActiveProcess, WaitForDebugEvent, etc.) to control the target process
  • Forwards register states, memory contents, and execution events back to the debugger

Key files in the Script Server package:

File Purpose
server.dll The main Script Server DLL
server.exe Standalone executable that loads and runs the DLL
python27.dll Python runtime (required by the DLL)
immunitydebugger.py Python module for scripting

Security Considerations

⚠️ WARNING: The Script Server listens on a TCP port with no authentication. In a lab environment, this is acceptable. In production, never expose port 9999 to untrusted networks.

Best practices:

  • Use SSH tunnels for encrypted communication
  • Only bind to localhost if debugging locally
  • Kill the Script Server when not in use

3. Step-by-Step Setup

3.1 Installing Immunity Debugger on the Attacker Machine

# On the Windows target VM, copy the Immunity Debugger folder
# from the shared VMware folder to a local directory

# Create the installation directory
New-Item -ItemType Directory -Path "C:\tools\immunity" -Force

# Copy files from VMware shared folder
Copy-Item -Path "\\host\shared\ImmunityDebugger\*" -Destination "C:\tools\immunity\" -Recurse

Option B: SCP / Network Transfer

# From Kali (attacker)
scp -r /path/to/immunity-debugger/ user@target-ip:"C:/tools/immunity/"

3.2 Setting Up the Script Server on the Target

Step 1: Copy Script Server Files

# Navigate to the Script Server directory
cd C:\tools\immunity\server

# Verify all required files are present
Get-ChildItem

Expected files:

server.dll
server.exe
python27.dll

Step 2: Start the Script Server

# Method 1: Start with default port (9999)
C:\tools\immunity\server\server.exe

# Method 2: Start with custom port
C:\tools\immunity\server\server.exe --port 4444

# Method 3: Start in background (minimized)
Start-Process -WindowStyle Hidden "C:\tools\immunity\server\server.exe"

Expected output:

Script Server started.
Listening on port 9999...

Step 3: Verify the Server is Listening

# Check if port 9999 is open
netstat -an | findstr "9999"

# Expected output:
# TCP    0.0.0.0:9999           0.0.0.0:0              LISTENING

3.3 Connecting Immunity Debugger to the Target

Step 1: Launch Immunity Debugger

# On Kali (if using Wine) or directly on a Windows attacker machine
# For OSCP lab, typically run Immunity Debugger on a separate Windows VM
# or use the Windows target itself with local connection

Step 2: Connect to the Script Server

  1. Open Immunity Debugger
  2. Go to Debug → Remote (or press Ctrl+R)
  3. Enter the target IP address and port:
Host: 192.168.1.100    # Target VM IP
Port: 9999              # Script Server port
  1. Click OK

Step 3: Attach to a Process or Launch a New One

Option A: Attach to Running Process

  1. After connecting, go to Debug → Attach (or press Ctrl+A)
  2. Select the target process from the list
  3. Click OK

Option B: Launch New Process

  1. Go to File → Open (or press Ctrl+O)
  2. Browse to the vulnerable executable on the target
  3. Click Open

3.4 Verification Checklist

[ ] Script Server running on target (netstat confirms port 9999)
[ ] Immunity Debugger connected to Script Server
[ ] Target process attached or launched
[ ] Registers window visible and updating
[ ] CPU window showing disassembly
[ ] Stack window populated
[ ] Memory dump window accessible

3.5 SSH Tunnel Alternative (Encrypted Connection)

# On Kali, create SSH tunnel to target
ssh -L 9999:localhost:9999 user@192.168.1.100

# Then connect Immunity Debugger to localhost:9999

4. Essential Debugger Controls

Control Overview

Control Shortcut Description When to Use
Run F9 Continue execution until next breakpoint or crash After setting breakpoints, after stepping
Step Over F8 Execute current instruction; skip into function calls When you don’t need to trace inside a function
Step Into F7 Execute current instruction; enter function calls When you need to trace inside a function
Step Out Shift+F8 Execute until current function returns When you accidentally stepped into a function
Break F12 Immediately pause execution Emergency stop, interrupt infinite loops
Reset Ctrl+Shift+F5 Restart the debugged process When you need to start over
Toggle Breakpoint F2 Set/remove breakpoint at current instruction Marking specific instructions
Go to Address Ctrl+G Jump to a specific memory or code address Navigating to ESP, EIP values

Detailed Control Explanations

Run (F9)

Resumes normal execution. The debugger will stop when:

  • A breakpoint is hit
  • The process crashes (exception)
  • The process exits
  • A hardware breakpoint triggers
Typical workflow:
1. Set breakpoint at vulnerable function entry
2. Press F9 to run
3. Send exploit payload from attacker
4. Debugger breaks at breakpoint
5. Analyze state, set more breakpoints
6. Press F9 again to continue

Step Over (F8) vs. Step Into (F7)

Current instruction:  CALL  strcpy          ; Function call

Step Over (F8):
  → Executes entire strcpy() internally
  → Stops at the NEXT instruction after CALL
  → You see the result, not the internals

Step Into (F7):
  → Jumps INTO strcpy()'s first instruction
  → Lets you trace every instruction inside
  → Use when the function itself is interesting

Visual comparison:

Memory Layout:
┌─────────────────────────────────┐
│ 0x00401000: PUSH EBX            │
│ 0x00401001: MOV EAX, [EBP+8]    │
│ 0x00401004: CALL 0x00402000  ←── Current (CALL instruction)
│ 0x00401009: ADD ESP, 4          │  ← Step Over stops here
│ 0x0040100C: POP EBX             │
└─────────────────────────────────┘

Step Into (F7) jumps to:
┌─────────────────────────────────┐
│ 0x00402000: PUSH EBP       ←─── Step Into stops here
│ 0x00402001: MOV EBP, ESP    │
│ 0x00402003: SUB ESP, 0x40   │
│ ...                         │
│ 0x004020FF: POP EBP         │
│ 0x00402100: RET             │  ← Returns to 0x00401009
└─────────────────────────────────┘

Break (F12)

The emergency stop button. Use when:

  • The program enters an infinite loop
  • You sent too much data and want to pause
  • The debugger seems unresponsive

Reset (Ctrl+Shift+F5)

Completely restarts the debugged process. Use when:

  • You need a clean state
  • The process is in an unrecoverable state
  • You want to re-test from the beginning

💡 Tip: After Reset, all breakpoints are preserved. You can immediately press F9 to run again.

Shortcut Action
Ctrl+G Go to address
Ctrl+F9 Run to cursor (execute until cursor position)
Space Expand/collapse function in CPU view
Enter Follow address in dump/stack
Tab Switch between CPU panels
Ctrl+L Follow in dump (from CPU)
Ctrl+D Follow in stack (from CPU)

5. Key Registers and Their Roles

The x86 Register Set

Immunity Debugger displays all general-purpose registers in the Registers window. Here’s what matters for exploitation:

┌─────────────────────────────────────────────┐
│              REGISTERS WINDOW                │
│                                             │
│  EAX: 00CF42C8  EBX: 00000000               │
│  ECX: 0012FF74  EDX: 7C812A5E [kernel32...] │
│  ESI: 00000000  EDI: 00000000               │
│  EBP: 0012FF18  ESP: 0012FEF0               │
│  EIP: 41414141  ← CRASH! Overwritten!       │
│                                             │
│  CS:001B  SS:0023  DS:0023  ES:0023         │
│  FS:003B  GS:0000                          │
│                                             │
│  EFL: 00000246  ZF=1 OV=0 AC=0...          │
└─────────────────────────────────────────────┘

Instruction Pointer (EIP)

The most important register for exploitation.

  • Purpose: Points to the next instruction to execute
  • Exploitation significance: Controlling EIP = Controlling program flow
  • Crash indicator: If EIP contains your pattern (e.g., 41414141 = AAAA), you have EIP control
Normal EIP:    0x00401234  →  Points to valid code in the program
Overwritten:   0x41414141  →  Points to "AAAA" — crash! (NOP sled territory)
Controlled:    0x7C868F06  →  Points to jmp esp in MSVCRT — shellcode execution!

EIP Control Workflow:

Step 1:  Send cyclic pattern → crash
Step 2:  Read EIP value (e.g., 0x63413563)
Step 3:  Use pattern_offset to find position
Step 4:  Calculate: offset = distance to EIP overwrite
Step 5:  Replace EIP value with shellcode address

Stack Pointer (ESP)

  • Purpose: Points to the top of the stack (most recent data pushed)
  • Exploitation significance: Often contains your shellcode after a crash
  • Why it matters: If you can redirect execution to ESP, your shellcode runs
Stack grows downward:

High addresses →  |              |
                  |   Older data  |
                  |--------------| ← EBP (Frame Pointer)
                  |   Local vars  |
                  |   Return addr | ← Overwritten by EIP control
                  |--------------| ← ESP (Stack Pointer)
                  | SHELLCODE !!! |  ← Your payload lives here
                  |              |
Low addresses  →  |              |

ESP points to the top → your shellcode starts here

Common technique: Use jmp esp or call esp gadget to redirect execution to shellcode location.

Base Pointer (EBP)

  • Purpose: Points to the current stack frame’s base
  • Exploitation significance: Helps identify stack frame boundaries
  • Crash indicator: If EBP contains pattern data, the stack frame is corrupted
Stack Frame Layout:

┌─────────────────────┐
│ [EBP+8]   → Arg 1   │
│ [EBP+12]  → Arg 2   │
├─────────────────────┤
│ [EBP]     → Old EBP │  (Previous frame's base pointer)
│ [EBP-4]   → Local 1 │
│ [EBP-8]   → Local 2 │
│ ...                 │
│ [ESP]     → Top     │
└─────────────────────┘

Data Registers (EAX, EBX, ECX, EDX)

Register Typical Use Exploitation Relevance
EAX Accumulator, return values May point to heap/stack data
EBX Base register, preserved across calls Often stable, good for calculations
ECX Counter, this pointer in C++ May be clobbered by overflow
EDX Data I/O, multiplication May contain module addresses

Practical use in exploitation:

Scenario: EAX points to a string in memory
→ Right-click EAX value → "Follow in Dump"
→ See what data EAX references
→ May reveal useful addresses or strings

Segment Registers (CS, SS, DS, ES, FS, GS)

Generally less important for basic exploitation, but:

Register Purpose
CS Code segment selector
SS Stack segment selector
DS Data segment selector
ES Extra segment selector
FS Thread Environment Block (TEB) on Windows
GS Kernel TEB (ring 0)

FS:[0] points to the TEB (Thread Environment Block), useful for advanced techniques like SEH exploitation.

Flags Register (EFLAGS)

EFL: 00000246
     │ │ │ │ │ │ └─ CF (Carry Flag)
     │ │ │ │ │ └─── PF (Parity Flag)
     │ │ │ │ └───── AC (Adjust Flag)
     │ │ │ └─────── ZF (Zero Flag) ← Important for comparisons
     │ │ └───────── SF (Sign Flag)
     │ └─────────── TF (Trap Flag)
     └───────────── IF (Interrupt Flag)
  • ZF (Zero Flag): Set when a comparison results in zero. Critical for understanding conditional jumps.
  • SF (Sign Flag): Set when result is negative. Used with ZF for signed comparisons.

6. Reading a Crash — Systematic Approach

The Crash Reading Methodology

When a program crashes due to your exploit, follow this structured approach:

flowchart TD
    A[Program Crashes] --> B[Check EIP]
    B --> C{EIP Contains Pattern?}
    C -->|Yes| D[🎉 EIP Control Confirmed!]
    C -->|No| E[Check SEH Chain]
    E --> F{SEH Overwritten?}
    F -->|Yes| G[SEH-Based Exploit Path]
    F -->|No| H[Check Other Registers]
    H --> I[Analyze ESP / EBP]
    I --> J[Look for Partial Overwrites]
    J --> K[Check for SafeSEH / ASLR]
    K --> L[Determine Exploit Strategy]

    D --> M[Find Offset with pattern_offset]
    M --> N[Locate Bad Characters]
    N --> O[Find JMP/CALL Gadgets]
    O --> P[Build Final Exploit]

Step 1: Identify the Crash Type

Look at the exception message in Immunity Debugger:

Exception: ACCESS_VIOLATION - 0xc0000005
  Attempted to read from address 0x41414141

Exception: IN_PAGE_ERROR - 0xc0000006
  Memory page not found at address 0x41414141

Exception: ILLEGAL_INSTRUCTION - 0xc000001d
  Invalid instruction at address 0x41414141
Exception Code Meaning Exploit Implication
0xc0000005 Access Violation Most common — memory access error
0xc0000006 In Page Error Page not present in memory
0xc000001d Illegal Instruction EIP points to invalid opcode
0xc00000fd Stack Overflow Stack buffer too small
0xe06d7363 C++ Exception Application-level exception

Step 2: Check EIP for Control

Registers Window:
EIP: 39684139

→ Convert to ASCII: "9hA9"
→ This is a Metasploit cyclic pattern!
→ EIP is controlled by our input!

Verification process:

  1. Note the EIP value from the crash
  2. Use pattern_offset to determine the exact offset:
# On Kali
/usr/share/metasploit-framework/tools/exploit/pattern_offset.rb -q 39684139

# Output:
# [*] Exact match at offset 200
  1. This means bytes at offset 200-203 overwrite EIP

Step 3: Check ESP for Shellcode Location

ESP: 0012FF58

→ Right-click → "Follow in Dump"
→ Look for your cyclic pattern or shellcode
→ Note the ESP address for later use

What to look for in the dump at ESP:

0012FF58  |  41 41 41 41  41 41 41 41  41 41 41 41  41 41 41 41  | AAAAAAAAAAAAAAAA |
0012FF68  |  41 41 41 41  41 41 41 41  41 41 41 41  41 41 41 41  | AAAAAAAAAAAAAAAA |
...

If you see your pattern/shellcode at ESP, you can use a jmp esp gadget.

Step 4: Check EBP for Stack Frame Corruption

EBP: 43434343

→ ASCII: "CCCC"
→ Stack frame is corrupted
→ Confirms stack-based buffer overflow

Step 5: Examine the Call Stack

Call Stack:
0012FF18  vulnapp.00401234    ; Last valid call
0012FF1C  41414141             ; ← Overwritten return address
0012FF20  42424242             ; ← More overflow data
0012FF24  43434343             ; ← More overflow data

The call stack shows the chain of function calls. Overwritten entries indicate where your overflow data landed.

Step 6: Determine the Exploitation Strategy

Based on your findings:

Decision Tree:

EIP Controlled?
├── Yes → Stack-Based Buffer Overflow
│         ├── Find offset to EIP
│         ├── Find bad characters
│         ├── Find JMP/ESP gadget
│         └── Build exploit with shellcode
│
└── No → Check SEH
          ├── SEH Overwritten?
          │   ├── Yes → SEH-Based Exploit
          │   │         ├── Find offset to SEH
          │   │         ├── Find POP POP RET gadget
          │   │         └── Build SEH exploit
          │   └── No → Check other registers
          │            ├── ESI/EDI controlled?
          │            ├── Partial overwrite possible?
          │            └── Consider heap-based techniques

Complete Crash Reading Example

═══════════════════════════════════════════════════════════
                    CRASH ANALYSIS REPORT
═══════════════════════════════════════════════════════════

Exception:      ACCESS_VIOLATION (0xc0000005)
Module:         vulnapp.exe
Address:        0x41336341

REGISTERS:
  EAX: 00000000
  EBX: 7C809D6E  [kernel32.GetModuleHandleA]
  ECX: 0012FEA0
  EDX: 00401000  [vulnapp.entry]
  ESI: 00000000
  EDI: 00000000
  EBP: 42424242  ← Overwritten! ("BBBB")
  ESP: 0012FEC0
  EIP: 41336341  ← Overwritten! (cyclic pattern)

EIP ANALYSIS:
  Value:  0x41336341
  ASCII:  "Asca"
  Type:   Metasploit cyclic pattern
  Offset: 200 bytes (from pattern_offset)

ESP ANALYSIS:
  Address: 0x0012FEC0
  Content: Cyclic pattern continues
  Shellcode placement: Possible after EIP overwrite

STRATEGY:
  1. Offset to EIP: 200 bytes
  2. Replace EIP with JMP ESP address
  3. Place shellcode after EIP overwrite
  4. Pad with NOP sled before shellcode

EXPLOIT STRUCTURE:
  [200 bytes junk] [4 bytes JMP ESP] [NOP sled] [shellcode] [padding]
═══════════════════════════════════════════════════════════

7. Memory Dump Window

Window Overview

The Memory Dump window displays raw memory contents in both hexadecimal and ASCII formats:

┌─────────────────────────────────────────────────────────────────┐
│  Memory Dump: 0012FEF0                                          │
│                                                                 │
│  0012FEF0  |  41 41 41 41  41 41 41 41  41 41 41 41  41 41 41 41  | AAAAAAAAAAAAAAAA |
│  0012FEF0  |  41 41 41 41  41 41 41 41  41 41 41 41  41 41 41 41  | AAAAAAAAAAAAAAAA |
│  0012FF00  |  42 42 42 42  42 42 42 42  42 42 42 42  42 42 42 42  | BBBBBBBBBBBBBBBB |
│  0012FF10  |  43 43 43 43  43 43 43 43  43 43 43 43  43 43 43 43  | CCCCCCCCCCCCCCCC |
│  0012FF20  |  90 90 90 90  90 90 90 90  90 90 90 90  90 90 90 90  | ................ |
│  0012FF30  |  \x31\xc0\x50\x68\x2f\x2f\x62\x69\x68\x2f\x62\x69\x6e  | 1.Ph//bih/bin   |
│  0012FF40  |  \x54\x68\x31\xc0\x89\xe2\x68\xb0\x02\x00\x00\x89\xe6  | Th1....h........ |
└─────────────────────────────────────────────────────────────────┘

Following Addresses

Action How Result
Follow in Dump Right-click → “Follow in Dump” Jump to that address in memory dump
Follow in Stack Right-click → “Follow in Stack” Jump to that address in stack view
Follow in CPU Right-click → “Follow in CPU” Jump to that address in disassembly
Follow in Disasm Right-click → “Follow in Disasm” Same as above

Searching Memory

Search → Search for... (Ctrl+F)

Options:
├── All modified bytes        → Find all changed memory
├── All executable            → Find all executable regions
├── All executable and writable → Find RWX memory (interesting!)
├── All memory                → Search entire address space
└── Selection                 → Search only highlighted region

Search types:
├── Masked byte               → Specific byte pattern
├── ASCII string              → Text search
├── Unicode string            → Wide character text
└── Hex pattern               → Raw hex bytes

Practical Search Examples

# Find your cyclic pattern in memory
Search → ASCII string → "Aa0Aa1Aa2"

# Find shellcode signature
Search → Masked byte → "\x31\xc0\x50"

# Find a specific module
Search → ASCII string → "kernel32"

Reading Memory Dumps Effectively

Byte-by-Byte Analysis

Address:    0012FEF0
Bytes:      41 41 41 41  41 41 41 41  41 41 41 41  41 41 41 41
ASCII:      AAAAAAAAAAAAAAAA

Each row = 16 bytes
Each group = 4 bytes (dword)
Left column = memory address
Right column = ASCII representation (non-printable shown as '.')

Identifying Shellcode in Memory

Look for these patterns:

NOP Sled:     90 90 90 90  90 90 90 90  ...
XOR EAX,EAX:  31 C0
PUSH:         68 xx xx xx xx
CALL:         FF D0  or  E8 xx xx xx xx
MOV:          B8 xx xx xx xx  (MOV EAX, imm32)

If you see these after your overflow data → shellcode is in place

Memory Regions

Windows Memory Layout (32-bit):

High Memory (4GB)
├── 0xFF000000-0xFFFFFFFF  Kernel space
├── 0x7C000000-0x7FFFFFFF  Loaded modules (ntdll, kernel32, etc.)
├── 0x10000000-0x3FFFFFFF  Heap allocations
├── 0x00400000-0x004FFFFF  Main executable
├── 0x00100000-0x003FFFFF  DLL mappings
└── 0x00010000-0x000FFFFF  Stack (grows downward)
Low Memory (0)

Key insight: Your shellcode on the stack will typically be in the 0x00120000-0x00130000 range.


8. Stack Window

Stack Window Overview

The Stack window shows the current stack contents, with the stack pointer (ESP) highlighted:

┌─────────────────────────────────────────────────────────────┐
│  Stack: 0012FEF0                                             │
│                                                             │
│  0012FED8  |  004010A0  vulnapp.004010A0                    │
│  0012FEDC  |  0012FEE8                                       │
│  0012EEE0  |  00401234  vulnapp.vulnerable_function         │
│  0012FEE4  |  0012FEF8                                       │
│►0012FEE8  |  41414141  ← ESP (Return address overwritten!)  │
│  0012FEEC  |  42424242                                      │
│  0012FEF0  |  43434343                                      │
│  0012FEF4  |  44444444                                      │
│  0012FEF8  |  90909090  ← NOP sled starts here              │
│  0012FEFC  |  90909090                                      │
│  0012FF00  |  31C05068  ← Shellcode begins                  │
└─────────────────────────────────────────────────────────────┘

Understanding Stack Frame Layout

Function Call Stack Frame:

┌──────────────────────────┐  ← Higher addresses
│      Arguments           │  Pushed by caller (right to left)
│      (right to left)     │
├──────────────────────────┤
│   Return Address         │  ← EIP will pop to here on RET
│   (overwritten in BOF)   │
├──────────────────────────┤  ← EBP points here
│   Saved EBP              │  Previous frame's base pointer
├──────────────────────────┤
│   Local Variable 1       │
│   Local Variable 2       │
│   ...                    │  ← ESP moves here during execution
│   Buffer (overflow target)│
└──────────────────────────┘  ← Lower addresses

Stack grows ↓ (toward lower addresses)

Reading the Stack During Exploitation

Identifying the Overflow Boundary

Before overflow:
  0012FEE0  |  00401234  ; Valid return address
  0012FEE4  |  0012FEF8  ; Valid saved EBP
  0012FEE8  |  00000000  ; Local variable (buffer start)
  0012FEEC  |  00000000
  ...

After overflow:
  0012FEE0  |  00401234  ; Still valid (not reached yet)
  0012FEE4  |  41414141  ; ← EBP overwritten!
  0012FEE8  |  42424242  ; ← Return address overwritten!
  0012FEEC  |  43434343  ; Extra overflow data
  ...

Finding Shellcode on the Stack

  1. Note ESP value from registers
  2. Follow ESP in Stack window
  3. Look for your payload data
ESP: 0012FEE8

Stack at ESP:
►0012FEE8  |  90909090  ; NOP sled
  0012FEEC  |  90909090
  0012FEF0  |  90909090
  0012FEF4  |  31C05068  ; Shellcode: XOR EAX,EAX; PUSH ...
  0012FEF8  |  2F2F6269  ; "//bi"
  0012FEFC  |  682F6269  ; PUSH "/bi"
  0012FF00  |  6E546831  ; "nTh1"

Stack Walking

Use Stack Walk to navigate between stack frames:

Right-click in Stack window → Stack Walk

Shows:
├── Frame 0: Current function
├── Frame 1: Calling function
├── Frame 2: Grandparent function
└── ...

This helps you understand the call chain and where the overflow occurred.


9. Breakpoints

Breakpoint Types

Type Shortcut Description Use Case
Software BP F2 Inserts INT 3 (0xCC) at address Break at specific instruction
Hardware BP Right-click → Hardware BP Uses debug registers Break without modifying memory
Memory BP Right-click → Memory BP Break on memory access Break when shellcode is touched
Conditional BP Right-click → Conditional BP Break only when condition met Break on specific register value

Software Breakpoints (F2)

The most common breakpoint type. Works by replacing the first byte of an instruction with 0xCC (INT 3).

Original:   0x00401000: 8B 45 08    MOV EAX, [EBP+8]
With BP:    0x00401000: CC          INT 3 (breakpoint)

When hit:
  → Debugger restores original byte
  → Pauses execution
  → Shows current state

Setting a software breakpoint:

  1. Navigate to the instruction in the CPU window
  2. Press F2 (or click the margin)
  3. A red dot appears next to the instruction

Removing a breakpoint:

  1. Navigate to the instruction with the breakpoint
  2. Press F2 again
  3. The red dot disappears

Hardware Breakpoints

Use debug registers (DR0-DR3) to set breakpoints without modifying memory. Useful when:

  • The memory is read-only
  • You need to break on execution without changing the code
  • Multiple breakpoints needed (up to 4 hardware breakpoints)
Right-click instruction → Hardware Breakpoint →
├── Execute          → Break when instruction is executed
├── Write            → Break when memory is written
└── Read/Write       → Break when memory is accessed

Memory Breakpoints

Break when a specific memory address is accessed:

Scenario: Break when shellcode is executed

1. Note shellcode address: 0x0012FF00
2. Right-click address in dump → Memory Breakpoint → Execute
3. Continue execution (F9)
4. Debugger breaks when CPU tries to execute at 0x0012FF00

Types of memory breakpoints:

Type Triggers When
Execute CPU tries to execute code at this address
Write Any write to this memory location
Read/Write Any access (read or write) to this location

Conditional Breakpoints

Break only when a condition is met:

Example: Break only when EAX == 0x12345678

Right-click instruction → Conditional Breakpoint
Condition: EAX == 0x12345678

Or using Python expression:
dbg.reg('EAX') == 0x12345678

Common conditional breakpoint patterns:

# Break when ESP points to our shellcode region
dbg.reg('ESP') > 0x00120000 and dbg.reg('ESP') < 0x00130000

# Break when EIP enters our controlled region
dbg.reg('EIP') > 0x41414141 and dbg.reg('EIP') < 0x42424242

# Break when a specific string is being processed
dbg.read_memory(dbg.reg('EAX'), 4) == b'/bin'

Breakpoint Management

Breakpoints window (View → Breakpoints):

┌────────────────────────────────────────────────┐
│  Address       Type        Enabled    Module    │
│  00401234      Software     ✓        vulnapp    │
│  00401250      Hardware     ✓        vulnapp    │
│  0012FF00      Memory(Exec) ✓        [stack]   │
│  7C801234      Software     ✗        kernel32   │
└────────────────────────────────────────────────┘

Actions:
├── Enable/Disable individual breakpoints
├── Remove breakpoints
├── Clear all breakpoints
└── Export/Import breakpoint lists

10. Common Debugging Scenarios

Scenario 1: Finding the Offset to EIP

Goal: Determine how many bytes of junk data are needed before overwriting EIP.

Step 1: Generate a unique cyclic pattern
  ┌──────────────────────────────────────────┐
  │ On Kali:                                  │
  │ pattern_create.rb -l 1000 > pattern.txt   │
  │                                           │
  │ In exploit:                               │
  │ buffer = File.read('pattern.txt').unpack('C*') │
  └──────────────────────────────────────────┘

Step 2: Send the pattern to the vulnerable application
  → Application crashes

Step 3: Read EIP value from Immunity Debugger
  → EIP: 0x63413563

Step 4: Find the offset
  ┌──────────────────────────────────────────┐
  │ On Kali:                                  │
  │ pattern_offset.rb -q 63413563            │
  │                                           │
  │ Output:                                   │
  │ [*] Exact match at offset 200            │
  └──────────────────────────────────────────┘

Step 5: Verify with AAAA test
  buffer = 'A' * 200 + 'B' * 4 + 'C' * 796

  → EIP should contain 0x42424242 ("BBBB")
  → Confirmed! Offset = 200

Scenario 2: Finding Bad Characters

Goal: Identify which bytes cannot be sent through the protocol/application.

Step 1: Prepare shellcode with all bytes
  ┌──────────────────────────────────────────┐
  │ badchars =                               │
  │   '\x01\x02\x03\x04\x05\x06\x07\x08'    │
  │   '\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10'    │
  │   ... (all bytes from 0x01 to 0xFF)      │
  │                                          │
  │ Note: \x00 (NULL) is almost always bad   │
  │ Note: \x0a (LF) and \x0d (CR) often bad  │
  └──────────────────────────────────────────┘

Step 2: Send payload with bad character array
  buffer = 'A' * 200 + 'B' * 4 + badchars + shellcode

Step 3: Check memory in Immunity Debugger
  → Follow ESP in Dump
  → Look for missing or modified bytes

Step 4: Compare sent vs. received
  ┌─────────────────────────────────────────┐
  │ Sent:     \x01\x02\x03\x04\x05...       │
  │ Received: \x01\x02\x04\x05...           │
  │                                          │
  │ \x03 is missing! → Bad character        │
  └─────────────────────────────────────────┘

Step 5: Remove bad characters and repeat
  → Iterate until all bytes arrive intact

Common bad characters by protocol:

Protocol Typical Bad Characters
HTTP \x00, \x0a, \x0d
FTP \x00, \x0a, \x0d
SMTP \x00, \x0a, \x0d
Custom binary \x00 (often only NULL)
TFTP \x00

Scenario 3: Finding a JMP ESP Address

Goal: Find a reliable jmp esp instruction to redirect execution to shellcode.

Step 1: Identify loaded modules
  ┌──────────────────────────────────────────┐
  │ View → Executable Modules                 │
  │                                           │
  │ Module          Base      Size    ASLR    │
  │ vulnapp.exe     00400000  10000   No      │
  │ MSVCRT.dll      77BE0000  5F000   No      │
  │ kernel32.dll    7C800000  6B000   Yes     │
  │ ntdll.dll       7C920000  8C000   Yes     │
  └──────────────────────────────────────────┘

  → Target modules WITHOUT ASLR for stable addresses

Step 2: Search for JMP ESP in target module
  ┌──────────────────────────────────────────┐
  │ Method 1: Manual search                  │
  │ Search → Sequence of bytes               │
  │ Enter: FF E4                              │
  │ Search in: MSVCRT.dll                     │
  │                                           │
  │ Method 2: Using Mona.py (recommended)    │
  │ !mona find -s '\xff\xe4' -m MSVCRT.dll   │
  └──────────────────────────────────────────┘

Step 3: Verify the address
  → Right-click result → "Follow in Disasm"
  → Confirm instruction is `jmp esp`
  → Note the address (e.g., 0x77BEC467)

Step 4: Check for bad characters in the address
  → Address: 0x77BEC467
  → Bytes: 77 BE C4 67
  → None are bad characters ✓

Step 5: Use in exploit (little-endian!)
  ┌──────────────────────────────────────────┐
  │ jmp_esp = '\x67\xc4\xbe\x77'             │
  │                                          │
  │ buffer = 'A' * 200 + jmp_esp + ...       │
  └──────────────────────────────────────────┘

Scenario 4: SEH-Based Exploitation

Goal: Exploit when EIP is not directly controllable but SEH chain is overwritten.

Step 1: Check SEH chain
  ┌──────────────────────────────────────────┐
  │ View → SEH Chain                          │
  │                                           │
  │ Address      SE Handler      Next         │
  │ 0012FE50     41414141        0012FE5C  ←── Overwritten!
  │ 0012FE5C     00401234        0012FE68
  │ 0012FE68     7C8796C2        NULL       │
  └──────────────────────────────────────────┘

Step 2: Find offset to SEH record
  → Use pattern_offset on SE Handler value
  → Offset: 152 bytes

Step 3: Find POP POP RET gadget
  ┌──────────────────────────────────────────┐
  │ !mona seh -m vulnapp.exe                 │
  │                                           │
  │ POP POP RET at 0x0040128A                │
  │ 0x0040128A : pop eax | pop ebx | ret      │
  └──────────────────────────────────────────┘

Step 4: Build SEH exploit
  ┌──────────────────────────────────────────┐
  │ buffer = 'A' * 152                       │
  │      + '\x8a\x12\x40\x00'  # POP POP RET │
  │      + '\x90\x90\x90\x90'  # NOP padding │
  │      + shellcode                           │
  └──────────────────────────────────────────┘

  SEH Record Layout:
  ┌─────────────────────┐
  │ Next SEH (4 bytes)  │ ← POP POP RET address
  │ SE Handler (4 bytes)│ ← \x90\x90\x90\x90 (NOPs)
  │ Shellcode           │
  └─────────────────────┘

  Execution flow:
  Exception → SE Handler called → POP POP RET →
  EIP = SE Handler (NOPs) → Slide into shellcode

Scenario 5: Verifying Shellcode Execution

Goal: Confirm that your shellcode is being executed correctly.

Step 1: Set breakpoint at shellcode start
  ┌──────────────────────────────────────────┐
  │ 1. Note shellcode address from ESP       │
  │ 2. Go to address (Ctrl+G)                │
  │ 3. Press F2 to set breakpoint            │
  │ 4. Send exploit payload                  │
  │ 5. Debugger should break at shellcode    │
  └──────────────────────────────────────────┘

Step 2: Step through shellcode
  ┌──────────────────────────────────────────┐
  │ Use F8 (Step Over) to execute            │
  │ instruction by instruction               │
  │                                          │
  │ Watch registers change as expected:      │
  │ - EAX should be set by XOR instructions  │
  │ - Stack should be prepared correctly     │
  │ - Function calls should resolve          │
  └──────────────────────────────────────────┘

Step 3: Check for execution issues
  Common problems:
  ├── Access Violation → Bad memory reference
  ├── Illegal Instruction → Bad character corrupted opcode
  ├── Wrong register state → Shellcode assumption violated
  └── API hash mismatch → Wrong module loaded

11. Immunity Debugger Plugins

Plugin System Overview

Immunity Debugger supports Python plugins that extend its functionality. Plugins are loaded from the plugins directory.

Immunity Debugger Directory:
├── immunitydebugger.exe
├── server/
├── plugins/
│   ├── mona.py          ← Most important plugin
│   ├── commandshell.py
│   └── ...
└── pyimm32.py

Mona.py — The Essential Plugin

Mona.py is the most important plugin for Immunity Debugger. Created by Corelan, it provides powerful automation for exploit development.

Installation

1. Download mona.py from https://github.com/corelan-tech/mona
2. Place mona.py in the Immunity Debugger plugins/ directory
3. Restart Immunity Debugger
4. Verify: Type "!mona" in the command line at the bottom

Essential Mona Commands

┌─────────────────────────────────────────────────────────────────┐
│                    MONA.PY COMMAND REFERENCE                     │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  !mona config -set workingfolder c:\mona\%p                     │
│      Set working directory for Mona output                      │
│                                                                 │
│  !mona compare -f base.bin -f after.bin                        │
│      Compare two memory dumps to find changes                   │
│                                                                 │
│  !mona find -s '\xff\xe4' -m MSVCRT.dll                         │
│      Find JMP ESP in a module                                   │
│                                                                 │
│  !mona find -s '\x6a\x00\x5f\x54' -m *.dll                     │
│      Find specific byte sequence in all DLLs                     │
│                                                                 │
│  !mona seh -m vulnapp.exe                                       │
│      Find POP POP RET gadgets for SEH exploitation               │
│                                                                 │
│  !mona modules                                                  │
│      List all loaded modules with ASLR/SafeSEH status            │
│                                                                 │
│  !mona got -m MSVCRT.dll                                        │
│      Dump the Global Offset Table for a module                  │
│                                                                 │
│  !mona jmp -r esp -m MSVCRT.dll                                 │
│      Find all JMP ESP in a module                               │
│                                                                 │
│  !mona call -r eax -m MSVCRT.dll                                │
│      Find all CALL EAX in a module                              │
│                                                                 │
│  !mona noasp -m MSVCRT.dll                                      │
│      Find instructions without ASCII printable characters       │
│                                                                 │
│  !mona egg -t ABCD -cpb '\x00'                                  │
│      Generate egg hunter with specified tag                     │
│                                                                 │
│  !mona bytearray -b "\x00" -cpb "\x00\x0a\x0d"                 │
│      Generate byte array excluding bad characters               │
│                                                                 │
│  !mona suggest -t cmd.exe                                       │
│      Suggest shellcode for a target                              │
│                                                                 │
│  !mona got -m *.dll -s "VirtualAlloc"                           │
│      Find specific API across all modules                        │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Mona Workflow for Exploit Development

Phase 1: Module Analysis
  !mona modules
  → Identify modules without ASLR and SafeSEH

Phase 2: Gadget Hunting
  !mona jmp -r esp -m <module_without_aslr>
  → Find JMP ESP for redirection

Phase 3: Bad Character Verification
  !mona compare -f base.bin -f after.bin
  → Compare memory before/after to find bad chars

Phase 4: SEH Analysis (if needed)
  !mona seh -m <module>
  → Find POP POP RET gadgets

Phase 5: Final Verification
  !mona config -set followcalls 1
  → Track call chains during debugging

Other Useful Plugins

Plugin Purpose
commandshell.py Execute shell commands from debugger
timediff.py Measure time between events
metasploit.py Integration with Metasploit

12. Troubleshooting

Connection Failures

Problem: Cannot connect to Script Server

Error: "Connection refused" or "Connection timed out"

Solutions:
├── 1. Verify Script Server is running
│      netstat -an | findstr "9999"
│
├── 2. Check firewall settings
│      Windows Firewall may block port 9999
│      → Add inbound rule for TCP 9999
│
├── 3. Verify correct IP address
│      ipconfig on target → use correct IP
│
├── 4. Check port number matches
│      If started with --port 4444, connect to 4444
│
└── 5. Try localhost connection first
       Debug → Remote → Host: 127.0.0.1

Problem: Script Server crashes on startup

Solutions:
├── 1. Check Python runtime
│      python27.dll must be in the same directory
│
├── 2. Run as Administrator
│      Right-click server.exe → Run as Administrator
│
├── 3. Check for port conflicts
│      Another process may be using port 9999
│      → Use a different port: server.exe --port 5555
│
└── 4. Verify file integrity
       Re-copy files from the source

Debugging Issues

Problem: Debugger shows “Access Denied” when attaching

Solutions:
├── 1. Run Immunity Debugger as Administrator
├── 2. Run Script Server as Administrator
├── 3. Target process may be protected
│      → Try launching from debugger instead of attaching
└── 4. Check if another debugger is attached
       → Only one debugger can attach at a time

Problem: Breakpoints not hitting

Solutions:
├── 1. Verify the address is correct
│      → Check if the module is loaded at the expected base
│
├── 2. Check for ASLR
│      → Module base may change between runs
│      → Use !mona modules to check ASLR status
│
├── 3. Verify the code path is reached
│      → Set breakpoint at function entry first
│      → Step through to see if your target is reached
│
└── 4. Check for compiled optimizations
       → Release builds may inline or remove functions

Problem: Shellcode not executing

Solutions:
├── 1. Verify JMP ESP address is correct
│      → Follow the address in disassembly
│      → Confirm it's actually "jmp esp"
│
├── 2. Check for bad characters in address
│      → Each byte of the address must not be a bad char
│      → Try alternative JMP ESP addresses
│
├── 3. Verify shellcode is at ESP
│      → After crash, check ESP in dump window
│      → Shellcode should be visible at ESP
│
├── 4. Check DEP/NX
│      → Stack may be non-executable
│      → Use !mona modules to check DEP status
│      → Consider alternative exploitation techniques
│
└── 5. Step through shellcode manually
       → Set BP at shellcode start
       → Use F8 to step through
       → Watch for access violations

Common Error Messages

Error Cause Fix
Access Violation at 0x00000000 NULL pointer dereference Check for NULL bad char in shellcode
Access Violation at 0x41414141 EIP overwritten with ‘A’ Normal — means EIP control achieved
Module not found DLL not loaded Verify module is loaded with !mona modules
Breakpoint already exists Duplicate BP Remove existing BP first
Cannot access memory Invalid address Verify address is in valid range

13. Quick Reference Cheat Sheet

Essential Shortcuts

┌──────────────────────────────────────────────────────────┐
│                  IMMUNITY DEBUGGER SHORTCUTS              │
├──────────────┬───────────────────────────────────────────┤
│  F2          │ Toggle breakpoint at cursor               │
│  F7          │ Step Into (trace into function calls)      │
│  F8          │ Step Over (skip function calls)            │
│  F9          │ Run (continue execution)                  │
│  F12         │ Break (pause execution immediately)       │
│  Ctrl+G      │ Go to address                             │
│  Ctrl+F9     │ Run to cursor                             │
│  Ctrl+A      │ Attach to process                         │
│  Ctrl+O      │ Open file                                 │
│  Ctrl+R      │ Remote connection                         │
│  Ctrl+L      │ Follow in dump                            │
│  Ctrl+D      │ Follow in stack                           │
│  Shift+F8    │ Step Out (return from function)            │
│  Ctrl+F2     │ Restart debugged process                  │
└──────────────┴───────────────────────────────────────────┘

Exploit Development Workflow

┌─────────────────────────────────────────────────────────────┐
│              EXPLOIT DEVELOPMENT CHECKLIST                   │
│                                                             │
│  □ 1. Crash the application                                 │
│  □ 2. Connect Immunity Debugger remotely                    │
│  □ 3. Read EIP — confirm control                            │
│  □ 4. Find offset with pattern_offset                       │
│  □ 5. Verify offset with AAAA/BBBB test                     │
│  □ 6. Find bad characters                                   │
│  □ 7. Identify target module (no ASLR/SafeSEH)              │
│  □ 8. Find JMP ESP / POP POP RET gadget                     │
│  □ 9. Verify gadget address has no bad chars                │
│  □ 10. Build exploit with shellcode                         │
│  □ 11. Test and iterate                                     │
│  □ 12. Verify shellcode execution in debugger               │
│  □ 13. Test on target without debugger                      │
└─────────────────────────────────────────────────────────────┘

Memory Address Ranges (32-bit Windows)

┌─────────────────────────────────────────────────────────────┐
│              TYPICAL MEMORY LAYOUT                           │
│                                                             │
│  0x7C000000 - 0x7FFFFFFF   System DLLs (ntdll, kernel32)   │
│  0x10000000 - 0x3FFFFFFF   Heap allocations                 │
│  0x00400000 - 0x004FFFFF   Main executable                  │
│  0x00100000 - 0x003FFFFF   DLL mappings                     │
│  0x00010000 - 0x000FFFFF   Stack (grows ↓)                  │
│                                                             │
│  Shellcode on stack: ~0x00120000 - 0x00130000               │
│  JMP ESP gadgets:      ~0x77BE0000 - 0x77C40000 (MSVCRT)   │
└─────────────────────────────────────────────────────────────┘

Mona Quick Commands

!mona modules                    # List modules
!mona jmp -r esp -m <module>     # Find JMP ESP
!mona seh -m <module>            # Find POP POP RET
!mona find -s '<bytes>' -m <mod> # Find byte sequence
!mona compare -f a.bin -f b.bin  # Compare dumps
!mona bytearray -cpb '\x00\x0a'  # Generate byte array

Appendix A: Immunity Debugger Python API

Immunity Debugger exposes a Python API for scripting. Here are the most useful functions:

import debug

# Get register values
eip = debug.reg('EIP')
esp = debug.reg('ESP')
ebp = debug.reg('EBP')

# Read memory
data = debug.read_memory(esp, 100)  # Read 100 bytes at ESP

# Write memory
debug.write_memory(address, data)

# Set breakpoint
debug.set_breakpoint(address)

# Remove breakpoint
debug.remove_breakpoint(address)

# Get module information
modules = debug.get_modules()
for mod in modules:
    print(f"{mod.name}: base=0x{mod.base:x}, size=0x{mod.size:x}")

# Find pattern in memory
address = debug.find_pattern(b'\x90\x90\x90\x90', 0x00010000, 0xFFFFF000)

# Get current instruction
instruction = debug.get_instruction(eip)
print(f"Current instruction: {instruction.mnemonic} {instruction.opnds}")

# Step execution
debug.step_over()
debug.step_into()

# Continue execution
debug.run()

# Pause execution
debug.break_execution()

Example: Automated Crash Analysis Script

import debug
import struct

def analyze_crash():
    """Automated crash analysis after exploit is sent."""

    # Wait for crash
    debug.wait_for_exception()

    # Get registers
    eip = debug.reg('EIP')
    esp = debug.reg('ESP')
    ebp = debug.reg('EBP')

    print(f"=== CRASH ANALYSIS ===")
    print(f"EIP: 0x{eip:08x} ({struct.pack('<I', eip)})")
    print(f"ESP: 0x{esp:08x}")
    print(f"EBP: 0x{ebp:08x}")

    # Check if EIP is controlled (contains pattern)
    eip_bytes = struct.pack('<I', eip)
    if all(c in b'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
           for c in eip_bytes):
        print("[+] EIP appears to be controlled by cyclic pattern!")

    # Read memory at ESP
    esp_data = debug.read_memory(esp, 32)
    print(f"\nMemory at ESP:")
    print(f"  {esp_data.hex()}")
    print(f"  {esp_data}")

    # List modules
    print(f"\nLoaded modules:")
    for mod in debug.get_modules():
        print(f"  {mod.name}: 0x{mod.base:08x} - 0x{mod.base + mod.size:08x}")

# Run analysis
analyze_crash()

Appendix B: Comparison with Other Debuggers

Feature Immunity Debugger x64dbg WinDbg GDB
Platform Windows (x86) Windows (x86/x64) Windows Linux/Windows
Remote Debug Script Server Built-in Kernel/User mode GDBServer
Scripting Python JavaScript/Python Commands/Python Python
Plugin System Yes (Mona.py) Yes Extensions Plugins
GUI Yes Yes CLI/GUI CLI
OSCP Relevance Primary Alternative Advanced Linux targets
Learning Curve Medium Medium Steep Steep

Appendix C: Further Resources

Official Documentation

Practice Targets

  • VulnServer (OSCP lab)
  • EasyRPC (OSCP lab)
  • Overflow 1/2/3/4 (OSCP lab)
  • FTPD 6.0 (OSCP lab)
  • “The Art of Memory Forensics” — Stack and memory concepts
  • “Hacking: The Art of Exploitation” — x86 assembly and exploitation
  • Corelan Team tutorials — Mona.py and Immunity Debugger guides

Key Takeaway: Immunity Debugger is your primary tool for Windows exploit development in OSCP. Master the remote debugging workflow, learn to read crashes systematically, and integrate Mona.py for efficient gadget hunting. The ability to quickly analyze a crash state and iterate on your exploit is what separates successful exploit development from trial-and-error guessing.


Last Updated: 2026-09-01 | OSCP Module 10: Fixing Exploits