An attacker supplies the target software with input data that contains sequences of special characters designed to bypass input validation logic. This exploit relies on the target making multiples passes over the input data and processing a \'layer\' of special characters with each pass. In this manner, the attacker can disguise input that would otherwise be rejected as invalid by concealing it with layers of special/escape characters that are stripped off by subsequent processing steps. The goal is to first discover cases where the input validation layer executes before one or more parsing layers. That is, user input may go through the following logic in an application: <parser1> --> <input validator> --> <parser2>. In such cases, the attacker will need to provide input that will pass through the input validator, but after passing through parser2, will be converted into something that the input validator was supposed to stop.
Description
Attack Execution Flow
Step 1
Explore[Determine application/system inputs where bypassing input validation is desired] The attacker first needs to determine all of the application's/system's inputs where input validation is being performed and where they want to bypass it.
While using an application/system, the attacker discovers an input where validation is stopping them from performing some malicious or unauthorized actions.
[Determina gli input dell'applicazione/sistema in cui si desidera bypassare la validazione degli input] L'attaccante deve prima individuare tutti gli input dell'applicazione/sistema in cui viene eseguita la validazione e dove desidera bypassarla.
Durante l'uso di un'applicazione/sistema, l'attaccante scopre un input in cui la validazione impedisce di eseguire alcune azioni dannose o non autorizzate.
Attack Techniques
-
While using an application/system, the attacker discovers an input where validation is stopping them from performing some malicious or unauthorized actions.
Step 2
Experiment[Determine which character encodings are accepted by the application/system] The attacker then needs to provide various character encodings to the application/system and determine which ones are accepted. The attacker will need to observe the application's/system's response to the encoded data to determine whether the data was interpreted properly.
Determine which escape characters are accepted by the application/system. A common escape character is the backslash character, '\'
Determine whether URL encoding is accepted by the application/system.
Determine whether UTF-8 encoding is accepted by the application/system.
Determine whether UTF-16 encoding is accepted by the application/system.
Determine if any other encodings are accepted by the application/system.
[Determinare quali codifiche di caratteri sono accettate dall'applicazione/sistema] L'attaccante deve quindi fornire varie codifiche di caratteri all'applicazione/sistema e determinare quali sono accettate. L'attaccante dovrà osservare la risposta dell'applicazione/sistema ai dati codificati per stabilire se i dati sono stati interpretati correttamente.
Determinare quali caratteri di escape sono accettati dall'applicazione/sistema. Un carattere di escape comune è il carattere backslash, '\'
Determinare se la codifica URL è accettata dall'applicazione/sistema.
Determinare se la codifica UTF-8 è accettata dall'applicazione/sistema.
Determinare se la codifica UTF-16 è accettata dall'applicazione/sistema.
Determinare se sono accettate altre codifiche dall'applicazione/sistema.
Attack Techniques
-
Determine which escape characters are accepted by the application/system. A common escape character is the backslash character, '\'
-
Determine whether URL encoding is accepted by the application/system.IT: Determina quali caratteri di escape sono accettati dall'applicazione/sistema. Un carattere di escape comune è il carattere backslash, '\'
-
Determine whether UTF-8 encoding is accepted by the application/system.IT: Determina quali caratteri di escape sono accettati dall'applicazione/sistema. Un carattere di escape comune è il carattere backslash, '\'
-
Determine whether UTF-16 encoding is accepted by the application/system.IT: Determina quali caratteri di escape sono accettati dall'applicazione/sistema. Un carattere di escape comune è il carattere backslash, '\'
-
Determine if any other encodings are accepted by the application/system.IT: Determina quali caratteri di escape sono accettati dall'applicazione/sistema. Un carattere di escape comune è il carattere backslash, '\'
Step 3
Experiment[Combine multiple encodings accepted by the application.] The attacker now combines encodings accepted by the application. The attacker may combine different encodings or apply the same encoding multiple times.
Combine same encoding multiple times and observe its effects. For example, if special characters are encoded with a leading backslash, then the following encoding may be accepted by the application/system: '\\\.'. With two parsing layers, this may get converted to '\.' after the first parsing layer, and then, to '.' after the second. If the input validation layer is between the two parsing layers, then '\\\.\\\.' might pass a test for '..' but still get converted to '..' afterwards. This may enable directory traversal attacks.
Combine multiple encodings and observe the effects. For example, the attacker might encode '.' as '\.', and then, encode '\.' as '\.', and then, encode that using URL encoding to '%26%2392%3B%26%2346%3B'
[Combina più codifiche accettate dall'applicazione.] L'attaccante ora combina le codifiche accettate dall'applicazione. L'attaccante può combinare diverse codifiche o applicare la stessa codifica più volte.
Combina la stessa codifica più volte e osserva gli effetti. Ad esempio, se i caratteri speciali sono codificati con una barra rovesciata iniziale, allora la codifica successiva potrebbe essere accettata dall'applicazione/sistema: "\\\.". Con due livelli di parsing, questo potrebbe essere convertito in "\." dopo il primo livello di parsing, e poi, in "." dopo il secondo. Se il livello di validazione dell'input si trova tra i due livelli di parsing, allora "\\\.\\\." potrebbe superare un test per ".." ma comunque essere convertito in ".." successivamente. Questo può consentire attacchi di directory traversal.
Combina più codifiche e osserva gli effetti. Ad esempio, l'attaccante potrebbe codificare "." come "\.", e poi, codificare "\." come "\.", e infine, codificare quest'ultimo usando la codifica URL in "%26%2392%3B%26%2346%3B"
Attack Techniques
-
Combine multiple encodings and observe the effects. For example, the attacker might encode "." as "\.", and then, encode "\." as "\.", and then, encode that using URL encoding to "%26%2392%3B%26%2346%3B"
-
Combine same encoding multiple times and observe its effects. For example, if special characters are encoded with a leading backslash, then the following encoding may be accepted by the application/system: "\\\.". With two parsing layers, this may get converted to "\." after the first parsing layer, and then, to "." after the second. If the input validation layer is between the two parsing layers, then "\\\.\\\." might pass a test for ".." but still get converted to ".." afterwards. This may enable directory traversal attacks.IT: Combina più codifiche e osserva gli effetti. Ad esempio, l'attaccante potrebbe codificare "." come "\.", e poi, codificare "\." come "\.", e infine, codificare quest'ultimo usando la codifica URL in "%26%2392%3B%26%2346%3B"
Step 4
Exploit[Leverage ability to bypass input validation] Attacker leverages their ability to bypass input validation to gain unauthorized access to system. There are many attacks possible, and a few examples are mentioned here.
Gain access to sensitive files.
Perform command injection.
Perform SQL injection.
Perform XSS attacks.
[Capacità di sfruttare vulnerabilità per bypassare la validazione degli input] L'attaccante sfrutta la propria capacità di bypassare la validazione degli input per ottenere accesso non autorizzato al sistema. Sono possibili molteplici attacchi, e alcuni esempi sono riportati di seguito.
Accedere a file sensibili.
Eseguire injection di comandi.
Eseguire injection SQL.
Eseguire attacchi XSS.
Attack Techniques
-
Gain access to sensitive files.
-
Perform command injection.IT: Ottenere accesso a file sensibili.
-
Perform SQL injection.IT: Ottenere accesso a file sensibili.
-
Perform XSS attacks.IT: Ottenere accesso a file sensibili.