What is the file inclusion attack?
The file inclusion attack is an attack in which an attacker tricks a web server into executing certain scripts. The attacker may trick the web server into including a sensitive file from the server. The attacker may also inject malicious files remotely into the server. The primary purpose of file inclusion attacks is to perform even more attacks on the target server.
The file inclusion vulnerability occurs mainly because of poor coding in web applications. If a user-supplied input is used without proper validation, that leads to this type of vulnerability.
Why is the file inclusion attack done?
The purpose of this type of attacks may include :
- Obtaining contents of sensitive files from a web server
- Execution of malicious code in the webserver to perpetrate even more attacks
- Performing Cross-Site Scripting Attack (What is the cross-site scripting or XSS attack?)
- Performing Denial of Service or DoS attacks (How to protect servers from DoS attacks?)
- Stealing sensitive data from the webserver
How does the file inclusion attack work?
There are mainly two types of file inclusion attacks :
- Local File Inclusion Attack
- Remote File Inclusion Attack
Local File Inclusion Attack:
In the local file inclusion attack, an attacker tricks a web server into including a local and sensitive file and, thus, revealing its content to the attacker.
Let’s consider the following piece of code:
<?php if ( isset( $GET['EYES'] ) ) { include( $_GET['EYES'] . '.php' ); } ?> <form method="get"> <select name="EYES"> <option value="black">Black</option> <option value="blue">Blue</option> </select> <input type="submit"> </form>
Here, if the attacker executes /eyes.php?EYES=/etc/passwd that will allow the attacker to read the …
0 Comments