Skip to content

A collection of Assembly language practice codes focused on understanding system calls, memory architecture, and low-level mechanics.

License

Notifications You must be signed in to change notification settings

CyberForgeEx/ASM-Scratchpad

Repository files navigation

ASM-Scratchpad

A collection of x86/x64 assembly language examples and exercises, organized from fundamentals to advanced shellcoding techniques.

Overview

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.

Project Structure

1. Basics

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.

2. Memory

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.

3. System Calls

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.

4. Advanced

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.

Mind-Map

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>
Loading

Getting Started

Prerequisites

  • NASM (Netwide Assembler) or similar assembler
  • GCC or compatible linker
  • Linux operating system (recommended)
  • Basic understanding of computer architecture.

Building Examples

# Assemble an x64 program
nasm -f elf64 example.asm -o example.o

# Link the object file
ld example.o -o example

# Run the executable
./example

For 32-bit programs:

nasm -f elf32 example.asm -o example.o
ld -m elf_i386 example.o -o example

Learning Path

  1. Start with Basics - Build a strong foundation with hello-world, registers, and arithmetic.
  2. Understand Memory - Learn stack operations before moving to heap and vulnerabilities.
  3. Master System Calls - Essential for real-world programming and exploitation.
  4. Explore Advanced Topics - Apply your knowledge to security and exploitation techniques.

Disclaimer

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.

Tools & Resources

Recommended Tools

  • GDB - GNU Debugger for debugging assembly programs
  • objdump - Examining object files and disassembly
  • strace - Tracing system calls

Additional Resources

  • Intel/AMD Architecture Manuals
  • Linux System Call Reference
  • Security research papers and writeups

Acknowledgments

Created for learners interested in low-level programming, computer architecture, and security research.


If you like my project please give it a star

About

A collection of Assembly language practice codes focused on understanding system calls, memory architecture, and low-level mechanics.

Topics

Resources

License

Stars

Watchers

Forks