Skip to main content
Server-Side Includes (SSI) allow web servers to inject content into HTML pages dynamically before serving them. SSI directives are embedded in HTML files and processed by the server at request time. When user input reaches those directives without sanitisation, an attacker can inject arbitrary SSI commands, leading to information disclosure or remote code execution.

SSI Directives

SSI directives follow the format <!--#directive parameter="value" -->.

Common echo Variables

Exploitation

SSI injection requires a file served by the web server to contain your injected directive. Typical entry points are file names, form fields, or URL parameters that end up reflected in a .shtml page or any page processed by mod_include.

Information Disclosure

Local File Read

Remote Code Execution

exec cmd requires Options +Includes and SSILegacyExprParser or equivalent to be enabled in the Apache/nginx config. If exec is disabled, escalate through include for file reads instead.

Detection

Test inputs that end up in served HTML by injecting a benign directive and checking if its output appears in the response:
If the current date appears in the response body instead of the raw directive string, SSI is being processed and injection is confirmed.