Outline Simple means to improve your code quality ! Introduction Motivation Static Source Code Analyzers Recommendations Our criteria Selected tools Additional Information
Reasons for this research CERN is a prized target Renowned Internet Exchange Point However: Any website could be targeted! Potentially undesirable consequences of an attack: Loss of confidentiality Damaged reputation Loss of data
Security: when to care about it? Creating / Managing Documents Web Pages Hardware Services Development Software Web Applications
Development and Security Training (before ) Code review (right after) Vulnerability scanning (after)
Development and Security Training (before) Static source code analysis (during and after) Code review (right after) Vulnerability scanning (after)
Development and Security Training (before) Code review (right after) Vulnerability scanning (after)
Security and me… What can YOU do about it… … without sacrificing your deadlines? Static Analysis The earlier a bug is caught, the cheaper it is to fix!
Static source code analysis A static source code analyzer : Reads your source code but… Won’t execute or compile it (usually)! Looks for possible errors regarding Security Reliability Functionality
What can they do? A static source code analyzer can : Look for known and common errors Sometimes suggest fixes or improvements Offer help in finding bugs Find many kinds of bugs, not only security related
What can they not do? A static source code analyzer cannot : ‘ Automagically ’ fix bugs Find all bugs (i.e. false negatives) Find only bugs (i.e . false positives)
Our criteria / requirements Quick results Very low ‘ false alarms ’ rate Ease of use At least some results…
Overview of selected tools Perl Perl:: Critic RATS Java FindBugs CodePro Analyser PHP Pixy RATS C / C++ Flawfinder RATS Coverity Python RATS pychecker pylint
Flawfinder C / C++ Freeware / Unix Calls to commonly misused functions… http://cern.ch/security/recommendations/en/codetools/flawfinder.shtml
FindBugs Java Freeware / Eclipse plugin Very flexible, ability to define custom rules… http://cern.ch/security/recommendations/en/codetools/findbugs.shtml
CodePro Analytix Java Freeware / Google Web Toolkit As flexible as FindBugs , also ability to define your own rules http://code.google.com/javadevtools/codepro/doc/index.html
Perl:: Critic Perl Freeware / Unix – Perl module Best Practices: style and security Demo http://cern.ch/security/recommendations/en/codetools/perl_critic.shtml
RATS C / C++ / Perl, (and, partially) Python, PHP Freeware Calls to commonly misused functions http://cern.ch/security/recommendations/en/codetools/rats.shtml
What else? ‘Ok, now that I have used this tool, I should be safe…’ Tools are not enough! Even the best tool will miss the most sophisticated errors Sensitive projects should be reviewed ‘ manually ’ by experts
A Fool with a Tool is still a Fool! ‘A fool with a tool is still a fool!’, D. Wheeler The code excerpt below was found in RealPlayer, in 2005. (CVE-2005-0455) char tmp [256]; /* Flawfinder : ignore */ strcpy ( tmp , pScreenSize ); /* Flawfinder : ignore */
Further information http://cern.ch/security/recommendations/en/code_tools.shtml Presentation of the tools Installation, configuration and usage advice Explanation of some common errors Advice for developing securer software