Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!


Forgot your password?
PHP Security Bug Programming

'Month of PHP Security' Finds 60 Bugs 120

darthcamaro writes "More than 60 bugs were reported in PHP over the last 30 days by the Month of PHP Security project. Most of the flaws, however, are ones that developers themselves can protect against with proper coding practices, according to Andi Gutmans, CEO of commercial PHP vendor Zend. He argues that PHP security is a matter of setting expectations. In his view, PHP — like all development languages — is only as secure as the code developers write with it. 'People should not expect PHP to be able to enforce security boundaries on a developer [who] has permissions to run custom PHP code,' Gutmans said. 'It's an inherently flawed scenario — and it's the wrong layer to protect in. People must rely on properly configured OS-level permissions for securing against untrusted developers.' Gutmans also praised the MOPS effort for elevating the profile of PHP security throughout the community, and for responsibly alerting the PHP project first with the bugs they found."
This discussion has been archived. No new comments can be posted.

'Month of PHP Security' Finds 60 Bugs

Comments Filter:
  • by MightyMartian ( 840721 ) on Friday June 04, 2010 @12:36PM (#32459816) Journal

    The configuration file is a problem, to be sure, but the real problem is their insane library which seems to fit no particular convention. It's goddamned madness and makes coding an incredibly painful experience as you constantly run back and forth to the online manual to get the exact name of the function. Out of that comes the constant deprecating and synonyms. I find PHP a painful, awkward language to code in, but because I do so much work supporting legacy stuff, I'm stuck with it.

  • by Gulthek ( 12570 ) on Friday June 04, 2010 @12:49PM (#32459970) Homepage Journal

    "Now" they are pushing preg functions? Everything I've read on PHP for the last five years has been drilling "use preg instead of ereg because ereg is slow and going away". This isn't a sudden switch either, you've already had months to transition and you still have many more months before you need to cut over.

    I can live with the settings file, PHP has many more fundamental flaws than disparate configurations. The only real configuration schism I'm aware of was register_globals vs. not register_globals.

    Global namespace stuffed full of built-in functions. Inconsistent argument order for built-in functions (needle, haystack || haystack, needle). Inconsistent naming scheme for built-in functions. PHP is a dumb language when it comes to including other code, it doesn't even have a concept of "other" code: an include/require statement just dumps the entire contents of the file being pulled in.

    I could go on.

    Yes, I code PHP for a living.

  • by 0racle ( 667029 ) on Friday June 04, 2010 @12:50PM (#32459986)
    As long as you expect PHP and the majority of code written in it to be insecure, you're expectations will be met. We call this setting your expectations appropriately. If you expect security from PHP, well, you need to learn to set your expectations appropriately.
  • by AndGodSed ( 968378 ) on Friday June 04, 2010 @12:51PM (#32460002) Homepage Journal

    At least they are working on finding bugs. The fact that they _found_ bugs shows that they are doing a thorough job.

    This is A GOOD THING (TM)

  • by 0racle ( 667029 ) on Friday June 04, 2010 @12:54PM (#32460042)
    I wouldn't say that Perl or Python suffer from what PHP suffers from.
  • by mcrbids ( 148650 ) on Friday June 04, 2010 @01:01PM (#32460136) Journal

    I use PHP and I love it as a language. It's powerful, stable, and lets me get lots of work done quickly.

    That said, you hit on the two biggest annoyances I have with PHP:

    1) Argument order: is it myfunction($haystack, $needle) or myfunction($needle, $haystack)? There's no rhyme or reason that I can consider, mostly just random stuff.

    2) Function names: Is it going to be isinteger() or is_integer()? And even within a set of otherwise closely rlated functions, while php has is_integer(), is_set() is actually isset(). Who thought this was a good idea?

    Again, I don't want to knock PHP too badly, it's a lean mean workhorse of a language, and its many strengths vastly outweigh its weaknesses. But couldn't they pick a convention and move to it?

  • by tepples ( 727027 ) <{tepples} {at} {gmail.com}> on Friday June 04, 2010 @01:01PM (#32460138) Homepage Journal

    I can live with the settings file, PHP has many more fundamental flaws than disparate configurations. The only real configuration schism I'm aware of was register_globals vs. not register_globals.

    That and magic_quotes_gpc on or off. The ill-advised feature was on by default in PHP 4, and though official PHP 5 turned it off, a lot of shared hosting providers turn it back on to remain compatible with legacy PHP 4 code that their hosting clients might still be using.

  • by prgrmr ( 568806 ) on Friday June 04, 2010 @01:19PM (#32460342) Journal
    People must rely on properly configured OS-level permissions for securing against untrusted developers.

    Why not also blame the web server, the middleware (e.g., Tomcat/Jboss/etc), the database, and the client-side browser as well? While security problems at these layers certainly exist, they don't excuse any problems in PHP--and they certainly don't exonerate any developer for writing insecure code in the first place.
  • by Hatta ( 162192 ) on Friday June 04, 2010 @01:21PM (#32460366) Journal

    What if that untrusted coder is not an employee, but a customer? If you're hosting websites, and your client wants to write custom PHP, you need to rely on your OS features to ensure that his insecure code can't damage other users.

  • by ducomputergeek ( 595742 ) on Friday June 04, 2010 @01:24PM (#32460420)

    Our front end has been PHP for a while because it was popular and we could find developers easily. And when we were in the development, speed and the ability to find programmers was a primary concern. However now we've added all the functionality needed and it's a mature/stable product, but in the last 18 months we've noticed quite a few of these "You shouldn't use thisFunction() because it is deprecated". Every couple months when we upgraded PHP to the latest version it seemed like we'd start seeing new warnings that some function we'd been using for years was being deprecated. The last straw for me was the deprecation of split(). We were spending more time for maintenance than what we wanted to commit to the project at this stage so we ended up porting the frontend to Perl. The backend had been Perl based since 1999/2000 and the last time we had to do any updates to those scripts was adding functionality in 2006.

    I know Perl is not sexy these days, but we use it a lot for things that we need done but don't want to spend a lot of time on maintenance. And I catch flack from some of the programmers who always want to use whatever "new hotness" is this year. But I'll take stable and mature any day of the week.

  • I would laugh... (Score:4, Insightful)

    by Vekseid ( 1528215 ) on Friday June 04, 2010 @01:28PM (#32460482) Homepage

    The fact that one of the bugs still remains from his original /2007/ Month of PHP Bugs shows that the PHP developers are clearly not doing a thorough job.

    ...but this sort of thing just makes me want to cry. Multiyear bugs exist in multitude. And these are just the ones they admit exists.

  • by epp_b ( 944299 ) on Friday June 04, 2010 @01:30PM (#32460496)
    If you "can protect against [the bugs] with proper coding practices", are they really "bugs"? I would say not.
  • This, and the lack of a namespace concept (until recently) make me wonder, "Who would begin a greenfield web application in PHP when you have Python/Ruby/(kinda) Perl?" These are all strong languages. Ruby is fascinating, though it's only now coming into its own.

    Seriously, tell me, because I don't get it. You say its strengths outweigh its weaknesses. We've pointed out some damned big weaknesses, so what are its unique strengths?

  • by Jack9 ( 11421 ) on Friday June 04, 2010 @02:04PM (#32461052)

    The configuration file is a problem, to be sure

    Why? Lots of languages use or require configurations for their interpreters/compilers. If the ini was such a big deal, there would be an implementation without one. Unfortunately, there's too many reasons to HAVE one.

  • by Dan Ost ( 415913 ) on Friday June 04, 2010 @02:17PM (#32461266)

    But because the work-around for a bug is common knowledge doesn't make the bug any less of a bug. It does, however, give the devs an excuse for not fixing it, or making it lower priority than bugs that have no work-around.

  • by the_B0fh ( 208483 ) on Friday June 04, 2010 @02:24PM (#32461362) Homepage

    Some people shouldn't be given modpoints. What kind of moron marks such an obvious joke flamebait?!

  • by Anonymous Coward on Friday June 04, 2010 @02:41PM (#32461648)

    So wait, you need an example that is *exactly* like PHP, otherwise you will shoot it down with a worthless one liner?

    Well, here's one: PHP

  • PHP's strength: ubiquity. PHP is installed everywhere, so if you are intending for your application to be deployed on diverse machines with low-cost hosting it is a good bet. I like to code in Java but for my home website it's all PHP because that comes free with my hosting provider, whereas better environments are more complicated to set up or more expensive.

Someday your prints will come. -- Kodak