mirror of
https://github.com/andwati/pwnforfunandprofit.xyz.git
synced 2026-11-22 09:18:45 +00:00
feat: Establish CI pipeline, pre-commit hooks, and code quality linting for improved developer experience.
This commit is contained in:
@@ -10,6 +10,6 @@ I believe this is the start of something great.
|
||||
|
||||
Welcome to **pwnforfunandprofit**, your new home for all things binary exploitation, reverse engineering, and offensive security. If you've ever felt the thrill of solving a complex puzzle, the satisfaction of understanding how something truly works, or the urge to peek behind the digital curtain, then you're in the right place.
|
||||
|
||||
In a world increasingly built on code, understanding its vulnerabilities is not just a niche skill; it's a superpower. Here, we're not just reading about exploits; we're *crafting* them. We're not just looking at binaries; we're *disassembling* them. And we're not just talking about offensive security; we're *doing* it.
|
||||
In a world increasingly built on code, understanding its vulnerabilities is not just a niche skill; it's a superpower. Here, we're not just reading about exploits; we're _crafting_ them. We're not just looking at binaries; we're _disassembling_ them. And we're not just talking about offensive security; we're _doing_ it.
|
||||
|
||||
My mission is simple yet ambitious: to transform the daunting landscapes of low-level security into accessible, engaging, and ultimately, empowering knowledge. Whether you're aiming to land that dream cybersecurity role, dominate CTF leaderboards, uncover critical bugs, or satisfy a deep intellectual curiosity, we're here to guide you.
|
||||
My mission is simple yet ambitious: to transform the daunting landscapes of low-level security into accessible, engaging, and ultimately, empowering knowledge. Whether you're aiming to land that dream cybersecurity role, dominate CTF leaderboards, uncover critical bugs, or satisfy a deep intellectual curiosity, we're here to guide you.
|
||||
|
||||
@@ -22,7 +22,7 @@ Big-Endian (BE): The Most Significant Byte (MSB) is stored first, at the lowest
|
||||
|
||||
If you’re attacking an embedded device, router, or IoT target, it might be Big-Endian. Always confirm the target architecture and ABI. Common mistakes when cross-compiling or reusing gadgets:
|
||||
|
||||
Using x86/x86\_64 gadgets and packers on a MIPS/PowerPC target (different endianness and instruction set) will not work.
|
||||
Using x86/x86_64 gadgets and packers on a MIPS/PowerPC target (different endianness and instruction set) will not work.
|
||||
|
||||
pwntools and other frameworks allow you to set `context.arch` and `context.endian` So packers and disassemblers behave correctly.
|
||||
|
||||
@@ -32,7 +32,7 @@ Run the small C program above on the target if you have code execution. Use `rea
|
||||
|
||||
In GDB, examine the memory representation of a known constant or pointer. Put a known value in a register or memory, and inspect the byte order with `x/4xb address`.
|
||||
|
||||
```
|
||||
```gdb
|
||||
(gdb) p/x 0x41424344
|
||||
$1 = 0x41424344
|
||||
(gdb) set {int}0x601000 = 0x41424344
|
||||
@@ -40,7 +40,7 @@ $1 = 0x41424344
|
||||
0x601000: 0x44 0x43 0x42 0x41 # little-endian: ‘DCBA’
|
||||
```
|
||||
|
||||
# Debugging tips when an exploit “looks right” but crashes
|
||||
## Debugging tips when an exploit “looks right” but crashes
|
||||
|
||||
Print the raw payload bytes you are sending, compare with what the target receives (packet capture or logging), and what the target’s memory shows in a debugger.
|
||||
|
||||
@@ -54,25 +54,25 @@ Use tool packing (`struct.pack`, `pwntools`) instead of hand-reversing where pos
|
||||
|
||||
If attacking over the network, confirm whether fields are consumed in network byte order.
|
||||
|
||||
# Short checklist for exploit authors
|
||||
## Short checklist for exploit authors
|
||||
|
||||
* Confirm target architecture (x86, x86\_64, MIPS, ARM, PowerPC).
|
||||
* Confirm endianness (LE or BE).
|
||||
* Use correct pointer width (`p32` vs `p64`) and pack accordingly.
|
||||
* Use library packing (`struct`, `pwntools`) to avoid manual reversal mistakes.
|
||||
* For network services, encode multi-byte protocol fields in network (big-endian) byte order unless the protocol documentation says otherwise.
|
||||
* Check struct padding and alignment on the target.
|
||||
* Inspect the target’s memory with a debugger to verify the actual byte layout.
|
||||
- Confirm target architecture (x86, x86_64, MIPS, ARM, PowerPC).
|
||||
- Confirm endianness (LE or BE).
|
||||
- Use correct pointer width (`p32` vs `p64`) and pack accordingly.
|
||||
- Use library packing (`struct`, `pwntools`) to avoid manual reversal mistakes.
|
||||
- For network services, encode multi-byte protocol fields in network (big-endian) byte order unless the protocol documentation says otherwise.
|
||||
- Check struct padding and alignment on the target.
|
||||
- Inspect the target’s memory with a debugger to verify the actual byte layout.
|
||||
|
||||
# Final thoughts
|
||||
## Final thoughts
|
||||
|
||||
Endianness is simple in concept but vital in practice. For most modern exploit work, you’ll be on x86\_64 (Little-Endian), so make it a habit to pack addresses in reverse byte order relative to how you read them in a disassembler. Use `pwntools`, `struct`, or equivalent to do the packing for you, but keep in mind *why* bytes are reversed; that understanding is what will let you debug the next crash quickly and confidently.
|
||||
Endianness is simple in concept but vital in practice. For most modern exploit work, you’ll be on x86*64 (Little-Endian), so make it a habit to pack addresses in reverse byte order relative to how you read them in a disassembler. Use `pwntools`, `struct`, or equivalent to do the packing for you, but keep in mind \_why* bytes are reversed; that understanding is what will let you debug the next crash quickly and confidently.
|
||||
|
||||
Recommended reading:
|
||||
|
||||
* <https://betterexplained.com/articles/understanding-big-and-little-endian-byte-order/>
|
||||
* <https://medium.com/coderscorner/byte-ordering-e4737416d906>
|
||||
* <https://devopedia.org/byte-ordering>
|
||||
* <https://www.geeksforgeeks.org/dsa/little-and-big-endian-mystery/>
|
||||
- <https://betterexplained.com/articles/understanding-big-and-little-endian-byte-order/>
|
||||
- <https://medium.com/coderscorner/byte-ordering-e4737416d906>
|
||||
- <https://devopedia.org/byte-ordering>
|
||||
- <https://www.geeksforgeeks.org/dsa/little-and-big-endian-mystery/>
|
||||
|
||||
Disclaimer: This article was written with AI assistance, for a bit of brainstorming and proofreading.
|
||||
Disclaimer: This article was written with AI assistance, for a bit of brainstorming and proofreading.
|
||||
|
||||
@@ -12,138 +12,138 @@ In most challenges, you’ll be given a Linux binary to exploit, and occasionall
|
||||
|
||||
Over the course of this series, we will look at the basics of a binary from simple to advanced concepts. This will be a multipart post covering the concepts over a couple of months. I’ll also use it as a reference to track my own progress.
|
||||
|
||||
> This assumes that the reader has some significant experience with programming, i will not be explaining how to write software. The tutotials will be in C, simple enough while being low level for some of the things well do. I recommend reading :
|
||||
> This assumes that the reader has some significant experience with programming, i will not be explaining how to write software. The tutorials will be in C, simple enough while being low level for some of the things well do. I recommend reading :
|
||||
>
|
||||
> *[The C Programming Language](https://www.amazon.com/Programming-Language-2nd-Brian-Kernighan/dp/0131103628)*[, 2nd Edition, by Brian W. Kernighan and Dennis M. Ritchie (Prentice Hall, 1988).](https://www.amazon.com/Programming-Language-2nd-Brian-Kernighan/dp/0131103628)
|
||||
> _[The C Programming Language](https://www.amazon.com/Programming-Language-2nd-Brian-Kernighan/dp/0131103628)_[, 2nd Edition, by Brian W. Kernighan and Dennis M. Ritchie (Prentice Hall, 1988).](https://www.amazon.com/Programming-Language-2nd-Brian-Kernighan/dp/0131103628)
|
||||
|
||||
---
|
||||
|
||||
# Concepts to Cover
|
||||
## Concepts to Cover
|
||||
|
||||
This roadmap will take you from *“I don’t know how the stack works”* to *“I can write exploits for CTFs and understand real-world CVEs.”*
|
||||
This roadmap will take you from _“I don’t know how the stack works”_ to _“I can write exploits for CTFs and understand real-world CVEs.”_
|
||||
|
||||
### **Episode 1: Getting Started**
|
||||
|
||||
* Why binary exploitation matters (CTFs, real-world, research).
|
||||
* Computer architecture basics (x86/x64 registers, stack vs heap, memory layout).
|
||||
* Compiling and running simple C programs.
|
||||
* Intro to ELF binaries.
|
||||
- Why binary exploitation matters (CTFs, real-world, research).
|
||||
- Computer architecture basics (x86/x64 registers, stack vs heap, memory layout).
|
||||
- Compiling and running simple C programs.
|
||||
- Intro to ELF binaries.
|
||||
|
||||
---
|
||||
|
||||
### **Episode 2: Assembly & Tools Crash Course**
|
||||
|
||||
* Function calls in assembly (prologue/epilogue, stack frames).
|
||||
* Common instructions (`mov`, `call`, `jmp`, `ret`).
|
||||
* Debugging with `gdb`, `gef`/`pwndbg`.
|
||||
* Disassembly with `objdump`, `radare2`, and `Ghidra`.
|
||||
- Function calls in assembly (prologue/epilogue, stack frames).
|
||||
- Common instructions (`mov`, `call`, `jmp`, `ret`).
|
||||
- Debugging with `gdb`, `gef`/`pwndbg`.
|
||||
- Disassembly with `objdump`, `radare2`, and `Ghidra`.
|
||||
|
||||
---
|
||||
|
||||
### **Episode 3: Memory Corruption 101**
|
||||
|
||||
* What is a segmentation fault?
|
||||
* Stack buffer overflows (first crashes).
|
||||
* Off-by-one errors.
|
||||
* Writing your first shellcode and executing it locally.
|
||||
- What is a segmentation fault?
|
||||
- Stack buffer overflows (first crashes).
|
||||
- Off-by-one errors.
|
||||
- Writing your first shellcode and executing it locally.
|
||||
|
||||
---
|
||||
|
||||
### **Episode 4: Exploiting Control Flow**
|
||||
|
||||
* Overwriting return addresses.
|
||||
* NOP sleds and shellcode execution.
|
||||
* Return-to-libc attacks (ret2libc).
|
||||
* Environment variables and argument tricks.
|
||||
- Overwriting return addresses.
|
||||
- NOP sleds and shellcode execution.
|
||||
- Return-to-libc attacks (ret2libc).
|
||||
- Environment variables and argument tricks.
|
||||
|
||||
---
|
||||
|
||||
### **Episode 5: Format String Vulnerabilities**
|
||||
|
||||
* How `printf` becomes an exploit primitive.
|
||||
* Memory leaks via format strings.
|
||||
* Overwriting memory using `%n`.
|
||||
- How `printf` becomes an exploit primitive.
|
||||
- Memory leaks via format strings.
|
||||
- Overwriting memory using `%n`.
|
||||
|
||||
---
|
||||
|
||||
### **Episode 6: Modern Protections & Bypasses (Part 1)**
|
||||
|
||||
* NX (non-executable stack) and its bypass with ROP.
|
||||
* Intro to ROP gadgets and building small chains.
|
||||
* Automating with Pwntools and ROPgadget.
|
||||
- NX (non-executable stack) and its bypass with ROP.
|
||||
- Intro to ROP gadgets and building small chains.
|
||||
- Automating with Pwntools and ROPgadget.
|
||||
|
||||
---
|
||||
|
||||
### **Episode 7: Modern Protections & Bypasses (Part 2)**
|
||||
|
||||
* ASLR: how randomization works.
|
||||
* Leaking addresses to defeat ASLR.
|
||||
* Stack canaries and partial overwrites.
|
||||
- ASLR: how randomization works.
|
||||
- Leaking addresses to defeat ASLR.
|
||||
- Stack canaries and partial overwrites.
|
||||
|
||||
---
|
||||
|
||||
### **Episode 8: Heap Exploitation (Basics)**
|
||||
|
||||
* Understanding malloc/free and heap metadata.
|
||||
* Classic heap overflows.
|
||||
* Use-after-free and double free.
|
||||
* Simple heap exploitation demos.
|
||||
- Understanding malloc/free and heap metadata.
|
||||
- Classic heap overflows.
|
||||
- Use-after-free and double free.
|
||||
- Simple heap exploitation demos.
|
||||
|
||||
---
|
||||
|
||||
### **Episode 9: Heap Exploitation (Advanced)**
|
||||
|
||||
* Unlink attacks and unsafe unlink.
|
||||
* Fastbin dup tricks.
|
||||
* The “House of” techniques:
|
||||
- Unlink attacks and unsafe unlink.
|
||||
- Fastbin dup tricks.
|
||||
- The “House of” techniques:
|
||||
- House of Force
|
||||
- House of Spirit
|
||||
- House of Lore
|
||||
- House of Einherjar
|
||||
|
||||
+ House of Force
|
||||
+ House of Spirit
|
||||
+ House of Lore
|
||||
+ House of Einherjar
|
||||
* Tcache poisoning in modern glibc.
|
||||
- Tcache poisoning in modern glibc.
|
||||
|
||||
---
|
||||
|
||||
### **Episode 10: Advanced Exploitation Techniques**
|
||||
|
||||
* GOT/PLT overwrites.
|
||||
* Ret2dlresolve.
|
||||
* Sigreturn-oriented programming (SROP).
|
||||
* JOP (Jump-Oriented Programming).
|
||||
- GOT/PLT overwrites.
|
||||
- Ret2dlresolve.
|
||||
- Sigreturn-oriented programming (SROP).
|
||||
- JOP (Jump-Oriented Programming).
|
||||
|
||||
---
|
||||
|
||||
### **Episode 11: Kernel & Windows Exploitation (Intro)**
|
||||
|
||||
* Userland vs kernel space.
|
||||
* Exploiting syscalls for privilege escalation.
|
||||
* Windows basics: SEH overwrites, DEP/ASLR bypass.
|
||||
* Kernel driver exploitation.
|
||||
- Userland vs kernel space.
|
||||
- Exploiting syscalls for privilege escalation.
|
||||
- Windows basics: SEH overwrites, DEP/ASLR bypass.
|
||||
- Kernel driver exploitation.
|
||||
|
||||
---
|
||||
|
||||
### **Episode 12: Modern Defenses & Mitigations**
|
||||
|
||||
* Control-Flow Integrity (CFI).
|
||||
* Shadow stacks & CET.
|
||||
* Hardened malloc and allocator security.
|
||||
* Sandboxing & seccomp-bpf.
|
||||
- Control-Flow Integrity (CFI).
|
||||
- Shadow stacks & CET.
|
||||
- Hardened malloc and allocator security.
|
||||
- Sandboxing & seccomp-bpf.
|
||||
|
||||
---
|
||||
|
||||
### **Episode 13: Exploit Workflow in Practice**
|
||||
|
||||
* Solving a CTF challenge step-by-step.
|
||||
* Remote exploitation (exploiting over sockets).
|
||||
* Exploit reliability (stability, bruteforcing).
|
||||
* Post-exploitation steps (getting a shell, escalating privileges).
|
||||
- Solving a CTF challenge step-by-step.
|
||||
- Remote exploitation (exploiting over sockets).
|
||||
- Exploit reliability (stability, bruteforcing).
|
||||
- Post-exploitation steps (getting a shell, escalating privileges).
|
||||
|
||||
---
|
||||
|
||||
### **Episode 14: Beyond the Basics**
|
||||
|
||||
* Automating exploit discovery with fuzzing (AFL, honggfuzz).
|
||||
* Symbolic execution with angr.
|
||||
* Real-world case studies (Heartbleed, Dirty COW, Shellshock).
|
||||
* Writing weaponized exploits responsibly.
|
||||
- Automating exploit discovery with fuzzing (AFL, honggfuzz).
|
||||
- Symbolic execution with angr.
|
||||
- Real-world case studies (Heartbleed, Dirty COW, Shellshock).
|
||||
- Writing weaponized exploits responsibly.
|
||||
|
||||
Reference in New Issue
Block a user