Stack-Based Buffer Overflows on Linux x86
| Field | Value |
|---|---|
| Module ID | 31 |
| Difficulty | Medium |
| Tier | Tier 0 |
| Category | Offensive |
| Estimated Time | 7 hours |
| Cubes Earned | 0 |
| Experience Points | 620 |
| Creators | Cry0l1t3 |
| Last Updated | 2020-11-23T00:00:00.000000Z |
| URL | https://academy.hackthebox.com/app/module/31 |
Module Includes
- 13 Sections
- 7 Interactive Exercises
- 1 Assessments
- 0 Cubes
Module Description
Buffer overflows are common vulnerabilities in software applications that can be exploited to achieve remote code execution (RCE) or perform a Denial-of-Service (DoS) attack. These vulnerabilities are caused by insecure coding, resulting in an attacker being able to overrun a program's buffer and overwrite adjacent memory locations, changing the program's execution path and resulting in unintended actions.
Module Summary
This module introduces buffer overflow attacks, principles such as CPU architecture and CPU registers, and walks through the basics of exploit development and shellcode generation. We will also walk through a public exploit proof of concept and cover techniques for preventing these types of attacks.
In this module, we will cover:
- An introduction to buffer overflows
- The basics of exploit development
- Dealing with shellcode length and bad characters
- Public exploit modification
- Buffer overflow prevention
CREST CPSA/CRT-related Sections:
- All sections
CREST CCT INF-related Sections:
- All sections
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 of these examples as possible to reinforce further the concepts introduced in each section. You can do this in the Pwnbox provided in the interactive sections or your own 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" but assumes a working knowledge of the Linux command line and an understanding of information security fundamentals.
A firm grasp of the following modules can be considered prerequisites for successful completion of this module:
- Introduction to Networking
- Linux Fundamentals
Sections
13 sections - 7 Interactive
| # | Group | Type | Title |
|---|---|---|---|
| 1 | Introduction | theory | Buffer Overflows Overview |
| 2 | theory | Exploit Development Introduction | |
| 3 | theory | CPU Architecture | |
| 4 | Fundamentals | interactive | Stack-Based Buffer Overflow |
| 5 | theory | CPU Registers | |
| 6 | Exploit | interactive | Take Control of EIP |
| 7 | interactive | Determine the Length for Shellcode | |
| 8 | interactive | Identification of Bad Characters | |
| 9 | interactive | Generating Shellcode | |
| 10 | interactive | Identification of the Return Address | |
| 11 | Proof-Of-Concept | theory | Public Exploit Modification |
| 12 | theory | Prevention Techniques and Mechanisms | |
| 13 | Skills Assessment | interactive | Skills Assessment - Buffer Overflow |
Conclusion
In this module, we covered buffer overflow attacks as well as the basics of exploit development. We gained an understanding of how buffer overflows occur and how to exploit them to our advantage. The module discussed shellcode length and generation, bad characters, public exploit modification, and protections against buffer overflow attacks.
Module Key Takeaways
- An in-depth understanding of how programs work, why buffer overflows occur, and how to exploit them
- Dealing with shellcode length limitations and bad characters
- Techniques for generating shellcode
- Walking through a public exploit proof of concept and modifying it to meet our needs
- Buffer overflow prevention best practices