File Upload Attacks
| Field | Value |
|---|---|
| Module ID | 136 |
| Difficulty | Medium |
| Tier | Tier II |
| Category | Offensive |
| Estimated Time | 8 hours |
| Cubes Earned | 20 |
| Experience Points | 580 |
| Creators | 21y4d |
| Last Updated | 2021-10-29T00:00:00.000000Z |
| URL | https://academy.hackthebox.com/app/module/136 |
Module Includes
- 11 Sections
- 8 Interactive Exercises
- 1 Assessments
- 20 Cubes
Module Description
Arbitrary file uploads are among the most critical web vulnerabilities. These flaws enable attackers to upload malicious files, execute arbitrary commands on the back-end server, and even take control over the entire server and all web applications hosted on it and potentially gain access to sensitive data or cause a service disruption.
Module Summary
Many modern web applications have file upload capabilities, which are usually necessary for the web application's functionality to enable features like attaching files or changing a user's profile image. If the file upload functionality is not securely coded, it may be abused to upload arbitrary files to the back-end server, eventually leading to compromise of the back-end server.
When an attacker can upload arbitrary files to the back-end server, they can upload malicious files, like web shells, which would enable them to execute arbitrary commands on the back-end server. This eventually allows attackers to take control over the entire server and all web applications hosted on it, which makes File Upload Attacks among the most critical web vulnerabilities.
This module will discuss the basics of identifying and exploiting file upload vulnerabilities and identifying and mitigating basic security restrictions in place to reach arbitrary file uploads.
In addition to the above, the File Upload Attacks module will teach you the following:
- What are file upload vulnerabilities?
- Examples of code vulnerable to file upload vulnerabilities
- Different types of file upload validations
- Detecting and exploiting basic file upload vulnerabilities
- Bypassing client-side file upload validation
- Bypassing blacklisted and whitelisted extension validation
- Bypassing type and content validation
- Bypassing other basic security restrictions
- Attacking upload forms with limited allowed file types
- Preventing file upload vulnerabilities through secure validation techniques
CREST CPSA/CRT-related Sections:
- Intro to File Upload Attacks
- Absent Validation
- Upload Exploitation
CREST CCT APP-related Sections:
- All sections
CREST CCT INF-related Sections:
- All sections
This module is broken 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.
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.
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 presented in each section. You can do this in the PwnBox provided in the interactive sections or your virtual machine.
The module is classified as "Medium" and assumes a working knowledge of the Linux command line and an understanding of information security fundamentals. The module also assumes a basic understanding of web applications and web requests. It will build on this understanding to teach how Arbitrary File Upload vulnerabilities work and how to exploit them.
In addition to the above, a firm grasp of the following modules can be considered as prerequisites for the successful completion of this module:
- Linux Fundamentals
- Web Requests
- Introduction to Web Applications
- Using Web Proxies
- Web Attacks
Sections
11 sections - 8 Interactive
| # | Group | Type | Title |
|---|---|---|---|
| 1 | Introduction | theory | Intro to File Upload Attacks |
| 2 | Basic Exploitation | interactive | Absent Validation |
| 3 | interactive | Upload Exploitation | |
| 4 | Bypassing Filters | interactive | Client-Side Validation |
| 5 | interactive | Blacklist Filters | |
| 6 | interactive | Whitelist Filters | |
| 7 | interactive | Type Filters | |
| 8 | Other Upload Attacks | interactive | Limited File Uploads |
| 9 | theory | Other Upload Attacks | |
| 10 | Prevention | theory | Preventing File Upload Vulnerabilities |
| 11 | Skills Assessment | interactive | Skills Assessment - File Upload Attacks |
Conclusion
Congratulations on finishing the File Upload Attacks module. We hope you can now exploit all of the vulnerabilities shown in this module and utilize the various attacking techniques with different upload forms you may face in web penetration tests.
Module Key Takeaways
- Able to detect and exploit file upload forms with no validations or filters
- Can bypass client-side/front-end upload controls to upload arbitrary files
- Able to identify what extensions are not blacklisted and use them to gain code execution
- Able to identify what extensions are whitelisted and whether they can be bypassed to upload arbitrary files
- Able to detect type/content validations and bypass them using fake content headers and file signatures
- Can work with various types of limited file upload forms and attack them based on the file types they allow
- Can attempt various other attacks with file upload forms
- Able to report file upload vulnerabilities and their mitigations, along with recommendations on how to protect the web application against future attacks
Try to reproduce everything you learned, and do all of the examples and exercises to get more comfortable with the attacks and techniques presented throughout the module.