sqlmap Errore HTTP 405 su un parametro POST vulnerabile

5

Per scopi accademici ho bisogno di esplodere un'iniezione sql cieca su un paramater di modulo che viene inviato usando il metodo POST. Il modulo è molto semplice, ha solo una casella di testo di input dove introdurre il nome di un utente e un pulsante di invio, l'output prodotto informa solo sull'esistenza o meno dell'utente introdotto. Il codice html è:

<html>
<head>
      <title>User info</title>
</head>...

<p> Introduce an user to check if it's in the database </p>   
<form method="post">
      User <input type="text" value="" name="user">
      <input type="submit" value="Check!">
</form>
<hr>
</center>
</html>

So che 'guest' è un nome utente valido (restituisce true) e ho controllato manualmente che è vulnerabile a SQL injection cieco introducendo guest 'e' 1 '=' 1 (che restituisce true), e guest 'e' 1 '=' 0 , (che restituisce false). Una volta accertato che è vulnerabile, ho provato a utilizzare sqlmap per esplodere la vulnerabilità utilizzando il seguente comando:

# sqlmap -u  "http://foo.com/checkuserform" --method "POST" --data "user=guest" --dbms "mysql" -p "user"

Ma sembra non essere in grado di sfruttare la vulnerabilità:

...
    **[00:23:01] [WARNING] the web server responded with an HTTP error code (405) which could interfere with the results of the tests**
    [00:23:01] [INFO] testing if the target URL is stable
    [00:23:02] [INFO] target URL is stable
    [00:23:02] [WARNING] heuristic (basic) test shows that POST parameter 'user' might not be injectable
    ...
    **[00:23:18] [WARNING] POST parameter 'user' is not injectable**
    [00:23:18] [CRITICAL] all tested parameters appear to be not injectable. Try to increase '--level'/'--risk' values to perform more tests. Also, you can try to rerun by providing either a valid value for option '--string' (or '--regexp') If you suspect that there is some kind of protection mechanism involved (e.g. WAF) maybe you could retry with an option '--tamper' (e.g. '--tamper=space2comment')
    [00:23:18] [WARNING] HTTP error codes detected during run:
    405 (Method Not Allowed) - 175 times

Una parte del non essere in grado di esplodere la vulnerabilità ciò che mi sorprende è l'errore HTTP 405, dal momento che ho forzato l'uso di POST nel comando sqlmap (e non sono in grado di riprodurre questo errore se lo controllo manualmente con un browser). Ho anche provato ad aumentare i valori del livello e dei parametri di rischio senza successo. Hai qualche idea del perché sta succedendo?

    
posta Toni 22.12.2015 - 10:22
fonte

1 risposta

3

Il mio metodo preferito per usare SQLmap è di inviare una richiesta usando un browser che è trasmesso tramite Burp, copiare la richiesta da Burp in un file di testo, quindi chiamare sqlmap con il parametro -r che punta al file di testo.

Ciò garantisce che l'invio sia nella posizione corretta, con le intestazioni e i cookie richiesti.

In questo caso, sospetto che tu stia eseguendo il POST nella posizione sbagliata, dalla tua descrizione sembra che possa fare una chiamata Javascript a un servizio di backend e quindi fornire una casella di avviso o aggiornare il contenuto della pagina. L'utilizzo di un proxy per osservare ciò consentirebbe di controllare, anche se gli script sulla pagina sono offuscati o eccessivamente complessi per consentire un esame ragionevole.

    
risposta data 22.12.2015 - 12:21
fonte

Leggi altre domande sui tag