Stack-Based Buffer Overflows on Windows x86 Medium
This module is your first step into Windows Binary Exploitation, and it will teach you how to exploit local and remote buffer overflow vulnerabilities on Windows machines.
Created by 21y4d
Windows binary exploitation has advanced throughout the years, from basic stack overflow techniques to advanced security bypass techniques and heap exploitation. To reach a level of understanding that enables us to successfully exploit even the most advanced applications, we must have a firm grasp of the fundamentals of Windows binary exploitation, which is the main aim of this module.
Stack-Based Buffer Overflows on Windows x86 module is your first step in Windows
Binary Exploitation, and it will take you through the following:
- What is binary exploitation and buffer overflows
- How to debug Windows programs
- Basics of local and remote fuzzing of Windows programs
- Finding and using return instructions to subvert the program execution flow
- Crafting malicious payloads and scripts to gain local and remote control through buffer overflow vulnerabilities
- Developing a functional multi-tier Python exploit for stack-based buffer overflows, which can be used as a basis for other buffer overflow exercises
Throughout the module, we will be attacking two different programs. First, we will generate a malicious
.wav file that exploits a buffer overflow vulnerability in an audio converter to perform local privilege escalation. Then, we will move towards remote exploitation by attacking a remote server to gain remote code execution over it after debugging the vulnerable binary locally and developing an exploit.
In addition to teaching the above topics, this module will also cover:
- A short history of stack-based buffer overflows, and real-world examples of these vulnerabilities
- The process behind developing a stack-based buffer overflow
- Fuzzing a program's fields and parameters
- Identifying the exact offset of our input's location within the buffer
- Controlling the address of the return instruction
- Identifying and eliminating potentially bad characters from our exploit
- Learning multiple methods of finding and utilizing return instructions to subvert execution flow
- Generating shellcodes and executing them through our return instructions
- Fuzzing a listening port gradually to identify the length of its buffer precisely
- Adapting our local exploit to attack remote ports
This module is broken down into sections with accompanying hands-on exercises to practice each of the tactics and techniques we cover.
The module ends with a practical hands-on skills assessment to gauge your understanding of the various topic areas.
As you work through the module, you will see example commands and command output for the various topics introduced. It is worth reproducing as many examples as possible to reinforce further the concepts presented in each section. You can do this in the
PwnBox provided in the interactive sections or your virtual machine.
You can start and stop the module at any time and pick up where you left off. There is no time limit or "grading," but you must complete all of the exercises and the skills assessment to receive the maximum number of cubes and have this module marked as complete in any paths you have chosen.
The module is classified as "Medium" and assumes a working knowledge of the Windows command line and an understanding of information security fundamentals.
This module assumes a basic understanding of computer, processor, and memory architecture and will build on this understanding to teach how stack-based buffer overflows work. Therefore, we strongly recommended finishing the
Intro to Assembly Language module before starting this one to easily grasp all of the concepts taught in this module and learn the basics necessary for binary exploitation. Also, as this module also teaches the basics of building a Python exploit, the
Introduction to Python 3 should help.
In addition to the above, a firm grasp of the following modules can be considered prerequisites for successful completion of this module:
- Learning Process
- Windows Fundamentals
- Introduction to Python 3
- Intro to Assembly Language
- Buffer Overflow
- Debugging Windows Programs
- Fuzzing Parameters
- Controlling EIP
- Identifying Bad Characters
- Finding a Return Instruction
- Jumping to Shellcode
- Remote Fuzzing
- Building a Remote Exploit
- Remote Exploitation
- Skills Assessment