A collection of x86/x64 assembly language examples and exercises, organized from fundamentals to advanced shellcoding techniques.
ASM-Scratchpad is a learning repository designed for understanding low-level programming, system architecture, and security concepts through hands-on assembly language examples. This project covers everything from basic register manipulation to advanced exploitation techniques.
Fundamental concepts to get started with assembly programming:
- hello-world - Your first assembly program, understanding program structure and basic output.
- registers - Working with CPU registers, data movement, and register operations.
- arithmetic - Basic arithmetic operations, flags, and mathematical computations.
Understanding memory management and organization:
- stack-basics - Stack operations, push/pop, stack frames, and calling conventions.
- heap-allocation - Dynamic memory allocation using system calls.
- buffer-overflow - Understanding buffer overflows and memory corruption vulnerabilities.
Interacting with the operating system kernel:
- read-write - File I/O operations using system calls.
- execve - Process execution and program loading.
- socket-basics - Network programming fundamentals with sockets.
Advanced topics and exploitation techniques:
- shellcode - Writing and injecting position-independent shellcode.
- format-strings - Format string vulnerabilities and exploitation.
- rop-gadgets - Return-oriented programming and bypassing modern protections.
mindmap
root((<span style="color:#2C3E50">ASM-Scratchpad</span>))
<span style="color:#3498DB">basics</span>
<span style="color:#3498DB">hello-world</span>
<span style="color:#3498DB">registers</span>
<span style="color:#3498DB">arithmetic</span>
<span style="color:#27AE60">memory</span>
<span style="color:#27AE60">stack-basics</span>
<span style="color:#27AE60">heap-allocation</span>
<span style="color:#27AE60">buffer-overflow</span>
<span style="color:#E74C3C">system-calls</span>
<span style="color:#E74C3C">read-write</span>
<span style="color:#E74C3C">execve</span>
<span style="color:#E74C3C">socket-basics</span>
<span style="color:#9B59B6">advanced</span>
<span style="color:#9B59B6">shellcode</span>
<span style="color:#9B59B6">format-strings</span>
<span style="color:#9B59B6">rop-gadgets</span>
<span style="color:#F39C12">README.md</span>
- NASM (Netwide Assembler) or similar assembler
- GCC or compatible linker
- Linux operating system (recommended)
- Basic understanding of computer architecture.
# Assemble an x64 program
nasm -f elf64 example.asm -o example.o
# Link the object file
ld example.o -o example
# Run the executable
./exampleFor 32-bit programs:
nasm -f elf32 example.asm -o example.o
ld -m elf_i386 example.o -o example- Start with Basics - Build a strong foundation with hello-world, registers, and arithmetic.
- Understand Memory - Learn stack operations before moving to heap and vulnerabilities.
- Master System Calls - Essential for real-world programming and exploitation.
- Explore Advanced Topics - Apply your knowledge to security and exploitation techniques.
This repository contains educational material about security vulnerabilities and exploitation techniques. All examples are provided for educational purposes only.
- Only use these techniques in controlled, authorized environments.
- Never attempt exploitation on systems you don't own or have explicit permission to test.
- Understand and comply with applicable laws and regulations.
- GDB - GNU Debugger for debugging assembly programs
- objdump - Examining object files and disassembly
- strace - Tracing system calls
- Intel/AMD Architecture Manuals
- Linux System Call Reference
- Security research papers and writeups
Created for learners interested in low-level programming, computer architecture, and security research.
If you like my project please give it a star