owasp geneva-201102-trouvez vosbugslepremier

27
Chapter meeting 17 février 2011 @ HEIG-VD Yverdon-Les-Bains Code source : Soyez le premier à trouver vos failles de sécurité! Durée: 45 minutes Thomas Hofer Consultant @ blue-infinity (Genève, Suisse)

Upload: thomas-hofer

Post on 11-Jul-2015

126 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Owasp geneva-201102-trouvez vosbugslepremier

Chapter meeting17 février 2011

@ HEIG-VD Yverdon-Les-Bains

Code source :Soyez le premier à trouver vos failles de sécurité!Durée: 45 minutes

Thomas HoferConsultant @ blue-infinity (Genève, Suisse)

Page 2: Owasp geneva-201102-trouvez vosbugslepremier

Qui suis-je?

• Thomas Hofer• Consultant (blue-infinity, Genève)

• Compétences:– Analyse statique

– Architecture de solutions

– Développement (Java – Rails – PHP)

OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.20112

Page 3: Owasp geneva-201102-trouvez vosbugslepremier

Agenda

Des moyens simples d’améliorer votre code!

1. Introduction1. Motivation

2. Outils d’analyse statique

2. Recommendations1. Nos critères

2. Outils sélectionnés

3. Informations complémentaires

OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.20113

Page 4: Owasp geneva-201102-trouvez vosbugslepremier

Pourquoi ce projet?

• Le CERN est une cible de choix– Renom– Internet Exchange Point

• Mais: tout site web peut être ciblé par une attaque!

• Conséquences potentiellement sérieuses d’une attaque– Perte de données,– Accès à des informations confidentielles,– Dommages à l’image…

OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.20114

Page 5: Owasp geneva-201102-trouvez vosbugslepremier

Quand se soucier de sécurité?

• Création / Gestion

– Documents

– Pages Web

– Machines

• Services

• Développement

– Logiciels

– Applications Web

OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.20115

Page 6: Owasp geneva-201102-trouvez vosbugslepremier

Développement et sécurité

• Formation (avant)

• Revue de code (juste après)

• Scan de vulnérabilités (après)

OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.20116

Page 7: Owasp geneva-201102-trouvez vosbugslepremier

Développement et sécurité

• Formation (avant)

• Analyse statique de code source (pendant et après)

• Revue de code (juste après)

• Scan de vulnérabilités (après)

OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.20117

Page 8: Owasp geneva-201102-trouvez vosbugslepremier

La sécurité et moi

• Que pouvez-VOUS faire…

• … sans dépasser les échéances imposées?

• Analyse statique

• Le plus tôt un bug est trouvé, le moins cher il coûte!

OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.20118

Page 9: Owasp geneva-201102-trouvez vosbugslepremier

Analyse statique de code source

Un analyseur statique de code source:

• Lira votre code mais:… ne l’exécutera et ne le compilera pas!

• Cherchera des bugs et failles possibles

– Sécurité

– Fiabilité

– Fonctionnalité

OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.20119

Page 10: Owasp geneva-201102-trouvez vosbugslepremier

Que peuvent-ils faire?

Un analyseur statique de code source peut:

• Chercher des erreurs connues et communes

• Eventuellement, proposer des solutions

• Aider à trouver des bugs…

• Ils trouvent toutes sortes de bugs, pas uniquement liés à la sécurité

OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.201110

Page 11: Owasp geneva-201102-trouvez vosbugslepremier

Que ne peuvent-ils pas faire?

Un analyseur statique ne peut pas:

• Réparer les bugs « automagiquement »

• Trouver TOUS les bugs (i.e. faux positifs)

• Ne trouver QUE des bugs (i.e. faux négatifs)

OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.201111

Page 12: Owasp geneva-201102-trouvez vosbugslepremier

Agenda

Des moyens simples d’améliorer votre code!

1. Introduction1. Motivation

2. Outils d’analyse statique

2. Recommendations1. Nos critères

2. Outils sélectionnés

3. Informations complémentaires

OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.201112

Page 13: Owasp geneva-201102-trouvez vosbugslepremier

Nos critères / Exigences

• Des résultats rapides

• Peu de fausses alertes

• Facilité d’utilisation

• Au moins quelques résultats…

OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.201113

Page 14: Owasp geneva-201102-trouvez vosbugslepremier

Aperçu des outils sélectionnés

• C / C++

– Flawfinder

– RATS

– Coverity

• Python

– RATS

– pychecker

– pylint

• Perl

– Perl::Critic

– RATS

• Java

– FindBugs

– CodePro Analyser

• PHP

– Pixy

– RATS

OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) –

Feb.201114

Page 15: Owasp geneva-201102-trouvez vosbugslepremier

Flawfinder

• C / C++

• Freeware / Unix

• Appel à des fonctions communément mal utilisées

• http://cern.ch/security/recommendations/en/codetools/flawfinder.shtml

OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.201115

Page 16: Owasp geneva-201102-trouvez vosbugslepremier

FindBugs

• Java

• Freeware / Plugin Eclipse

• Très flexible, possibilité de définir des règles soi-même

• http://cern.ch/security/recommendations/en/codetools/findbugs.shtml

OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.201116

Page 17: Owasp geneva-201102-trouvez vosbugslepremier

FindBugs

OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.201117

Page 18: Owasp geneva-201102-trouvez vosbugslepremier

CodePro Analytix

• Java

• Freeware / Google Web Toolkit

• Très flexible, possibilité de définir des règles soi-même

• http://code.google.com/javadevtools/codepro/doc/index.html

OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.201118

Page 19: Owasp geneva-201102-trouvez vosbugslepremier

Perl::Critic

• perl

• Freeware / Unix – Module perl

• Best Practices: style et sécurité

• Demo

• http://cern.ch/security/recommendations/en/codetools/perl_critic.shtml

OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.201119

Page 20: Owasp geneva-201102-trouvez vosbugslepremier

Pixy

• PHP

• Freeware / Unix

• XSS & SQLi

• http://cern.ch/security/recommendations/en/codetools/pixy.shtml

OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.201120

Page 21: Owasp geneva-201102-trouvez vosbugslepremier

RATS

• C / C++ / Perl, (et partiellement) Python, PHP

• Freeware

• Appel à des fonctions communément mal utilisées

• http://cern.ch/security/recommendations/en/codetools/rats.shtml

OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.201121

Page 22: Owasp geneva-201102-trouvez vosbugslepremier

Agenda

Des moyens simples d’améliorer votre code!

1. Introduction1. Motivation

2. Outils d’analyse statique

2. Recommendations1. Nos critères

2. Outils sélectionnés

3. Informations complémentaires

OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.201122

Page 23: Owasp geneva-201102-trouvez vosbugslepremier

Mais encore?

• « Bon, ben maintenant que j’ai utilisé tel outil, je suis tranquille… »

• Les outils ne suffisent pas!

• Même les meilleurs outils passeront à côté des erreurs les plus complexes!

• Les projets les plus sensibles méritent une revue de code « à la main »!

OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.201123

Page 24: Owasp geneva-201102-trouvez vosbugslepremier

A Fool with a Tool is still a Fool!

• « A fool with a tool is still a fool! », D. Wheeler

• L’extrait de code suivant a été trouvé dans la source de RealPlayer, en 2005. (CVE-2005-0455)

OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.201124

char tmp [256]; /* Flawfinder : ignore */strcpy (tmp , pScreenSize ); /* Flawfinder : ignore */

Page 25: Owasp geneva-201102-trouvez vosbugslepremier

Plus d’informations

• http://cern.ch/security/recommendations/en/code_tools.shtml

– Présentation des outils,

– Conseils d’installation, configuration et utilisation

– Explication de certaines failles communes

– Conseils pour le développement d’applications plus sûres…

OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.201125

Page 26: Owasp geneva-201102-trouvez vosbugslepremier

Questions?

OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.201126

© flickr.co

m/p

eop

le/eleaf

Page 27: Owasp geneva-201102-trouvez vosbugslepremier

Merci!

Pour me contacter:

[email protected]

OWASP Switzerland – Geneva Chapter Meeting @ HEIG-VD (Yverdon-Les-Bains) – Feb.201127