Idea: java vs. PHP: security implications of language choice for web applications

  • Authors:
  • James Walden;Maureen Doyle;Robert Lenhof;John Murray

  • Affiliations:
  • Department of Computer Science, Northern Kentucky University, Highland Heights, KY;Department of Computer Science, Northern Kentucky University, Highland Heights, KY;Department of Computer Science, Northern Kentucky University, Highland Heights, KY;Department of Computer Science, Northern Kentucky University, Highland Heights, KY

  • Venue:
  • ESSoS'10 Proceedings of the Second international conference on Engineering Secure Software and Systems
  • Year:
  • 2010

Quantified Score

Hi-index 0.00

Visualization

Abstract

While Java and PHP are two of the most popular languages for open source web applications found at freshmeat.net, Java has had a much better security reputation than PHP. In this paper, we examine whether that reputation is deserved. We studied whether the variation in vulnerability density is greater between languages or between different applications written in a single language by comparing eleven open source web applications written in Java with fourteen such applications written in PHP. To compare the languages, we created a Common Vulnerability Metric (CVM), which is the count of four vulnerability types common to both languages. Common Vulnerability Density (CVD) is CVM normalized by code size. We measured CVD for two revisions of each project, one from 2006 and the other from 2008. CVD values were higher for the aggregate PHP code base than the Java code base, but PHP had a better rate of improvement, with a decline from 6.25 to 2.36 vulnerabilities/KLOC compared to 1.15 to 0.63 in Java. These changes arose from an increase in code size in both languages and a decrease in vulnerabilities in PHP. The variation between projects was greater than the variation between languages, ranging from 0.52 to 14.39 for Java and 0.03 to 121.36 in PHP for 2006. We used security and software metrics to examine the sources of difference between projects.