Exploit › Module 3 › Lesson 4
Lab — Stack Heap
Pack stack frame diagram, heap lifecycle, and impact table — gdb/ASan observations from $PWN_LAB toys only.
Visual · pwn_stack_heap_lab
Lab: stack/heap pack. $PWN_LAB only. Original Cyberlium.
Opening
Stack/heap pack connects layout to impact — paperwork before protections module.
Lessons 3-1–3-3 covered stack frames, heap basics, and CIA impact. This lab merges diagram, heap table, and impact mapping with optional gdb backtrace or ASan excerpt from YOUR toys in $PWN_LAB. No overwrite math or payload bytes. Next: Quiz — Stack and Heap Literacy.
1. Lab contract: stack/heap pack
Create $HOME/cyberlium-lab/t24-m03-l04-stack-heap-lab.txt merging frame diagram, heap lifecycle table, CIA impact table, and one gdb or ASan excerpt with toy sha256.
Optional: side-by-side note — same bug class on stack toy vs heap toy.
Command guide
Try these commands — Lab contract: stack/heap pack
═══ TOOLS & WEBSITES ═══ Browse / read these (authorized learning only — stay in YOUR lab / program scope)
ELF sections — https://man7.org/linux/man-pages/man5/elf.5.html GDB examine — https://sourceware.org/gdb/current/onlinedocs/gdb.html/Memory.html (observe stack, not weaponize) LiveOverflow — https://www.youtube.com/c/LiveOverflow (stack vs heap explainers)
═══ INSTALL ═══
Linux (Debian/Ubuntu):
Command — copy this
sudo apt install binutils
macOS: Built-in (Xcode CLI) or brew install binutils
Command — copy this
brew install binutils
Built-in or brew install binutils
Windows: Use WSL binutils
═══ LINUX / macOS ═══
Command — copy this
export LAB_PWN=${LAB_PWN:-$HOME/cyberlium-lab/t24-pwn}
readelf -S "$LAB_PWN/bin/bof_vuln" | grep -E '\.text|\.data|\.bss'
objdump -d "$LAB_PWN/bin/bof_vuln" | grep -A12 '<main>:' | head -14
objdump -d "$LAB_PWN/bin/uaf_named" | grep -E 'malloc|free|call' | head -10
nm "$LAB_PWN/bin/bof_vuln" | grep main
echo 'stack/heap lab: YOUR toys only — map where buffers live before observing crashes'Primary tools to practice this lesson: objdump, readelf, nm. Reference sites: ELF sections (https://man7.org/linux/man-pages/man5/elf.5.html); GDB examine (https://sourceware.org/gdb/current/onlinedocs/gdb.html/Memory.html); LiveOverflow (https://www.youtube.com/c/LiveOverflow). Run every command in the box — install first, then the usage lines — only on YOUR lab / program scope.
2. Cross-check ethics
Grep for ROP, shellcode, offset calculators, production URLs — remove. Excerpts stay crash/sanitizer summaries.
Update sha256 if toys rebuilt.
3. Lock the proof
chmod 600 on the pack. Quiz next — then Protections Literacy.
Layout literacy feeds checksec lessons in M4.
4. What you ship: stack/heap literacy pack for $PWN_LAB
Frame diagram + heap table + impact table + one trace excerpt. $PWN_LAB named. NO weapon content. chmod 600.
5. What you record before the next lesson
Date. Stack/heap pack path. $PWN_LAB named. File t24-m03-l04-stack-heap-lab.txt chmod 600.
6. Wrong vs right: weaponized exploits vs memory-safety literacy
Worked failure — same MSF word, opposite target. Right never needs a café Wi-Fi or classmate laptop.
Wrong
Attach ROP gadget list. Trace production daemon without authorization.
Right
Write YOUR stack/heap pack for $PWN_LAB toys. chmod 600. Next: Quiz — Stack and Heap Literacy.
Mission: freeze YOUR stack/heap pack
1) Merge M3 literacy sections. 2) Attach one gdb backtrace or ASan line. 3) Log toy sha256. 4) chmod 600.
Stuck? Ask Cyberlium AI Mentor
One backtrace teaches frame layout faster than prose alone.
Knowledge Check
APPLY: This lab requires:
Multiple choice
Knowledge Check
APPLY: True or False: Stack/heap pack should link toy sha256.
True or False
Knowledge Check
APPLY: gdb backtrace primarily shows:
Multiple choice