MOOC Hacking Ético
Evaluación final
El presente artículo presenta desde un punto de vista resumido lo que fue mi estancia en el curso, el trabajo que se realizó, el reto, y algunos otros detalles.
TAREA 2 DE LA UNIDAD 1:En esta unidad nos fueron enseñadas algunas herramientas (Ping, Whois y Nmap) que nos permiten obtener información de los servidores. Suponiendo que queremos hacer pruebas de penetración a un servidor remoto podemos comenzar usando algunas de estas herramientas para ir obteniendo información del objetivo.
Para profundizar mas en el tema ,dejo los link con las tareas:
- Herramientas básicas para obtener información de servidores:https://whitehackblog.wordpress.com/2015/09/26/tarea-1-herramientas-basicas-para-obtener-informacion-de-servidores-externos/
- Busqueda y puesta en común de recursos:https://whitehackblog.wordpress.com/2015/09/26/tarea-2-busqueda-y-puesta-en-comun-de-recursos/
- Una sencilla práctica de criptografía:https://whitehackblog.wordpress.com/2015/10/03/tarea-3-unidad1/
Mas información: https://whitehackblog.wordpress.com/2015/09/26/tarea-2-busqueda-y-puesta-en-comun-de-recursos/
TAREA 4 DE LA UNIDAD 2:
La primera actividad de esta unidad fue analizar el tráfico de red usando un analizador de protocolos (Wireshark). Si bien yo ya lo había usado antes (para debuggear aplicaciones cliente-servidor que desarrollaba en mi anterior trabajo), estas prácticas me sirvieron para recordar su uso, y ver lo inseguros que son algunos protocolos como Telnet, donde toda la sesión viaja en texto plano (sin cifrar).
En la segunda parte de esta unidad realizamos prácticas con un tipo de ataque muy conocido, me refiero a SQL Injection. Hasta antes del curso mi conocimiento de SQL Injection se limitaba a proteger las aplicaciones Web que desarrollo, pero nunca había tenido la oportunidad de realizar el ataque. Aunque el ataque que se hizo fue en un servidor de pruebas, se siente bien saber lo que hace el atacante cuando intenta vulnerar tus aplicaciones. Ahora sé como es SQL Injection desde ambas caras de la moneda (atacante y programador).
En esta unidad también se trató de iniciar un debate acerca de la ética hacker en foro del MOOC, ¿qué está bien? ¿qué está mal? ¿cuáles son los límites de un hacker? Se trató de iniciar el debate usando como punto de partida el (ya no tan) reciente hackeo a la empresa italiana ]Hacking Team[. La propuesta del debate era buena, pero creo que no hubo mucha participación, muchos (yo incluido) nos limitamos a colocar una breve respuesta en el hilo del foro y nunca más lo visitamos.
Para concluir esta unidad se nos pidió una actividad de reflexión acerca de lo trabajado en esta semana.
Los links de las tareas de la unidad 2 son los siguientes:
- Capturando tráfico con Wireshark: https://whitehackblog.wordpress.com/2015/10/03/unidad-2-tarea-1-capturando-trafico-con-wireshark/?preview=true&preview_id=61&preview_nonce=71b0640479
- SQL Injectión:https://whitehackblog.wordpress.com/2015/10/03/tarea-2-unidad-2-sql-injection/
- Debate sobre la ética hacker:https://whitehackblog.wordpress.com/2015/10/03/tarea-3-debate-sobre-etica-del-hacker/
- Actividad de reflexión:https://whitehackblog.wordpress.com/2015/10/19/unidad-2-tarea-4-actividad-de-reflexion/
ENIGMA
En la semana 2 se nos planteó un ENIGMA que, si lo resolvíamos nos daba acceso al reto final con la pequeña ventaja de tener un poco más de tiempo para organizar nuestro equipo y tener más tiempo de preparación.
Para resolver el ENIGMA teníamos que poner en práctica los conocimientos adquiridos en la Unidad 1 – Tarea 3 (criptografía) y la Unidad 2 – Tarea 2 (SQL Injection). Así que después de leer las instrucciones del mismo, puse manos a la obra.
La solución fue bastante simple, prácticamente era repetir los pasos de la tarea 2 de la Unidad 2, pero con otra tabla (guestbook) para obtener la clave para descifrar el archivo GPG. El archivo lo descifre con Kleopatra para Windows.
Utilice SQL Injection para hacer consultas a las base de datos y busque dentro del nombre de la tabla indicado en la imagen donde proporcionaban información del enigma,y dentro de esa tabla encontre la clave publica para desencriptar el archivo que contenia la información para acceder al RETO.
RETO
Tras resolver el enigma,envie una solicitud al grupo Jedi de Facebook y despues de ser aceptado,empece a buscar equipo que estuvieran en la misma zona horaria que yo:Datos del equipo:
- EQUIPO:May the force with you
- MIEMBROS:8
- CONTACTO:Telegram Hangouts
Desde entonces,nos dispusimos a elejir el representante del grupo encargado de rellenar el formulario del grupo y recibir los datos del VPS.Una vez con el acceso al servidor en nuestras manos,nos pusimos a buscar todas las posibles vulnerabilidades que tuviera y preparamos un listado con las vulnerabilidades y correciones que hariamos.Durante la primera semana los que mas entendian sobre servidores se pusieron a configurarlo,yo por mi parte,que me apaño mejor en Pentesting,durante esa semana estube atacando nuestro propio server para ver las distintas vulnerabilidades que nos faltaban por tapar.Desafortunadamente,no e tenido mjuy buena experiencia,porque durante esa semana no habia ya apenas noticias del grupo y la sermana del ataque,practicamente no tuve noticias de ellos y yo por mi cuenta,hice todo lo que pude,dejo aqui mi informe del reto:
INFORME DEL RETO
1ª FASE
Tarea: Durante esta semana habréis de analizar vuestro servidor y realizar todas las configuraciones que sean necesarias para evitar ser vulnerables a ataques.
1º Durante la primera semana organizamos el equipo ,presentándonos y exponiendo las habilidades de cada uno y exponiendo propuestas sobre el reto esperando la llegada del VPS. Desde entonces nos manteníamos en contacto desde Telegram y Hangouts.
2º Analizamos el servidor:
Versiones de software:
- MySQL 5.5.44-0+deb7u1
- SSH OpenSSH_6.0p1 Debian-4+deb7u2
- POSTFIX 2.9.6
- VSFTPD 2.3.5
- Apache 2.2.22
- Cacti 0.8.8a
Vulnerabilidades y Exploit
MySQL 5.5.44-0+deb7u1:
-“db_restore.php” SQL Injections.
-Gin Google documents embedder arbitrary file disclosure
SSH OpenSSH_6.0p1 Debian-4+deb7u2:
-Ceragon fidebair IP-10 SSH private key exposure
-F5 BIG-IP SSH private keys exposure
-Loadbalancer.org Enterprise VA SSH private keys exposure
-Quantum DXi V1000 SSH private key exposure
-Quantum vmPRO backdoor command
-Symantec Messaging Gateway 9.5 defaiult SSH password
-Giutlab-shell code execution
-SSH user code execution
-Array networks vAPV and vxAG private key privileges
-Tectia SSH USERAUTH change request password reset
POSTFIX 2.9.6
-GLD (Greylisting daemon) postfix buffer overflow
Apache 2.2.22:
-Apache mod_cgi bash environment variables code injections
-Apache roller OGNL injections
-Apache struts remote command execution
-Apache struts classloader manipulation remote code
-Apache struts parametersinterceptor remote code execution
-Apache struts 2 defaultactionmapper prefixes OGNL code execution
-Apache struts 2 developer mode OGNL execution
-Apache struts includeparams remote code execution
-Apache tomcat manager apllication deployer authentication
-Apache contentkeeper web remote copmmand execution
_spamassasin spamd remote command execution
-Moinmoin twikidraw actions traversal file upload
-Project pier arbitrary file upload vulnerabilityy
-SPIP connect parameter PHP injection
GITLIST:
– Gitlist Unauthenticated Remote Command Execution: Exploit 1
– Gitlist <= 0.4.0 – Remote Code Execution: Exploit 2
– Paso a paso con el porque aquí:
-Cacti: Resumen de las vulnerabilidades descritas aquí:
1 | CVE-2014-5262 | 89 | Exec Code Sql | 2014-08-22 | 2014-11-05 | 7.5 | None | Remote | Low | Not required | Partial | Partial | Partial | ||||||
SQL injection vulnerability in the graph settings script (graph_settings.php) in Cacti 0.8.8b and earlier allows remote attackers to execute arbitrary SQL commands via unspecified vectors. | |||||||||||||||||||
2 | CVE-2014-5261 | 94 | Exec Code | 2014-08-22 | 2014-11-05 | 7.5 | None | Remote | Low | Not required | Partial | Partial | Partial | ||||||
The graph settings script (graph_settings.php) in Cacti 0.8.8b and earlier allows remote attackers to execute arbitrary commands via shell metacharacters in a font size, related to the rrdtool commandline in lib/rrd.php. | |||||||||||||||||||
3 | CVE-2014-2709 | Exec Code | 2014-04-23 | 2014-07-17 | 7.5 | None | Remote | Low | Not required | Partial | Partial | Partial | |||||||
lib/rrd.php in Cacti 0.8.7g, 0.8.8b, and earlier allows remote attackers to execute arbitrary commands via shell metacharacters in unspecified parameters. | |||||||||||||||||||
4 | CVE-2014-2328 | Exec Code | 2014-04-23 | 2015-03-17 | 6.5 | None | Remote | Low | Single system | Partial | Partial | Partial | |||||||
lib/graph_export.php in Cacti 0.8.7g, 0.8.8b, and earlier allows remote authenticated users to execute arbitrary commands via shell metacharacters in unspecified vectors. | |||||||||||||||||||
5 | CVE-2014-2327 | 352 | CSRF | 2014-04-23 | 2015-03-17 | 6.8 | None | Remote | Medium | Not required | Partial | Partial | Partial | ||||||
Cross-site request forgery (CSRF) vulnerability in Cacti 0.8.7g, 0.8.8b, and earlier allows remote attackers to hijack the authentication of users for unspecified commands, as demonstrated by requests that (1) modify binary files, (2) modify configurations, or (3) add arbitrary users. | |||||||||||||||||||
6 | CVE-2013-5589 | 89 | Exec Code Sql | 2013-08-29 | 2015-03-17 | 7.5 | None | Remote | Low | Not required | Partial | Partial | Partial | ||||||
SQL injection vulnerability in cacti/host.php in Cacti 0.8.8b and earlier allows remote attackers to execute arbitrary SQL commands via the id parameter. | |||||||||||||||||||
7 | CVE-2013-5588 | 79 | XSS | 2013-08-29 | 2015-05-11 | 4.3 | None | Remote | Medium | Not required | None | Partial | None | ||||||
Multiple cross-site scripting (XSS) vulnerabilities in Cacti 0.8.8b and earlier allow remote attackers to inject arbitrary web script or HTML via (1) the step parameter to install/index.php or (2) the id parameter to cacti/host.php. | |||||||||||||||||||
8 | CVE-2013-1435 | 94 | Exec Code | 2013-08-23 | 2013-08-30 | 7.5 | None | Remote | Low | Not required | Partial | Partial | Partial | ||||||
(1) snmp.php and (2) rrd.php in Cacti before 0.8.8b allows remote attackers to execute arbitrary commands via shell metacharacters in unspecified vectors. | |||||||||||||||||||
9 | CVE-2013-1435 | 89 | Exec Code Sql | 2013-08-23 | 2013-09-27 | 7.5 | None | Remote | Low | Not required | Partial | Partial | Partial | ||||||
Multiple SQL injection vulnerabilities in (1) api_poller.php and (2) utility.php in Cacti before 0.8.8b allow remote attackers to execute arbitrary SQL commands via unspecified vectors. |
2ª FASE
Herramientas utilizadas:
– SQLmap
– Metasploit
– Nikto
– nmap(Hand shake scan)
– wireshark
– Hydra
– Hacer un honeypot (sabemos que nos van a atacar, podemos sacar algo con ello)
Recolecion de información:
-Se comprueban y toma apuntes de los puertos,sistema operativo y servicios que están corriendo en cada servidor con Nmap y Wireshark.
– La mayoría:
– 21 /tcp —– abierto — FTP — vsftpd 2.3.5
– 22 /tcp —– abierto — SSH — OpenSSh 6.0p1 Debian 4+deb7u2 (protocol 2)
– 80 /tcp —– abierto — HTTP — Apache httpd 2.2.22 ((Debian))
– 135 /tcp —– filtered — msrpc?
– 445 /tcp —– filtered — Microsoft-ds?
– 8888 /tcp —– abierto — sun-answebook?
– 9999 /tcp —– abierto — abyss?
– Sistema operativo: Linux 3.x.x
Vulnerabilidades detectadas
- SQL injection en php (/usr/share/cacti/site/graph_settings.php) permite ejecutar comandos SQL inyectión.
- En el mismo archivo, permite ejecutar comandos remotos vía metacaracteres de shell en un tamaño de fuente, relacionado con rrdtool commandline en lib/rrd.php.lib/graph_export.php permite ejecutar código en vectores no específicos.
- Cross-site request forgery (CSRF) permite modificar binarios, archivos y añadir usuarios.
- cacti/host.php permite inyecciones SQL vía el parámetro id.
- Multiple cross-site scripting (XSS) permite inyectar HTML o web scripts via (1) the el parámetro de install/index.php o el parámetro id de cacti/host.php
snmp.php y rrd.php permite ejecutar comandos vía metacaracteres en vectores no específicos.
- Múltiple inyección de SQL en api_poller.php y utility.php permite ejecutar SQL comandos vía vectores no específicos.
- Puerto tcp 21/FTP : vsftpd 2.3.5
- Puerto tpc 22/SSH : OpenSSh 6.0p1 Debian 4+deb7u2 (protocol 2)
- Puerto tpc 80/HTTP : Apache httpd 2.2.22 ((Debian))
.
Explotación y ataque
– MySQL 5.5.44-0+deb7u1:
-“db_restore.php” SQL Injections.
-Gin Google documents embedder arbitrary file disclosure
– SSH OpenSSH_6.0p1 Debian-4+deb7u2:
-Ceragon fidebair IP-10 SSH private key exposure
-F5 BIG-IP SSH private keys exposure
-Loadbalancer.org Enterprise VA SSH private keys exposure
-Quantum DXi V1000 SSH private key exposure
-Quantum vmPRO backdoor command
-Symantec Messaging Gateway 9.5 defaiult SSH password
-Giutlab-shell code execution
-SSH user code execution
-Array networks vAPV and vxAG private key privileges
-Tectia SSH USERAUTH change request password reset
– POSTFIX 2.9.6
-GLD (Greylisting daemon) postfix buffer overflow
– Apache 2.2.22:
-Apache mod_cgi bash environment variables code injections
-Apache roller OGNL injections
-Apache struts remote command execution
-Apache struts classloader manipulation remote code
-Apache struts parametersinterceptor remote code execution
-Apache struts 2 defaultactionmapper prefixes OGNL code execution
-Apache struts 2 developer mode OGNL execution
-Apache struts includeparams remote code execution
-Apache tomcat manager apllication deployer authentication
-Apache contentkeeper web remote copmmand execution
-spamassasin spamd remote command execution
-Moinmoin twikidraw actions traversal file upload
-Project pier arbitrary file upload vulnerabilityy
-SPIP connect parameter PHP injection
– GITLIST:
– Gitlist Unauthenticated Remote Command Execution: Exploit 1
– Gitlist <= 0.4.0 – Remote Code Execution: Exploit 2
– Cacti:
– Se utiliza metasploit:
1º CVE-2014-5262: SQL injection vulnerability in the graph settings script (graph_settings.php) in Cacti 0.8.8b and earlier allows remote attackers to execute arbitrary SQL commands via unspecified vectors.
2º CVE-2014-5261: The graph settings script (graph_settings.php) in Cacti 0.8.8b and earlier allows remote attackers to execute arbitrary commands via shell metacharacters in a font size, related to the rrdtool commandline in lib/rrd.php.
3º CVE-2014-2709: lib/rrd.php in Cacti 0.8.7g, 0.8.8b, and earlier allows remote attackers to execute arbitrary commands via shell metacharacters in unspecified parameters.
4º CVE-2014-2328: lib/graph_export.php in Cacti 0.8.7g, 0.8.8b, and earlier allows remote authenticated users to execute arbitrary commands via shell metacharacters in unspecified vectors.
5º CVE-2013-5589: Cross-site request forgery (CSRF) vulnerability in Cacti 0.8.7g, 0.8.8b, and earlier allows remote attackers to hijack the authentication of users for unspecified commands, as demonstrated by requests that (1) modify binary files, (2) modify configurations, or (3) add arbitrary users.
6º CVE-2013-5588: SQL injection vulnerability in cacti/host.php in Cacti 0.8.8b and earlier allows remote attackers to execute arbitrary SQL commands via the id parameter.
7º CVE-2013-5588: Multiple cross-site scripting (XSS) vulnerabilities in Cacti 0.8.8b and earlier allow remote attackers to inject arbitrary web script or HTML via (1) the step parameter to install/index.php or (2) the id parameter to cacti/host.php.
8º CVE-2013-1435: (1) snmp.php and (2) rrd.php in Cacti before 0.8.8b allows remote attackers to execute arbitrary commands via shell metacharacters in unspecified vectors.
9º CVE-2013-1435: Multiple SQL injection vulnerabilities in (1) api_poller.php and (2) utility.php in Cacti before 0.8.8b allow remote attackers to execute arbitrary SQL commands via unspecified vectors.
Por ultimo,mi conclusión:
- Lo bueno: Puede darme cuenta de como es realmente un ataque a las aplicaciones Web, planeé la defensa desde cero y llevé a cabo un plan -espero que exitoso- de defensa. Conocí parte de las etapas de un ataque: la planeación (inteligencia) y la puesta en marcha del mismo (delivering).
- Lo malo: La poca participación del que fue mi equipo. Me atrevo a decir que de 8 integrantes, 5 no nos apoyaron, 1 era infiltrado y sólo 2 llevamos a cabo el reto.
- Lo feo: Muchos equipos hicieron trampa: Servicios abajo, infiltrados, y ataques automatizados estaban a la orden del día.