An attacker can use Server Side Include (SSI) Injection to send code to a web application that then gets executed by the web server. Doing so enables the attacker to achieve similar results to Cross Site Scripting, viz., arbitrary code execution and information disclosure, albeit on a more limited scale, since the SSI directives are nowhere near as powerful as a full-fledged scripting language. Nonetheless, the attacker can conveniently gain access to sensitive files, such as password files, and execute shell commands.
Description
Attack Execution Flow
Step 1
Explore[Determine applicability] The adversary determines whether server side includes are enabled on the target web server.
Look for popular page file names. The attacker will look for .shtml, .shtm, .asp, .aspx, and other well-known strings in URLs to help determine whether SSI functionality is enabled.
Fetch .htaccess file. In Apache web server installations, the .htaccess file may enable server side includes in specific locations. In those cases, the .htaccess file lives inside the directory where SSI is enabled, and is theoretically fetchable from the web server. Although most web servers deny fetching the .htaccess file, a misconfigured server will allow it. Thus, an attacker will frequently try it.
[Determinare l'applicabilità] L'avversario determina se le inclusioni lato server sono abilitate sul web server di destinazione.
Cerca nomi di file di pagina popolari. L'attaccante cercherà stringhe note come .shtml, .shtm, .asp, .aspx e altre in URL per aiutare a determinare se la funzionalità SSI è abilitata.
Recupera il file .htaccess. Nelle installazioni di web server Apache, il file .htaccess può abilitare le inclusioni lato server in posizioni specifiche. In questi casi, il file .htaccess si trova all’interno della directory in cui SSI è abilitato ed è teoricamente recuperabile dal web server. Sebbene la maggior parte dei web server neghi il recupero del file .htaccess, un server mal configurato lo consentirà. Pertanto, un attaccante tenterà frequentemente di farlo.
Attack Techniques
-
Fetch .htaccess file. In Apache web server installations, the .htaccess file may enable server side includes in specific locations. In those cases, the .htaccess file lives inside the directory where SSI is enabled, and is theoretically fetchable from the web server. Although most web servers deny fetching the .htaccess file, a misconfigured server will allow it. Thus, an attacker will frequently try it.
-
Look for popular page file names. The attacker will look for .shtml, .shtm, .asp, .aspx, and other well-known strings in URLs to help determine whether SSI functionality is enabled.IT: Recupera il file .htaccess. Nelle installazioni di Apache web server, il file .htaccess può abilitare gli include lato server in posizioni specifiche. In questi casi, il file .htaccess si trova all’interno della directory in cui gli SSI sono abilitati e, teoricamente, può essere recuperato dal server web. Sebbene la maggior parte dei server web neghi il recupero del file .htaccess, un server mal configurato lo consente. Pertanto, un attaccante tenterà frequentemente di farlo.
Step 2
Experiment[Find Injection Point] Look for user controllable input, including HTTP headers, that can carry server side include directives to the web server.
Use a spidering tool to follow and record all links. Make special note of any links that include parameters in the URL.
Use a proxy tool to record all links visited during a manual traversal of the web application. Make special note of any links that include parameters in the URL. Manual traversal of this type is frequently necessary to identify forms that are GET method forms rather than POST forms.
[Trova il Punto di Iniezione] Cerca input controllabili dall'utente, inclusi gli header HTTP, che possano contenere direttive di include lato server verso il web server.
Utilizza uno strumento di spidering per seguire e registrare tutti i link. Prendi nota speciale di eventuali link che includono parametri nell'URL.
Utilizza uno strumento proxy per registrare tutti i link visitati durante una navigazione manuale dell'applicazione web. Prendi nota speciale di eventuali link che includono parametri nell'URL. La navigazione manuale di questo tipo è spesso necessaria per identificare i moduli che utilizzano il metodo GET piuttosto che POST.
Attack Techniques
-
Use a proxy tool to record all links visited during a manual traversal of the web application. Make special note of any links that include parameters in the URL. Manual traversal of this type is frequently necessary to identify forms that are GET method forms rather than POST forms.
-
Use a spidering tool to follow and record all links. Make special note of any links that include parameters in the URL.IT: Utilizza uno strumento proxy per registrare tutti i link visitati durante una navigazione manuale dell'applicazione web. Prendi nota in modo particolare di eventuali link che includono parametri nell'URL. La navigazione manuale di questo tipo è spesso necessaria per identificare moduli che utilizzano il metodo GET anziché POST.
Step 3
Exploit[Inject SSI] Using the found injection point, the adversary sends arbitrary code to be inlcuded by the application on the server side. They may then need to view a particular page in order to have the server execute the include directive and run a command or open a file on behalf of the adversary.
[Inject SSI] Utilizzando il punto di injection trovato, l'avversario invia codice arbitrario da includere dall'applicazione lato server. Potrebbero quindi aver bisogno di visualizzare una pagina specifica per far sì che il server esegua la direttiva include e esegua un comando o apra un file per conto dell'avversario.