An adversary includes formatting characters in a string input field on the target application. Most applications assume that users will provide static text and may respond unpredictably to the presence of formatting character. For example, in certain functions of the C programming languages such as printf, the formatting character %s will print the contents of a memory location expecting this location to identify a string and the formatting character %n prints the number of DWORD written in the memory. An adversary can use this to read or write to memory locations or files, or simply to manipulate the value of the resulting text in unexpected ways. Reading or writing memory may result in program crashes and writing memory could result in the execution of arbitrary code if the adversary can write to the program stack.
Description
Attack Execution Flow
Step 1
Explore[Survey application] The adversary takes an inventory of the entry points of the application.
Spider web sites for all available links
List parameters, external variables, configuration files variables, etc. that are possibly used by the application.
[Applicazione di sondaggio] L'avversario effettua un inventario dei punti di ingresso dell'applicazione.
Mappa i siti web per tutti i link disponibili
Elenca i parametri, le variabili esterne, le variabili dei file di configurazione, ecc. che potrebbero essere utilizzati dall'applicazione.
Attack Techniques
-
List parameters, external variables, configuration files variables, etc. that are possibly used by the application.
-
Spider web sites for all available linksIT: Elenca i parametri, le variabili esterne, le variabili dei file di configurazione, ecc. che sono possibilmente utilizzati dall'applicazione.
Step 2
Experiment[Determine user-controllable input susceptible to format string injection] Determine the user-controllable input susceptible to format string injection. For each user-controllable input that the adversary suspects is vulnerable to format string injection, attempt to inject formatting characters such as %n, %s, etc.. The goal is to manipulate the string creation using these formatting characters.
Inject probe payload which contains formatting characters (%s, %d, %n, etc.) through input parameters.
[Identificare gli input controllabili dall'utente suscettibili a injection di stringhe di formato] Identificare gli input controllabili dall'utente che l'attaccante sospetta siano vulnerabili a injection di stringhe di formato. Per ciascun input controllabile dall'utente, tentare di iniettare caratteri di formattazione come %n, %s, ecc. L'obiettivo è manipolare la creazione della stringa utilizzando questi caratteri di formattazione.
Iniettare payload di probe contenenti caratteri di formattazione (%s, %d, %n, ecc.) attraverso i parametri di input.
Attack Techniques
-
Inject probe payload which contains formatting characters (%s, %d, %n, etc.) through input parameters.
Step 3
Exploit[Try to exploit the Format String Injection vulnerability] After determining that a given input is vulnerable to format string injection, hypothesize what the underlying usage looks like and the associated constraints.
Insert various formatting characters to read or write the memory, e.g. overwrite return address, etc.
[Prova a sfruttare la vulnerabilità di Format String Injection] Dopo aver determinato che un input specifico è vulnerabile all'injection di stringhe di formato, ipotizza come potrebbe essere utilizzato e quali sono le eventuali restrizioni associate.
Inserisci vari caratteri di formattazione per leggere o scrivere la memoria, ad esempio sovrascrivere l'indirizzo di ritorno, ecc.
Attack Techniques
-
Insert various formatting characters to read or write the memory, e.g. overwrite return address, etc.