|
|
Subscribe / Log in / New account

Security

The state of PHP security

December 20, 2006

This article was contributed by Jake Edge.

PHP security has been much in the news lately, mostly centered around the resignation of Stefan Esser from the PHP Security Response Team. His stated reasons for leaving are rather alarming, and he indicates a pattern of slow responses to security holes within the language itself. Others, including Zend co-CTO Zeev Suraski, disagree and chalk it up to a personality conflict between Esser and the rest of the team. A recent look at the National Vulnerability Database (NVD) specifically for PHP related security issues also highlights some of the problems with PHP. It is time, it seems, to take a look at the state of PHP security.

PHP is touted as an easy language to use to write web applications, particularly those that use a database for storage. There are no end of PHP tutorials available on the web that will help readers to get a web application up and running in short order. Unfortunately, many of these tutorials completely ignore security and invite their readers to create applications that suffer from SQL injection and other security flaws. This example (from the top ten results of a Google search for 'php tutorial') explains how to update a record in a MySQL database using single quotes around the values that come in from a web form. It also describes how to display data in ways that allow for cross-site scripting.

As described in another security page article, the proper way to handle database queries with user supplied data is by using placeholders. PHP does provide ways to do that, using the PEAR database API, but finding information about it is non-trivial. It certainly is not promoted by the PHP homepage, which tends to push the included, easily abused, MySQL interface.

Because PHP strives to be easy to use, its developers have added features that have caused all manner of security problems. The worst offender is the register_globals 'feature' which automatically instantiates PHP variables from the CGI variables that are passed in a GET or POST. While it does make it easier for programmers to access these values, it also allows attackers to set the value for any uninitialized variable in the PHP program. Because PHP is a dynamic language, variables do not necessarily need to be initialized before they are used and many programs relied on that feature. When combined with register_globals, this practice leads to easy exploits.

register_globals has long been turned off by default in PHP, but there are a huge number of applications that still rely on it. Many PHP web hosting companies have it turned on because their customers demand it, but it is very difficult to use the feature correctly. There are PHP modes that warn of using uninitialized variables, but those warnings typically end up in a log file somewhere which may not be examined frequently. It is an extremely dubious feature, but one that PHP creator, Rasmus Lerdorf, seems to think should have been left on by default.

Other poor design choices include the 'magic quotes' feature that gives the illusion of removing SQL injection issues without actually providing that protection. Another is the ability of the PHP include directive to take URL arguments; this has been abused by attackers to pick up their scripts and have them run on the victim's server. Unfortunately, these features get into the language and are used making it difficult to remove them later.

There are various projects to improve upon PHP security, including Esser's Hardened-PHP, as well as efforts, such as the PHP Security Consortium, that seek to educate people about writing secure PHP code. Unfortunately, many of the open source PHP projects do not provide good examples for budding PHP programmers to emulate; they either rely upon various PHP misfeatures and/or they were written by programmers without the requisite secure coding skills.

The existence of these projects (and other similar ones) certainly provides an indication that the security problem with PHP is acknowledged by some. PHP proponents tend to take a 'blame the user' approach that is reasonable in some ways, but fails to recognize some of the inherent issues with PHP itself. If you target inexperienced web application programmers, you can hardly be surprised that they do not have fundamental security skills.

Security seems to fall somewhere below simplicity in the minds of the PHP language developers; that makes it more difficult to have secure PHP applications. Security is a hard problem and any attempt to 'dumb down' a language is likely to run into security issues. Encouraging amateur programmers to write web applications is unlikely to produce secure code in any language, but by providing tutorials and examples that have glaring security issues and by not concentrating on teaching secure coding, PHP makes it that much worse. A great deal of useful code has been written on the PHP platform; it would be nice to find a way to keep that code coming while simultaneously making it more secure.

Comments (21 posted)

New vulnerabilities

clamav: stack overflow

Package(s):clamav CVE #(s):CVE-2006-6481
Created:December 15, 2006 Updated:December 20, 2006
Description: Hendrik Weimer has reported a vulnerability in ClamAV, which can be exploited by malicious people to cause a DoS (Denial of Service). The vulnerability is caused due to a stack overflow when scanning messages with deeply nested multipart content. This can be exploited to crash the service by sending specially crafted emails to a vulnerable system.
Alerts:
Gentoo 200612-18 clamav 2006-12-18
SuSE SUSE-SA:2006:078 clamav 2006-12-18
Debian DSA-1238-1 clamav 2006-12-17
Trustix TSLSA-2006-0072 clamav 2006-12-15

Comments (none posted)

dbus: denial of service

Package(s):dbus CVE #(s):CVE-2006-6107
Created:December 15, 2006 Updated:February 12, 2007
Description: Unspecified vulnerability in the match_rule_equal function in bus/signals.c in D-Bus before 1.0.2 allows local applications to remove match rules for other applications and cause a denial of service (lost process messages).
Alerts:
openSUSE openSUSE-SU-2012:1418-1 dbus 2012-10-31
rPath rPSA-2006-0233-1 dbus 2007-02-09
Red Hat RHSA-2007:0008-01 dbus 2007-02-08
Ubuntu USN-401-1 dbus 2007-01-04
OpenPKG OpenPKG-SA-2006.041 dbus 2006-12-21
Fedora FEDORA-2006-1475 dbus 2006-12-19
Mandriva MDKSA-2006:233 dbus 2006-12-18
Fedora FEDORA-2006-1464 dbus 2006-12-14

Comments (none posted)

flash-player: CRLF injection vulnerability

Package(s):flash-player CVE #(s):CVE-2006-5330
Created:December 14, 2006 Updated:December 20, 2006
Description: Adobe Flash Player versions below 7.0.69 are vulnerable to a CRLF injection. Remote attackers can modify HTTP headers in client requests in order to conduct HTTP Request Splitting attacks via CRLF sequences in arguments to the ActionScript functions XML.addRequestHeader and XML.contentType.
Alerts:
SuSE SUSE-SA:2006:077 flash-player 2006-12-14

Comments (none posted)

gdm: format string vulnerability

Package(s):gdm CVE #(s):CVE-2006-6105
Created:December 15, 2006 Updated:December 20, 2006
Description: The gdmchooser program provides XDMCP (X Display Manager Control Protocol) functionality to the GNOME Display Manager. This protocol allows a user to interact remote systems via the local X11 display. See this iDefense advisory for additional information.
Alerts:
SuSE SUSE-SR:2006:029 koffice, squirrelmail, evince, novell-lum, gdm 2006-12-19
Fedora FEDORA-2006-1468 gdm 2006-12-15
Fedora FEDORA-2006-1467 gdm 2006-12-15
Mandriva MDKSA-2006:231 gdm 2006-12-14
Ubuntu USN-396-1 gdm 2006-12-14

Comments (1 posted)

gnuradius: format string vulnerability

Package(s):gnuradius CVE #(s):CVE-2006-4181
Created:December 14, 2006 Updated:December 20, 2006
Description: GNU Radius has format string vulnerability the sqllog function that may be used by an attacker for the remote execution of arbitrary code.
Alerts:
Gentoo 200612-17 gnuradius 2006-12-14

Comments (none posted)

Mozilla stuff: multiple vulnerabilities

Package(s):firefox thunderbird seamonkey CVE #(s):CVE-2006-6497 CVE-2006-6498 CVE-2006-6501 CVE-2006-6502 CVE-2006-6503 CVE-2006-6504 CVE-2006-6505
Created:December 20, 2006 Updated:March 12, 2007
Description: The Mozilla Project has released new versions of firefox, thunderbird, and seamonkey to address the usual pile of security issues; see this announcement or this CERT advisory for details.
Alerts:
Debian DSA-1265-1 mozilla 2007-03-10
Debian DSA-1258-1 mozilla-firefox 2007-02-07
Debian DSA-1253-1 mozilla-firefox 2006-01-27
Ubuntu USN-398-4 firefox 2007-01-27
SuSE SUSE-SA:2007:006 mozilla 2007-01-12
Mandriva MDKSA-2007:011 mozilla-thunderbird 2007-01-11
Mandriva MDKSA-2007:010 mozilla-firefox 2007-01-11
Gentoo 200701-04 seamonkey 2007-01-10
Ubuntu USN-400-1 mozilla-thunderbird 2007-01-04
Gentoo 200701-03 mozilla-thunderbird 2007-01-04
Gentoo 200701-02 mozilla-firefox 2007-01-04
Ubuntu USN-398-2 firefox 2007-01-03
Ubuntu USN-398-3 firefox 2007-01-04
Ubuntu USN-398-1 firefox 2007-01-02
Fedora FEDORA-2006-004 thunderbird 2007-01-02
rPath rPSA-2006-0234-2 firefox 2006-12-22
SuSE SUSE-SA:2006:080 MozillaFirefox,MozillaThunderbird 2006-12-29
Slackware SSA:2006-357-03 seamonkey 2006-12-25
Slackware SSA:2006-357-01 mozilla 2006-12-25
Slackware SSA:2006-357-02 mozilla 2006-12-25
rPath rPSA-2006-0234-1 firefox 2006-12-22
Fedora FEDORA-2006-1499 firefox 2006-12-21
Fedora FEDORA-2006-1491 thunderbird 2006-12-20
Fedora FEDORA-2006-1492 devhelp 2006-12-20
Red Hat RHSA-2006:0759-01 seamonkey 2006-12-19
Red Hat RHSA-2006:0760-01 thunderbird 2006-12-19
Red Hat RHSA-2006:0758-01 firefox 2006-12-19

Comments (none posted)

proftpd: stack-based buffer overflow

Package(s):proftpd CVE #(s):CVE-2006-6563
Created:December 18, 2006 Updated:February 14, 2007
Description: A vulnerability exists in the FTP server ProFTPD, versions up to and including 1.3.0a. The vulnerability is caused by a stack-based buffer overflow in the "pr_ctrls_recv_request" function of the "Controls" feature. This is an optional feature of ProFTPD server which is by default disabled in OpenPKG and probably other distributions.
Alerts:
Gentoo 200702-02 proftpd 2007-02-13
Trustix TSLSA-2006-0074 kernel, proftpd 2006-12-22
Mandriva MDKSA-2006:232 proftpd 2006-12-18
OpenPKG OpenPKG-SA-2006.039 proftpd 2006-12-18

Comments (1 posted)

sql-ledger: several remote vulnerabilities

Package(s):sql-ledger CVE #(s):CVE-2006-4244 CVE-2006-4731 CVE-2006-5872
Created:December 18, 2006 Updated:December 20, 2006
Description: Several remote vulnerabilities have been discovered in SQL Ledger, a web based double-entry accounting program, which may lead to the execution of arbitrary code.
Alerts:
Debian DSA-1239-1 sql-ledger 2006-12-17

Comments (none posted)

Page editor: Jonathan Corbet
Next page: Kernel development>>


Copyright © 2006, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds