Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
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 suso ( 153703 ) * on Friday June 04, 2010 @12:32PM (#32459788) Journal

    Sorry this is long, I could probably write a whole dissertation on my thoughts on PHP though.

    I've been developing in PHP since version 2 way back in '97 and I've always felt that one of PHP's biggest downfalls is that it has a configuration file. I understand that it has more to do with its origins as an Apache module, but I can't think of many modules or programming languages that are so customizable as PHP is. Over the years this has led to different schools of programmers choosing one setting or another and chastising people who use a different setting.

    Another big problem is that the core developers don't seem to get just how large the PHP community is. I found out some months ago that they were deprecating the ereg/POSIX regex set of functions in 5.3 and will be removing them in 6. I bought up on the mailing list that I think this is too quick of a time table for it being removed and that they should have it marked deprecated for at least 1 major version before removing it. Their excuse was that they really wanted to get UTF-8 support in PHP (a commendable goal) and the ereg functions weren't compatible and are also too slow. So now they are pushing the preg functions which are based on PCRE. Ironically all this time I've been avoiding the preg functions because I figured they were the more likely candidates to go away.

    And I'm not alone. Many many people out there have been using ereg in lots of code over the past decade and its going to be a huge shock for them when it comes time to switch suddenly. When 50%+ of the dynamic web uses PHP, this is going to cause lots of problems over the next 5-10 years.

    Yes yes, I know that there is work on a PEAR module to substitute the functionality of ereg, but my point is that the core developers seem to be in their own world and aren't thinking about the overall affects of their decisions and how far reaching they are.

    • by Anonymous Coward

      > the core developers seem to be in their own world and aren't thinking about the overall affects of their decisions and how far reaching they are

      Well, sure. Why do you think there are two sets of regex functions in the first place?

      PHP is a mess exactly for this reason. Features are implemented several different ways, made to conform to unhelpful C-like syntax, and crammed in wherever they will fit. The whole language is broken, and while security problems are never solely the fault of the programming

    • 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 ajrs ( 186276 ) on Friday June 04, 2010 @12:42PM (#32459888) Homepage

        You young kids and your legacy php applications. Get off my network.

      • Re: (Score:3, Interesting)

        by ceeam ( 39911 )

        Any sufficiently useful in real life set of libraries suffers from the same problems.

        • 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 Zarf ( 5735 ) on Friday June 04, 2010 @01:23PM (#32460400) Journal

            I wouldn't say that Perl or Python suffer from what PHP suffers from.

            No. They don't suffer from it they thoroughly enjoy it.

            • Re: (Score:2, Insightful)

              by the_B0fh ( 208483 )

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

              • Re: (Score:2, Informative)

                Hopefully someone who does get the joke and has mod points can help fix that. That's how the system is supposed to work... now if it would actually happen...
                • by Zarf ( 5735 )

                  Actually, I'm beginning to think I have some haters. Also... I don't need the karma. I'm capped. So... whatever.

                    But, to my fans, I thank you.

          • by ceeam ( 39911 )

            Note to you: you have just used Perl in a positive context in a thread about programming languages consistency.

            • by Zarf ( 5735 )

              I can't decide if you should get a +1 funny or +1 insightful ... maybe +1 inciteful? (as in funny and insightful but in an comically trollish way)

      • 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?

        • 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?

          • 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.

            • Re: (Score:2, Interesting)

              This it's not true on the real world. PHP can be configurated in too differente ways that you cannot guarantee almost anything will work on a different host machine. I code in PHP the most part of the time, and there is almost nothing that can be assumed as "write once, run anywhere".
            • by schon ( 31600 )

              PHP's strength: ubiquity. PHP is installed everywhere

              So what you're saying is that PHP is to programming languages what MS Windows is to operating systems?

          • "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.

            Well, I'm one of those people. In college I was trained in Fortran and then C++, and PHP has always seemed pretty friendly and intuitive in comparison with those. At least on the surface other than minor differences in syntax I could transition from one to the other to the next without too much difficulty.

            Every time I've looked at Perl, it's been downright indecipherable. I've edited a few existing scripts, tried reading not one but two books on it, and mostly I walked away feeling just as confused as when I started.

            As for Ruby and Python, when I started needing to code web applications, I'd never heard of them. They may be coming into their own now, but why should I start over with a new language when I can already do what I want with PHP? I don't know much about either, but at least peripherally I've been confused by some impression that with Ruby there are varying implementations (on Rails versions, versus who knows what else), and Python being the frequent butt of jokes here on slashdot hasn't ever made me want to research it to find out more.

            It may be a poor excuse, but that's why I'd start my next project in PHP. You may call it prejudice and ignorance against other languages; I call it being happy with what's been working just fine for me over the past decade.

            • I learned enough Perl to write file grabbing and parsing scripts within a week of work. This is simple stuff, and it was just as much about learning Regex as it was Perl. Point is, Perl is just another language, thought it is not syntactically beautiful, so to speak.

              Ruby and Python both have a strong mainline; there are not several /competing/ implementations as you seem to be concerned about with Ruby. Also, Python is awesome, and lots of people use it. That's why it's made fun of here :)

              Quirkz, I get your

            • Re: (Score:3, Informative)

              by Gulthek ( 12570 )

              That's only because you haven't taken a serious look at Django or Rails. Every diehard PHP coder that I've shown something like the Django admin interface, web form creation/management or something like ActiveRecord and fundamentally integrated testing in Rails has been absolutely stunned at how much low-level work has either been obviated or eliminated entirely. Both frameworks really free you to work on the high level fun stuff of a web application.

              If you want a quick look at Django and don't mind not "ge

              • by KamuZ ( 127113 )

                I am a PHP Developer and you are right, when I was checking Rails it was really awesome.

                Then I discovered http://www.symfony-project.org/ [symfony-project.org] and it was amazing, give it a try, you will also see how much low level work is eliminated entirely. Their documentation and tutorial is awesome too.

                I used to work with Zend Framework but now it looks complex and slow compared to Symfony. Of course as most programming discussions, it is a matter of preference. Pretty sure someone is going to come here and say Zend Framewo

                • by Gulthek ( 12570 )

                  Yikes! So instead of getting to code my models, etc. in ruby or python I have to write XML? Thanks for the pointer, but I don't think I'll be heading down that road.

                  • by KamuZ ( 127113 )

                    what are you talking about?
                    You still write your models and can override anything you want really easy.
                    But it seems you have something against PHP so no need to keep discussing this.

                    Again, this is just a matter of preference! :)

            • I can related to that. Most people code in PHP because they learn it in 1 day and then they are hooked to it. The power of PHP is its simplicity. We do web stuff with PHP because we tried JAVA and it was TOO costly. To us, any improvement will help as long as it is well documented and documentation has high google page-ranking.
            • by rgviza ( 1303161 )

              >I call it being happy with what's been working just fine for me over the past decade.
              not to mention productive if you've built up a library toolkit of any substance...

              One day I may sit down and learn Ruby, but I'm too busy being productive right now...

          • by nidarus ( 240160 )

            Very easy to get from nothing to a fully-functional site. Take a static HTML file, add a couple of tags, move this file into your web root directory, and you're done.

            That, and great PHP projects like Drupal (although I don't know if your average Drupal project qualifies as a "web application").

          • by Firehed ( 942385 )

            PHP was designed from the ground up to be a templating language for building dynamic websites, and is one of very few languages that can make that claim. Plenty of frameworks have been built to make other languages web-friendly, and they're nearly required to do anything in a cost/time-effective manner. Of course, PHP frameworks (can) speed up development as well, but you can make do without one just fine as well.

            Admittedly I may be biased as I develop in PHP all day and literally work five feet away from

          • Also, for a language that does have object comparison I find it extremely odd how some functions in the standard library tend to implement comparison. For example, check out the manual for array_intersect. The interesting tidbit:

            Note: Two elements are considered equal if and only if (string) $elem1 === (string) $elem2. In words: when the string representation is the same.

            I find such hacks in the standard library a turnoff from using PHP. However, as a poster mentions below, ubiquity is its major strength.

      • Re: (Score:3, Insightful)

        by Jack9 ( 11421 )

        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.

      • I do agree that many of the function names are, quite frankly, *wacky* ... but the online manual more than makes up for it. I just toss it in my firefox search bar, and I can generally find any function definition (and, in some cases, arcane function names) nearly as fast as I can type it.

        I've found it very difficult to find similarly useful resources in other languages (javascript in particular, if you can count it as a language ;-)).

        I'm not sure exactly what about it makes it so easy to use for regular re

    • I've never programmed in PHP but I do love Python. Python 3 broke a lot of compatibility with earlier versions for the sake of becoming more consistent and a more solid foundation on which to build future versions.

      Is PHP headed in that direction as well?

      • But Python had a bit of consistency in 2.x that PHP has always lacked. And once you get used to how stuff works in python you can just sort of guess at how various parts of the standard library work unlike PHP where it's seemingly random.

        That said, I do hold a bit of a grudge toward PHP since I have some code that I wrote in PHP ages ago and took great care to make sure it was nearly bug-free and now I can't be bothered rewriting it in a more sane language (this is OO PHP4 code with some PHP5 thrown in for

      • by maxume ( 22995 )

        A lot of people get all crotchety because python breaks ABI compatibility with minor versions, so they may not realize that incompatible changes to the language are avoided.

        • I wasn't complaining about the changes to Python, only commenting on them. :p

          • by maxume ( 22995 )

            I didn't read your comment as a complaint, I was just pointing out that while the language itself is quite stable, third party libraries, especially C libraries, may still be unavailable, which if you don't agree with the ABI breakage may be quite frustrating (I'm still using python 2.5, partly because of library availability, but I don't find it irritating).

    • by ceeam ( 39911 )

      > Ironically all this time I've been avoiding the preg functions because I figured they were the more likely candidates to go away.

      Sorry this is short, but are you *that* dumb?

      Anyway, I remember seeing (in official docs) the note that ereg functions will occasionally be dropped like 5 years ago when I first started with PHP. And the fact that PCRE functions are *much, much* more powerful is very obvious.

      • by suso ( 153703 ) * on Friday June 04, 2010 @12:53PM (#32460032) Journal

        > Ironically all this time I've been avoiding the preg functions because I figured they were the more likely candidates to go away.

        Sorry this is short, but are you *that* dumb?

        I must be.

        Anyway, I remember seeing (in official docs) the note that ereg functions will occasionally be dropped like 5 years ago when I first started with PHP. And the fact that PCRE functions are *much, much* more powerful is very obvious.

        Well good for you. Like I said, I've been using PHP since '97 and I don't usually have to go back to ereg page of the manual much. I know PCRE is more powerful (I do lots of Perl programming too so maybe I am dumb), but there are lots of functions like that in PHP where someone thought it would be cool to add it in, so it got included, but not all of them last and I wouldn't want to write code based on something that would get deprecated. Since ereg has been around since the beginning, I figured that it would be less likely to get deprecated.

        As I brought up on the mailing list months ago when I was trying to make my case, of the books in the top 10 search results for PHP on Amazon, 5 or 6 of them, including the book by Rasmus himself (wrote PHP originally), use the ereg functions in their examples. So you can imagine that there are lots of people out there learning basic search functions out there that will be going away in the next major version. This is not good.

        • Personally I keep most of my validation and formatting functions in a single class, and about a year ago I spent 4 or 5 hours and replaced all the ereg with preg. It wasn't that big of a deal and the fact that ereg is going away as been, apparently, known for a long time. I've known about it for over a year personally. Besides preg is perl / mod_rewrite compatible so the expressions are more universal. I don't see the problem here - it's not like all web hosts are going to force upgrading to PHP 6 anytim
        • php 6.0 isn't even finished yet. It took years for php5 to get adopted - which isn't even available on some crappy hosts - and the inertia holding php5 is going to be that much stronger, if only because it's not in the atrocious state it was in with version 4. People aren't going to pick up version 6 on a whim, exactly for reasons like this.

        • Yeah, you really do have to keep up with a language these days to keep an eye out for the future. I wonder how you managed the transition through the other PHP versions. I mean, you aren't using register_globals or magic_quotes are you? Languages evolve. Programmers must evolve with them. If you don't then you'll get left behind.
          • I'm with the other commenter's, ereg is just as bad as magic_quotes, IMHO. Its like you went to a Yugo/Honda dealer saw that the Honda Civic was priced lower than the Yugo, and still bought the Yugo because you thought Yugo wouldn't change its product line as much.
        • As I brought up on the mailing list months ago when I was trying to make my case, of the books in the top 10 search results for PHP on Amazon, 5 or 6 of them, including the book by Rasmus himself (wrote PHP originally), use the ereg functions in their examples. So you can imagine that there are lots of people out there learning basic search functions out there that will be going away in the next major version. This is not good.

          When has using a book that's more than 1 major revision behind ever been a good i

    • 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.

      • 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 Gulthek ( 12570 )

          Ugh, I blocked that one from memory. You know you're in for a fun time when the function has "magic" in its name.

    • by jd ( 1658 )

      When configuration files get horribly long and complex, it is usually true that they are configuring multiple distinct sub-components. In which case, those sub-components might be best pulled out of the main configuration file and placed in distinct configuration files. Further, sub-components should be responsible for loading their configuration on use. No sense loading, parsing and storing state information that won't be used in a specific PHP application - that just adds to the start-up time without addi

    • Re: (Score:1, Funny)

      by Anonymous Coward

      So you're saying that you could get a PHD of PHP?

    • 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.

      • error_reporting(E_ALL ^ E_DEPRECATED); // lameness filter too many caps wtf djalfkjasdkl fksjdklf jsakdlj fkldj lfkjsadlk fjlkasdjf lkasjflkjdasklf jlakdj fklsdajkl

      • by tsm_sf ( 545316 )
        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.

        Perl hard. Make puzzler hurt. Mongo work in java now.
    • It's worse than just the configuration file. In the middle of the 5.2.x development, they changed which value types automatically passed by reference -- in a security patch! 5.2.1 you can modify your arrays in place, 5.2.3 your code is broken. If you want to change the semantics of function calling, you should give the new version a new name; it's a new language. At the very least, you'd better give me a new major version or I'll stop using your platform. I've stopped using the platform.

      (I know it was 5.x,

    • The biggest problem is it being PHP.
      Sorry, but as the wise Sioux used to say:
      When you discover that you are riding a dead horse, you should dismount. ;)

    • This is the case with .net developers too. Guys that work developing the IDE and the language are out of sync with reality and they seem to be pround of that.
  • Once a company starts using phrases like "setting expectations" their end is near.
  • 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.
    • So, in your biased opinion, it is impossible to write insecure code in, say, perl? C? These languages are perfectly safe for all?

      Setting your bias aside, clearly the vast majority of insecure code in any language is not the language, but the way it was used.

      The issue with PHP and insecure code comes from its low bar to entry.
      • When recently helping a colleague with a CMS migration of a few million rows, I had to stop tracking the number of times and ways in which using string functions on not particularly interesting user-submitted data would cause PHP to segfault. It made no difference whether we ran the migration scripts from the command line or an Apache instance, nor whether the host was OS X, Windows, or the various Linux distros we had on hand. And then we got into the image parsing functions, which choke on files saved wit

      • What kind of moron are you? When did OP say anything about the impossibility of writing insecure code in other languages? What he said was that if the expectation is that most PHP code is insecure, then you will have met the expectation.

        Which part of that is wrong?

        Stop defending insecure code. You make the assertion yourself with your statement of low bar to entry.

    • When was Facebook's database exposed?

      Most security vulnerabilities in major php offerings these days are not php's direct fault, except perhaps as a function of the language's accessibility. If someone creates a script to allow uploading files, and sticks it on a server with both mod_php and mod_perl, and the script doesn't check non-php extensions, how is it php's fault when the server promptly gets owned?

      The server owner has a responsibility not to allow one user to threaten others (by running php over Fa

    • Re: (Score:1, Troll)

      The Parent is not "insightful", it is ignorant and biased. Insecure PHP is a function of the low bar to entry that allows noobs to produce code that does stupid things. The same (and worse) are possible with many languages...
      • The language may not guarantee secure code, but it can make writing secure code easy.

        For instance, using placeholders in SQL makes code virtually immune to SQL injection attacks. If your database does not support placeholders, then the library can simulate it by quoting bad characters when data is passed in.

        In Perl, any tutorial on database usage that anybody will point you to will most definitely show you how to use placeholders. The main one [perl.com] is over 10 years old, and it's very first Perl code example uses

        • And escaping data is not even enough. Look at this simple php code, and find the security bug (It is for mysql, but I guess the pg_query have the same problem). /* Asume an open connection to mysql exists
          This function allows any user who can submit to query any field in the database.
          */
          function unsafe() {
          $id=mysql_real_escape_string($_REQUEST['userId']);
          $query="select name from user where id=$id";
          $result=mysql_query($query);
          while($mys

          • The line
                        while($mysql=mysql_fetch_row($result))
            should be
                        while($row=mysql_fetch_row($result))

            Dam why don't mysql have an edit/append feature.

          • by rgviza ( 1303161 )

            This has more issues than just security.

            #1 you should never require that a function use GPCS data directly. That makes the function useless for any script that's not used for input via http input vars. userId should be fed via function argument in case you need to find the user's name in other situations and would like to re-use the code
            #2 you should use prepared statements whenever user input is sent as part of a query to the database. No matter how well you think you are escaping it, there's usually a way

    • by rgviza ( 1303161 )

      or you need to learn to write secure code.

  • 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)

    • Re: (Score:3, Interesting)

      by ianpatt ( 52996 )

      The PHP developers didn't find these bugs, Stefan Esser did. (see http://php-security.org/ [php-security.org])

      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.

      • 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.

    • Yeah. Like walking trough Nazi Berlin 1944, seeing 60 cases of deadly friendly fire by the Nazis, and declaring their action a good thing. ;)

      Considering my 7-year experience with PHP, I’d say that the easy to find bugs are only artifacts of the horrible horrible architecture underneath.

      A interpreter/compiler that allows you to put plain text right between your lines of code like this

      <? echo "EVIL";
      blablabla
      echo "PHP" ?>

      and not throw an error because it considers any string without quotes to be a string anyway (or a constant, or...), whic

      • LOL, yes, the above PHP example will complain about the semicolon missing behind the "PHP". *sigh*

        Anyway... I thank PHP... for giving me the motivation to finally learn Haskell. :)

  • ...can be a good idea as a standard practice.

    Bugs in the bloated function list can last for years. Interfacing with external applications can often be incomplete - see the memcache versus memcached extensions. The best solution in one version may not be in the next, and may not even be available shortly after (see all the changes they are making to version 6).

    And yet, php is good where it dominates - pulling data from MySQL and shoving it through FastCGI. If someone ends up forking php 5.3/5.4 to flesh it o

  • "People must rely on properly configured OS-level permissions for securing against untrusted developers"

    People must rely on a size 13 boot to the head for securing against untrusted developers.

    I mean really, if you don't trust your developer, fire the incompetent lying sack of shit. I don't consider myself a super coder (anymore), but it's not exactly rocket science to secure the average PHP script. Sanitize the inputs, escape any SQL parameters (or use prepared statements), and if your app needs to do stuff like "exec('sudo rm -rf /')", you just might want to rethink what it is you're trying to do for your

    • 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.

    • I am not sure which language I would prefer more, brainfuck, or APL.

      • I am not sure which language I would prefer more, brainfuck, or APL.

        APL, no contest. When it's done right, it's a non-stop brainfuck.

    • ACK that. Slightly OT, but humorous. At a php conference in London a couple of years ago, in a talk by Stefan Esser on PHP Binary Analysis a guy, possibly the guy referred to in this post [pookey.co.uk], claimed that he had a commit trigger that detected calls to exec() and e-mailed him, so he could summarily exec('sudo rm -rf /') the committer. Everyone laughed, but I have the strangest feeling he wasn't joking...
  • 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.
    • The proper way to have security is to run a PHP process per user, each running with the uid of the user in question.

      This has performance concerns, so some people designed a hack (which was eventually deprecated at some point) so that you can have security even when running PHP as an apache module, which means all scripts get run within the same process with the web server's uid. With that hack, PHP artificially does security checking between the owner of the php file and what a process with that uid would b

  • by epp_b ( 944299 )
    If you "can protect against [the bugs] with proper coding practices", are they really "bugs"? I would say not.
    • Re: (Score:3, Insightful)

      by Dan Ost ( 415913 )

      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.

    • If you "can protect against [the bugs] with proper coding practices", are they really "bugs"? I would say not.

      Description: all built-in functions are insecure and will poison your cat and sell your organs.
      Workaround: re-implement all native functionality yourself.

      QED.

    • Yes, they are. Because the main issue is that many sites host PHP from untrusted users, and don't have time to go through every script with a fine-toothed comb. Assuming that the people who write PHP scripts are capable of using proper coding practices is kind of like assuming that your teenager always tells the truth. In rare cases, it might be true, but you're an idiot if you believe it.
  • Everyone posts that simply good coding practices will solve your problems. I didn't read through all of the security flaws they are now reporting, but good coding doesn't overcome flaws in the language. If these flaws allow for security problems, it is of great concern! When parts of a language don't always function they way you expect, how are you supposed to code. I really don't want to have to code exceptions, triggers, catches and the like for every part of the language I use. That's silly. Don't t
  • I find it very confusing that Redhat server version 5 only provides 5.1.x php as a standard installation.

    This is not even an still a supported branch of php by the php community so I assume none of these fixes that will be coming out in the next php 5.2.x or 5.3.x version may make it into RedHat 5 server. Considering that none of these holes are considered critical is more reason for RedHat to not bother with backporting.

    Anyone find it a problem that Redhat installs in corporate environments do not provide

E = MC ** 2 +- 3db

Working...