Slashdot Mirror


Serious Crypto Bug Found In PHP 5.3.7

Trailrunner7 writes "The maintainers of the PHP scripting language are warning users about a serious crypto problem in the latest release and advising them not to upgrade to PHP 5.3.7 until the bug is resolved. PHP 5.3.7 was just released last week and that version contained fixes for a slew of security vulnerabilities. But now a serious flaw has been found in that new release that is related to the way that one of the cryptographic functions handles inputs. In some cases, when the crypt() function is called using MD5 salts, the function will return only the salt value."

165 comments

  1. Regression tests are for wimps! by Niac · · Score: 5, Insightful

    Who cares about testing security code for regressions?

    I'm seriously astounded that the php development community doesn't have acceptance testing around this sort of thing. In this day and age, why on earth is it the case that bugs like this get through?

    --
    http://gabrielcain.com/
    1. Re:Regression tests are for wimps! by PCM2 · · Score: 3, Funny

      I'm seriously astounded that the php development community doesn't have acceptance testing around this sort of thing. In this day and age, why on earth is it the case that bugs like this get through?

      Speaking as an occasional PHP developer, you must be new here.

      --
      Breakfast served all day!
    2. Re:Regression tests are for wimps! by Anonymous Coward · · Score: 0

      was it a regression?

    3. Re:Regression tests are for wimps! by Niac · · Score: 1

      Okay, fair point. I try to give PHP the benefit of the doubt... ;) I'd like to think that they've got automated testing of submitted code. I'd like to... :-(

      --
      http://gabrielcain.com/
    4. Re:Regression tests are for wimps! by Anonymous Coward · · Score: 0

      They do have unit tests, they didn't run the bloody things.

    5. Re:Regression tests are for wimps! by rainmayun · · Score: 4, Insightful

      True, PHP has a history of "winging it", but by now they should be doing a pretty damn extensive suite of regression tests against each release candidate, if not each build. At this point in its life and supposed maturity, the PHP Group should really be doing better.

    6. Re:Regression tests are for wimps! by thue · · Score: 4, Informative

      From the Bug report:

      > Confirming, some very recent update broke it - right now unit tests fail on SVN. I wonder if nobody run it before release?

      So they do have a unit test for that. They just didn't run it before release :).

    7. Re:Regression tests are for wimps! by Arancaytar · · Score: 4, Insightful

      Unit tests are slow and they almost always pass. When you're in a rush to release, sometimes you feel lucky.
      Of course, you're not. That's the whole point of unit tests...

    8. Re:Regression tests are for wimps! by msauve · · Score: 2, Informative

      "I'm seriously astounded that the php development community doesn't have acceptance testing around this sort of thing."

      Two things.

      1) The problem was found and announced by "the php development community," and presumably found by them, too (admittedly, not prior to release).
      2) Why aren't you involved in acceptance testing, if you see a problem with how it's being done?

      --
      "National Security is the chief cause of national insecurity." - Celine's First Law
    9. Re:Regression tests are for wimps! by Anonymous Coward · · Score: 0

      Regression tests are normally used by idiots with test frameworks, I'd go with people like Niac.
      They will not help you find bugs in your software except when you TERRIBLY break shit.

      I would guess the framework for the test that passed this goes something like.

      if (($test=crypt(something, withMD5))==TRUE)
      {
              if (strlen($test) > 0 )
            {
                  if ($test==crypt(something,withMD5,$test)) // you know cus you can send encrypted/hash response cus the SALT is always the first X of chars.
              {
                  $omgIpassedidiotregressiontesting="yes";
                }
            }
      }

      All of which will work because it will just return the salt...GOOO REGRESSION TESTING.

      I'd go with this bug was found by a user field testing(read as 'actually trying to use it') it and checking the DATA themselfs.

      Worked in Software Dev & Support for 12 years. Never once seen a Regression test find something that is broken. FOUND thousands of them by actually using the software after Q/A has regression tested the shit out of it.

    10. Re:Regression tests are for wimps! by AvitarX · · Score: 1

      I know, that's the type of thing we expect from debian when working with cryptography.

      --
      Wow, sent an e-mail as suggested when clicking on "use classic" banner, and got a fast response that addressed my msg
    11. Re:Regression tests are for wimps! by Anonymous Coward · · Score: 1

      If you're rushing to release, you've already failed. Best not to make more mistakes.

    12. Re:Regression tests are for wimps! by GPLHost-Thomas · · Score: 2

      Few things you are failing in here. First, "Debian" is down to one guy when it comes to packaging PHP. More or less, Ondej Surý does it all, since last year, Raphael Geissert started being busy. I myself work more on packaging PEAR packages, and I have enough work. So if you want things to become better for the packaging of PHP in Debian, then you need to contribute! Create a new user on Alioth, register the project and the pkg-php-maint list, and start helping. Because for sure, we don't have, in Debian, the time to do the programming for more unit testing than it is available in upstream. However, I believe it'd be nice to have the upstream unit testing added the to Debian build process. That would avoid such "surprise"! :)

      And the second thing, I posted it on another thread: Debian is *NOT* affected by this, since the crypt() function of php is using the system implementation, not the one of PHP, at least when available (this isn't the case of blowfish which isn't available, so blowfish is affected, but not md5 for example).

    13. Re:Regression tests are for wimps! by Korin43 · · Score: 1

      2) Because it's PHP. No one wants to be involved with that.

    14. Re:Regression tests are for wimps! by Short+Circuit · · Score: 1

      Not to dismiss the serious amount of time and effort you, Ondej, Raphael and all packagers put in, but I'm pretty sure the parent was making a joking reference to the OpenSSL entropy bug.

    15. Re:Regression tests are for wimps! by Anonymous Coward · · Score: 0

      He's talking about how everyone now has openssh-blacklist installed. Not about anything Debian might have had to do with php.

    16. Re:Regression tests are for wimps! by Chuck+Chunder · · Score: 2

      It seems that the bug was in the code base for at ~10 days before someone (external) discovered it. That does not seem to be (just) a case of unit tests being skipped in a rush, it seems like a surprising lack of automated testing.

      --
      Boffoonery - downloadable Comedy Benefit for Bletchley Park
    17. Re:Regression tests are for wimps! by Anonymous Coward · · Score: 0

      What kind of logic is that? You don't need to butt-fuck every twink in the country to know that's AIDS is an avoidable disease.

    18. Re:Regression tests are for wimps! by AvitarX · · Score: 1

      I was more referencing debian creating a flaw openssl by sloppy patching crypto related areas.

      --
      Wow, sent an e-mail as suggested when clicking on "use classic" banner, and got a fast response that addressed my msg
    19. Re:Regression tests are for wimps! by Anonymous Coward · · Score: 0

      2) So don't use it. What's the problem?

    20. Re:Regression tests are for wimps! by Anonymous Coward · · Score: 1

      Looking at the actual bug report, yes, I'd say so. Returning the salt without the hash does rather defeat the point of hashing.

    21. Re:Regression tests are for wimps! by Niac · · Score: 1

      Pretty much. Also, I'm not a dev. I do other things, and only support PHP apps, rather than developing them.

      Bottom line? I prefer to spend my time elsewhere.

      --
      http://gabrielcain.com/
    22. Re:Regression tests are for wimps! by Chuck+Chunder · · Score: 4, Informative

      1) The problem was found and announced by "the php development community," and presumably found by them, too (admittedly, not prior to release).

      That seems entirely incorrect. According to the bug report it seems to have been found by someone external, it was found in a release candidate not the released version and seemingly filed before the release was made.

      2) Why aren't you involved in acceptance testing, if you see a problem with how it's being done?

      Speaking for me, we pay Zend for server licences and imagine that in someway contributes to a professionally run project. Though I have to say we are becoming increasingly unsure as to whether we get any value for money for that, of the security fixes that 5.3.7 fixed I haven't noticed any of them being pushed to Zend Server in a priority fashion and I don't think we've ever had a single support question resolved satisfactorily. Sometimes being a Zend customer seems merely to open you up to sales pushes.

      --
      Boffoonery - downloadable Comedy Benefit for Bletchley Park
    23. Re:Regression tests are for wimps! by mgiuca · · Score: 1

      Sounds like they need Retaliation!

    24. Re:Regression tests are for wimps! by Anonymous Coward · · Score: 0

      Every time I have run 'make test' on PHP (at least 10 times over various releases) it has always failed a number of tests.

    25. Re:Regression tests are for wimps! by Anonymous Coward · · Score: 0

      I'm seriously astounded that the php development community doesn't have acceptance testing around this sort of thing.

      They do, and you're it.

    26. Re:Regression tests are for wimps! by EvanED · · Score: 1

      Worked in Software Dev & Support for 12 years. Never once seen a Regression test find something that is broken

      I think you're full of BS. In fact, this particular bug was found by a regression test; just no one noticed because they have so many failing tests because their process is non-existent.

    27. Re:Regression tests are for wimps! by Anonymous Coward · · Score: 0

      You're doing it wrong.

    28. Re:Regression tests are for wimps! by Robert+Zenz · · Score: 1

      Never once seen a Regression test find something that is broken.

      I think I speak for many developers: Then you're doing it wrong.

    29. Re:Regression tests are for wimps! by Anonymous Coward · · Score: 0

      Then you have never used PHP.

      PHP's problem is its rabid auto-conversion. It simply converts everything around until it compiles. And you never notice there's a problem in the first place.

      Seriously, it's by far the worst joke of a interpreter I have ever seen. And I've worked with VisualBasic and JScript in IE.

      PHP is so bad, I managed to write code where I could write random text right smack in the midde of the code. Semantically incorrect and meaningless text like
      "Hello Betty
      This should never compile
      But it does"

      Turns out PHP sees those words as constants. And undefined constants result in "" (empty string). Which apparently is a perfectly fine thing to sit there all by itself.

      And that's just one example.

      Another problem is that there is literally a function for everything. And a corrected version of it, named differently because code out there relies on the old buggy version. Things like urlencode and rawurlencode, mysql_escape_string and mysql_real_escape_string (I'm not making this up!) and htmlspecialchars and htmlentities. Those functions are key to protecting people from XSS and getting into their database. Yet the first one of every of those functions is either deprecated because of security problems but still widely used, or in case of htmlentities, both solutions are crap and you have to write your own one based on using htmlentities to create a proper htmlspecialchars behavior.

      The list just goes on like that.

      And as somebody who has written a ton of languages, including assembler and Haskell, all his life, I simply have to say that the makers of PHP can't program and should never be allowed to write even the web site for a hospital or anything else that lives depend on.

    30. Re:Regression tests are for wimps! by m50d · · Score: 1

      2) Why aren't you involved in acceptance testing, if you see a problem with how it's being done?

      Why would I spend my own time fixing PHP's shit when I can use a language developed by a more competent organization?

      --
      I am trolling
    31. Re:Regression tests are for wimps! by Rob+Aley · · Score: 3, Informative

      While it could have been caught, the bug was actually a result of testing, namely the use of the Coverity static analyzer which flagged up "strcat(passwd, "$");". In this particular case it was safe use strcat, but was erroneously changed to "strlcat(passwd, "$", 1);" to avoid the warning. Its a lesson perhaps that automated tests aren't the silver bullet for avoiding bugs, understanding the code itself is just as important. It also raises the question of whether much of the criticism in the discussions below should be directed at C instead of PHP. I'll stay out of that one...!

    32. Re:Regression tests are for wimps! by gweihir · · Score: 3, Insightful

      Automated tests are nice, but fixing the code requires somebody that _really_ understand what they are doing. Fixing problems found in automated tests so that the tests stay quiet without understanding what is going on is about the most stupid thing you can do in security-relevant code. It is grounds for immediate and permanent removal of code maintainer status.

      Also note that the Debian OpenSSL disaster was a result from doing the same thing with valgrind, so there has been at least one very public warning about this sort of thing.

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    33. Re:Regression tests are for wimps! by GooberToo · · Score: 1

      PHP developers are VB developers of yesteryear. Few actually understand what it is they do. Most are perfectly capable of creating serious security flaws - which they do on a regular basis. PHP projects seem to always be at the top of the list of security vulnerabilities. Its only in small part a PHP language problem. The primary problem is that PHP attracts a certain type of inferior programmer, just like VB used to. As a result, you wind up with inferior programmers creating inferior projects and eventually providing inferior contributions to PHP, making it an inferior language.

      At the end of the day, you and your projects will be better off by simply avoiding PHP and PHP programmers altogether. Of course, people who actively seek out inferior programmers for their project says a lot about the nature of those people and associated projects.

    34. Re:Regression tests are for wimps! by JDG1980 · · Score: 2

      Any language with a low barrier to entry will attract a higher-than-usual number of poor developers. This doesn't mean that the language itself is necessarily bad.

    35. Re:Regression tests are for wimps! by GooberToo · · Score: 2

      It does once the feedback loop becomes complete. At least with VB, those developers were not contributing back to the language. The same can not be said for PHP.

    36. Re:Regression tests are for wimps! by datapharmer · · Score: 1

      Yes, there are bad programmers. Yes, some bad programmers use php. That said, some of us want to get things done in hours on a deadline and budget and not wait years for a project that has been changed so many times it will never work, which often happens with large programming projects written in C. I've also seen crappy code with oracle and good code used with mysql, but I don't go around telling people that all oracle db programmers terrible and should go back to programming VB, because that is painting with some seriously broad brushes.

      --
      Get a web developer
    37. Re:Regression tests are for wimps! by JDG1980 · · Score: 2

      Another problem is that there is literally a function for everything. And a corrected version of it, named differently because code out there relies on the old buggy version. Things like urlencode and rawurlencode, mysql_escape_string and mysql_real_escape_string (I'm not making this up!) and htmlspecialchars and htmlentities.

      This is hardly limited to PHP. You'll see much the same thing in the Win32 API, or indeed in the C standard library (gets, anyone)? Deprecated functions left in for compatibility reasons are a fact of life.

    38. Re:Regression tests are for wimps! by networkBoy · · Score: 1

      I just want to know who's using MD5 for *anything* anymore other than maybe a stronger CRC?

      --
      whois gawk date unzip strip find touch finger mount join nice man top fsck grep eject more yes exit umount sleep dump
    39. Re:Regression tests are for wimps! by gorzek · · Score: 1

      No kidding. Either s/he works in an organization where no one ever breaks existing functionality (extremely unlikely) or their regression testing methodology is garbage. I'll go with the latter.

    40. Re:Regression tests are for wimps! by X0563511 · · Score: 1

      Are you certain that it was indeed someone not knowing wtf they were doing? It could (though I do realize this is php..) - COULD have been a mistake by an otherwise knowledgeable individual.

      --
      For large sets, this will be our guide even unto death, for the LORD will work for each type of data it is applied to...
    41. Re:Regression tests are for wimps! by omglolbah · · Score: 1

      Anyone stuck without the funds to do a proper upgrade of a system because management does not think MD5 is an issue worth 'fixing'.

    42. Re:Regression tests are for wimps! by pclminion · · Score: 1

      Why aren't you involved in acceptance testing, if you see a problem with how it's being done?

      I am involved. It's open, right? So, I hereby declare myself to be involved. Further, I declare this release to be unacceptable. I do not certify it, and the release is hereby invalidated. That was easy!

    43. Re:Regression tests are for wimps! by Joce640k · · Score: 1

      Who writes "large projects" in C?

      Scalability isn't C's strong point, use C++ for that.

      As for PHP... sure you *can* write good code in PHP but on average it's the Visual Basic and Excel Macro programmers who are (ab)using it.

      --
      No sig today...
    44. Re:Regression tests are for wimps! by Anonymous Coward · · Score: 0

      well if you see all the recent hacks which leaked complete user databases. If the passwords were not in the clear, many were simple md5 hashes without salt.
      That was even the case for a high profile site like rootkit.com
      http://www.thehackernews.com/2011/02/rootkitcom-database-leaked-by-anonymous.html

    45. Re:Regression tests are for wimps! by Anonymous Coward · · Score: 0

      When you're in a rush to release, sometimes you feel lucky.

      Programmers feeling lucky? When did THAT even happen?

      (Notice that I took the HIGH road here.)

    46. Re:Regression tests are for wimps! by Gunstick · · Score: 1
      --
      Atari rules... ermm... ruled.
    47. Re:Regression tests are for wimps! by funfail · · Score: 1

      I believe you don't know the meaning of "regression bug" hence "regression test".

    48. Re:Regression tests are for wimps! by Anonymous Coward · · Score: 0

      Its a lesson perhaps that automated tests aren't the silver bullet for avoiding bugs, understanding the code itself is just as important.

      I'm just adding emphasis before I am go slam my hand in a door to distract myself from the fact that these points even need to be made in this day and age.

    49. Re:Regression tests are for wimps! by gweihir · · Score: 1

      The person responsible did rather obviously not understand the limits of his own understanding. In normal bugs a more experimental approach to fixing code is fine. But with crypto, you have to understand what you are doing, as crypto very easily breaks in ways that are non-obvious and leave the software functional, yet insecure. Finding this out does not even need in-dept crypto knowledge. Almost all major attacks on crypto in the last few years have been on the implementation, not the crypto itself.

      So, yes, I am pretty sure that this was a person that may be a good coder but has no clue about crypto implementation. As such, he should never, ever, ever have touched the crypto parts. He did and failed horribly. Although it was obvious enough to others that it fas found quickly, so it did not fail in the worst possible way.

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    50. Re:Regression tests are for wimps! by GooberToo · · Score: 1

      Whoosh!

      Including the other poster, you've now been told the same thing TWICE in addition to the fact that deep down you KNOW its true. PHP attracts the lowest common denominator of programmers. That's not to say better programs don't know the language but the fact remains, the vast majority of PHP users, and in fact the category of programmer it caters to is the low-end, bone-head, wanna-be coder who doesn't know his ass from his keyboard.

      Beyond that, your example is dumb. Its literally the same thing as saying, "I don't go telling professionals they suck therefore you should tell people sucking they suck." WTF?! Your counter makes absolutely no sense.

  2. Rut Roh by jhoegl · · Score: 1

    Rut Roh raggy!

  3. When will MD5 be let to die as hash for passwords? by c0lo · · Score: 2, Informative
    --
    Questions raise, answers kill. Raise questions to stay alive.
  4. PHP Bug #55439 FIXED (Aug 20) by Anonymous Coward · · Score: 1

    This bug has been fixed already. See https://bugs.php.net/bug.php?id=55439
    Main problem was if an aplication stores its hashes in a database and use them as authentication then:
    $valid = crypt($pw, $crypt);
    will always be TRUE regardless of $pw
    For all this, PHP Team said it is fixed in SVN and recomending to wait (upgrade) till 5.3.8

    1. Re:PHP Bug #55439 FIXED (Aug 20) by nedlohs · · Score: 4, Informative

      Nope.

      $valid will be the return value of crypt which will be true in the non-broken code as well.

      $crypted == crypt($pw, $salt)

      will always be true in the broken code, if $crypted was created with any old password and the same salt.

      Of course if you have existing such password, they'll always match false, so no one is going to be able to change their password and trigger the problem anyway :)

  5. Re:When will MD5 be let to die as hash for passwor by Anonymous Coward · · Score: 1

    From that wikipedia article "The presented attack does not yet threaten practical applications of MD5".

    A collision attack allows you find pairs of values that have the same MD5 hash, but these pairs are very rare.

    This is a problem for digital signatures, since an attacker could create two files (one malicious one not) that both have the same signature. It's not a problem for passwords, since attackers can't control the password you pick.

  6. It is not a crypto bug.. by Anonymous Coward · · Score: 1

    .. if the code never calls the crypto. That is the case here.

    1. Re:It is not a crypto bug.. by gweihir · · Score: 1

      It is a crypto protocol implementation bug, or crypto usage bug, short "crypto bug". Actual bugs in crypto algorithm implementation are so rare it does not make sense to reserve the term for them.

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
  7. Re:When will MD5 be let to die as hash for passwor by subreality · · Score: 1

    The MD5 collision vulnerability only allows you to generate pairs of plaintext that share the same hash. It does not allow you to find a colliding plaintext-B from a given plaintext-A. It also does not allow you to compute a plaintext from a given hash.

    In terms of passwords, here's what the exploit looks like: The attacker generates a pair of colliding texts; they use one of them as a password; the other text can also be used for the password. There are some contrived scenarios where this might be a problem, but for the normal case of authentication, it's a non-issue.

    MD5 still needs to be dropped due to collisions, but passwords aren't the pressing reason.

  8. Poor QA by TheNinjaroach · · Score: 3, Informative

    The PHP project has shown some pretty poor QA when it comes to defects in their code.

    Hell, their ODBC interface has been returning wrongly typed data for years now and nobody on the project seems to care. It's not like ODBC is something brand new and still widely misunderstood.

    It's almost like the people who build PHP aren't even interested in maintaining it.

    --
    I went to eat some animal crackers and the box said, "Do not eat if seal is broken." I opened the box and sure enough..
    1. Re:Poor QA by Xest · · Score: 2

      "It's almost like the people who build PHP aren't even interested in maintaining it."

      It's not really that, it's just the PHP ethos, PHP has never really been about good software development and that flows not just through the language itself but development of the language. It's not that PHP is inherently bad- rather than focus on good practice, it focuses on just getting things done, and this kind of works, but it also means that you'll more frequently see things like this when you throw best practice out the window.

      Like every other language, PHP has it's pros and cons- it's good for getting things done quickly, it's easy for beginners and is forgiving, but for professionals who want to write solid software it has many weaknesses. Without a doubt it's done well- look at Facebook, but similarly look what Facebook had to do with it- mangle it down to C++, and then look at the amount of bugs Facebook has suffered- anyone who uses it regularly will be well aware of features that randomly just break on some days, like chat, the ability to comment and so forth.

      A lot of developers think best practice is just fantasy, but these are developers who have never worked on large scale systems and it is precisely these scenarios where you want something that supports best practice development well. The issue Facebook has had in terms of bugs and performance, leading to difficulties with scalability are issues that arise precisely from failing to ensure you're software is well developed. It hasn't hindered Facebook, but it doesn't particularly look good for such a company either, and for more serious applications where such bugs have real repercussions it's unacceptable.

      If you want to get somethnig done ASAP and there's little accountability required if things go wrong then PHP is absolutely brilliant. But if you're developing something where there's a lot of accountability required, you can spend a bit longer developing it to produce a more solid, more futureproof (scalable, maintainable) system, then PHP is not the right tool for the job.

      So in that context although bugs are bad, I really find it hard to slag the PHP team off- they're producing a tool that people want, but it's a tool where you should expect these kind of issues. If you want a solid, trustworthy tool, then PHP isn't the right tool for the problem you're trying to solve. The only issue really surrounding PHP is that as a tool that prioritises speed over quality, is that because it's so easy to learn, too many developers when they've become good with it having learnt it as their first language, they continue to use it even where it's not fit- they don't dare venture on to anything else and so they genuinely believe it's the right tool for every job. That's wrong, no language is.

    2. Re:Poor QA by Anonymous Coward · · Score: 0

      So what would you recommend as a replacement for it?

      I have a large project that has grown out of a small project using PHP with a PostgreSQL backend.
      I have the opportunity to rewrite it from scratch and I was thinking of changing from PHP to something else.
      Just not sure what "something else" should be.

    3. Re:Poor QA by Xest · · Score: 1

      Historically Java with something like Spring has been the best bet, but in recent years C# is taking the helm really. With things like ASP.NET MVC being designed for testability, and modularity from the outset and the languages themselves from day 1 have pretty much been designed with the ability to scale in mind.

      Ruby on Rails brings better practice development to the web, but it doesn't really solve the scalability issues, so it's really just an alternative to PHP rather than something designed to grow. Twitter has managed it with RoR but it's fallen over about a thousand times in the process, and I'm not even sure they're exclusively using RoR now anyway.

      Many Slashdotters nowadays bemoan Java and C# but frankly it's because Slashdot has lost an awful lot of professionals and the professionals are far outweighed by what can only be described as script kiddies. In the real world though Java has proven itself in places like eBay and Google. Many FOSS zealots will decry .NET, pointing to the London stock exchange failure with .NET, but a bad system will fail whatever tools you use- the Linux system that has replaced it has equally suffered a number of issues causing downtime. A quick look at the job listings on pretty much any job site will give a good illustration of how prominent .NET has become.

      I wont lie, good Java is hard- it's requires much more investment in learning than PHP, you can't just jump into something like Spring, but the payoff is simply better software. C# is easier but you're then pretty much forced to host on Microsoft's platform which is generally much more expensive. These two points are themselves some of the cons of Java and .NET but should be balanced against the pros- they're just better languages for writing good software that is highly scalable, highly maintainable, and have much better support for maximising the security of your application.

  9. Re:When will MD5 be let to die as hash for passwor by QuasiSteve · · Score: 1

    Does salting garbage result in something edible?

    Well, yes?
    http://en.wikipedia.org/wiki/Salt_(cryptography)

    Perhaps put very simply.. say you find a file full of e-mail addresses followed by md5 codes, e.g.
    example@example.com 5eb63bbbe01eeed093cb22bb8f5acdc3

    You deduce that they may be hashed login codes, so you run your MD5 hacking tool and find the password to be either "hello world" or "flurblgrabl".
    You enter either "hello world" or "flurblgrabl", and you're in.

    Now let's say you find instead:
    example@example.com 5fc627d07b78d646f67411685c0591e8

    You run your MD5 hacking tool and find the password to be a rather cryptic "hBd91qh0u1Zl13-12931" (it isn't, I can't be bothered getting an actual collision). Hey, must be somebody's strong password, right?
    So you enter that as the password, and the site politely tells you to piss off.

    So what went wrong? The site used a salt. I'll leave it to the clever chaps here to figure out the 'salt' used, but suffice to say that in practical applications the salt will be sufficiently complex to figure out (while ridiculously easy to implement; the simplest implementation simply adds a fixed set of characters to the password string) that finding collisions for the stored MD5 gets you nowhere.

    Of course you might run into a problem where you allow the user - either by lack of recognizing the problem or due to a bug in verification code - to enter an empty password. In that case, at the very least with the simple implementations, the MD5 would be an MD5 of the salt itself.
    Run an attack against that, take the results (potential salts), now run an attack against all the other MD5 signatures with the found potential salts tacked on until you get matching MD5s.
    Now the correct salt has been identified, and the MD5s not just collided against, but completely identified. Now you can use that same information on other sites, and not have to worry about any salts they might use.

    But you would still have to get pretty lucky.

  10. Re:Perhaps THIS is the reason why THIS occurs? by ledow · · Score: 4, Funny

    Did you know that houses were the favoured target of burglars? Quick! Sell your house and buy a bungalow! Even though only 1% of houses are bungalows, they're attacked only 1% of the time if you consider all burglaries!

    It's like saying "cars most likely target in car thefts".

    Dickhead.

  11. PHP can't get better. It drives away anyone good. by Anonymous Coward · · Score: 2, Insightful

    PHP has gotten itself into a vicious cycle where it inherently can't get better.

    Anyone who knows what their doing will refuse to use PHP. That means that only the worst "programmers" out there will even consider it, let alone use it.

    WIthout having good developers using it, it'll never have good developers contributing to it. No good developer would want to publicly admit that they've contributed to PHP.

    At this point, some fool will throw out some crap like, "OmG but W1kip3D1A n faceb00K yooze PhP!@!#%@!!". None of that changes the fact that it's a horribly "designed" language, and it's just as poorly implemented. This single bug shows just how awful it is.

  12. Not only that by Chuck+Chunder · · Score: 3, Informative

    It seems the bug was filed before the release was made.

    --
    Boffoonery - downloadable Comedy Benefit for Bletchley Park
  13. Re:When will MD5 be let to die as hash for passwor by Arancaytar · · Score: 3, Informative

    MD5 should be deprecated, but the collision attack only invalidates signatures; it doesn't help you extract a password from its hash.

    Currently there is no feasible non-dictionary attack for that (the preimage attack found in 2009 still has complexity >2^120), and the dictionary attacks are defeated by salt. So in this narrow context, yes.

    (Of course, this would end if a somewhat more efficient preimage attack is found. 2^120 is orders of magnitude beyond usefulness, but not many orders...)

  14. Re:PHP can't get better. It drives away anyone goo by rainmayun · · Score: 2

    A bug in a library function shows how a language is poorly designed? Methinks you need a little more logical organization to your thoughts. and I can't help but laugh at "no good developer would want to publicly admit that they've contributed to PHP". Perhaps no good developer would want to admit to posting your comment, hence Anonymous Coward status.

  15. Re:When will MD5 be let to die as hash for passwor by c0lo · · Score: 1

    Does salting garbage result in something edible?

    Well, yes?

    The problem with salting: transfer the matter into "security by obscurity".

    If the repo of you passwords leaks, one can assume the salt grains would leak too. Then you are not better than having the hashed password alone to attack.

    --
    Questions raise, answers kill. Raise questions to stay alive.
  16. Re:When will MD5 be let to die as hash for passwor by Arancaytar · · Score: 1

    Run an attack against that, take the results (potential salts), now run an attack against all the other MD5 signatures with the found potential salts tacked on until you get matching MD5s.
    Now the correct salt has been identified

    If you know what a salt is, you should also know that using the same salt for different accounts is very very bad.

  17. Most distributions *not* affected by this! by GPLHost-Thomas · · Score: 4, Informative

    The internal crypt() function of PHP is only there whenever the system function doesn't exist. So for example, in Debian, only the blowfish encryption is affected, all other encryption are using the system. Here's Ondrej post about it:

    http://lists.alioth.debian.org/pipermail/pkg-php-maint/2011-August/009328.html

    I am guessing that this will be the case in most Unix distribution, but it will be an issue on platforms like Windows. So, maybe this is just too much buzz...

    1. Re:Most distributions *not* affected by this! by EvanED · · Score: 2

      The internal crypt() function of PHP is only there whenever the system function doesn't exist.

      This is not correct.

      Ondrej's post you link to is specifically referring to the patched version of PHP that you get from the Debian repository. One of the patches Ondrej applies makes PHP use the system crypt(). Without that patch -- with the stock PHP code -- PHP uses its own crypt(). Now, other distributions might apply Ondrej's patch, but I certainly wouldn't count on it, and you definitely will have a broken crypt() if you get the stock PHP.

      For my source, I again cite an email from Ondrej, this time to the PHP list http://marc.info/?l=php-internals&m=131404279532421&w=2

      In that email, he suggests to the PHP folks that they should apply his patch.

    2. Re:Most distributions *not* affected by this! by antifoidulus · · Score: 1

      Isnt running php on Windows the equivalent of hanging a big sign on your back that says "hack me"?

    3. Re:Most distributions *not* affected by this! by Anonymous Coward · · Score: 0

      RTFA; only MD5 is affected

      "The problem does not occur when using Blowfish or DES, only with MD5."

    4. Re:Most distributions *not* affected by this! by Anonymous Coward · · Score: 0

      Running php on anything that's not sandboxed says hack me.

  18. Re:When will MD5 be let to die as hash for passwor by rthille · · Score: 3, Informative

    What's fixed by using salt in your passwords is that the leaked password file can't be compared against a precomputed password dictionary.

    --
    Awesome furniture, accessories and cabinetry in Santa Rosa, CA: http://humanity-home.com/
  19. Re:When will MD5 be let to die as hash for passwor by DarwinSurvivor · · Score: 1

    I've read that last paragraph 6 times and still don't understand what you are getting at. The attacker can't control what message you create any more than the password, so what is the difference?

  20. Re:PHP can't get better. It drives away anyone goo by Anonymous Coward · · Score: 0, Flamebait

    Let me get this straight. You're accusing him of needing "more logical organization" in his thoughts, all while you're defending one of the worst programming languages ever to be created? And it's the message that matters, not who delivered it. You've missed the message by focusing solely on the messenger.

    This bug never should have happened. There's absolutely no excuse for it. Even a shitty programmer would not have made this mistake. Seriously, go look at the diff of the fix. It's mind-boggling that it happened in the first place.

    This kind of bug never happens in Java-based web frameworks, or .NET-based web frameworks, or Python-based web frameworks, or Ruby-based web frameworks, or Perl-based web frameworks. Nobody else screws up like this. But somehow PHP manages to do this constantly. Look at its changelogs, for crying out loud. It's one pathetic bug after another, year after year, even in their most stable releases. It clearly must be a problem with the PHP community, because nobody else is affected by this problem to the degree that PHP is. Not even Microsoft, I dare admit it!

  21. Re:Perhaps THIS is the reason why THIS occurs? by jonahbron · · Score: 0

    Really, that's like saying "switch to Macs because Windows are the most attacked by hackers!". It's just because they're more popular. I guaran-dang-tee you that IIS servers aren't any safer than a LAMP stack.

  22. Re:When will MD5 be let to die as hash for passwor by Anonymous Coward · · Score: 0

    Actually you can do that with MD5, it is called a chosen prefix/suffix attack. What you cannot do as far as I know is generate a preimage efficiently which is what is required to break a password hash.

  23. Re:PHP can't get better. It drives away anyone goo by Anonymous Coward · · Score: 0

    Wow, someone stuck burning herring up your ass didn't they (Rhetorical, we all know they did)?

    Your logic sticks as much as that herring.

  24. Re:JSP doesn't have these problems by jonwil · · Score: 1

    Maybe I would like Java more if the people who owned it weren't so evil they make MS look good.

    And if the people who choose to use it didnt use 5000 different addon libraries with confusing names that say nothing about what they hell they do (Spring, Struts, Hibernate etc etc etc)

  25. Re:When will MD5 be let to die as hash for passwor by c0lo · · Score: 1

    MD5 should be deprecated, but the collision attack only invalidates signatures;

    Because you are not "decrypting" the password, finding a collision will be an attack for passwords as well - fortunately, as others pointed out, it's currently still 2^120.

    and the dictionary attacks are defeated by salt

    I argue that using a "salting for passwords" it's useless (doesn't do harm, but doesn't bring in too much good either) . Unlike signatures/message digests, the checksum is not made public (the passwords - or their checksum - are stored in a "secure place") and the attacker usually has longer time for cracking a password - until you change it.
    If the attacker got a checksum of a password, it means that the attacker broke your "secure place" - what warranties do you have that the attacker didn't get your salt as well?

    --
    Questions raise, answers kill. Raise questions to stay alive.
  26. Re:When will MD5 be let to die as hash for passwor by simcop2387 · · Score: 1

    This isn't a problem for someone else making a new message from yours, but one where they make the message. Say a contract, given two different texts from the contract they could add some "garbage" data to them to make them have identical signatures. Now this attack would be a little far fetched, as soon as you can produce your copy of the message that hashes the same for the signature, you can prove something fishy is going on, just not what right away.

  27. Re:When will MD5 be let to die as hash for passwor by Short+Circuit · · Score: 1

    The problem with salting: transfer the matter into "security by obscurity".

    Which is what passwords are in the first place, and, by extension, any mechanism of manipulating or digesting them.

    If the repo of you passwords leaks, one can assume the salt grains would leak too. Then you are not better than having the hashed password alone to attack.

    Password hashes are typically stored in a database. The salt is typically part of the configuration store. Most systems (Wordpress being the singular counterexample I can think of) store user data separate from configuration data, and configuration data is usually left flat files. (LDAP is an alternative, but I don't believe most services use it)

    So even if the password hashes leak, it's unlikely the salt will leak.

  28. Re:PHP can't get better. It drives away anyone goo by Anonymous Coward · · Score: 0

    You do realise the reason facebook and wikipedia use it is due to the rest of the web community also using it?

    You do realise that PHP is tried, tested, and working in countless webservers around the world right?

    You do realise that all languages have trade offs, bugs, weird shit, good parts, bad parts, bad developers, good developers and people that make do with a widely accepted language regardless of how "bad" it is?

    You do realise that "bad" is an entirely relative term and just maybe not everyone in the world thinks a bad language is necessarily worse than another for business goals?

    You do realise that nobody in the real world gives a shit about people like you that can't even see the fact that making release, making sales and maximizing profits is more important that your geek status with your dumb ass friends at starbucks and your two bit freelance websites that use "web2.0", "the cloud" and ajax to show a companies "about us" page and "contact us" form?

    I'd ask but I know you don't realise how stupid you look.

  29. Explanation of Bug by Anonymous Coward · · Score: 0

    Here is a good write-up of the bug:

    http://pwnhome.wordpress.com/2011/08/22/php-crypt-bug/

  30. Re:When will MD5 be let to die as hash for passwor by Goaway · · Score: 1

    Typically, salt and hash are stored together as one string, and each password will have its own randomly selected salt.

    Salting is for defending against precomputed dictionary attacks. You're not supposed to keep the salt secret.

  31. Re:PHP can't get better. It drives away anyone goo by onepoint · · Score: 2

    I just had to have a very similar situation for a web site that I wanted, I went out for bids, and got about 5 solid coders, each one real good, each had a quote price with in 4500 of each other, all different languages it all came down to delivery date.

    I took the PHP guy, why, real simple, he said to me, prototype web site in Photoshop in 3 days, working web site idea in a week, beta test on the 14th day, can go live within another week and afterwards with 3 months of support, bug cleaning, and code clean up free. bottom line he said, if it works you'll hire me on the 4th month for years, and then we can recode it in whatever you want.

    the truth of the matter seems that i wanted a delivery date that could be hit, Who knows I might have done something wrong but first to market always get's the attention.

    --
    if you see me, smile and say hello.
  32. Correct me if I'm wrong by magamiako1 · · Score: 1

    I've seen a few people here note the fact that "salts" are used to add complexity to a password where no complexity exists. I believe this is incorrect, or at the very least not entirely the truth.

    Many are assuming that the salt is something that wouldn't be compromised, i.e.

    $SITE_SALT = 'LULZYOUCANTGUESSTHIS';
    $HASH = MD5($SITE_SALT + $PASSWORD);

    I think this is a bit of a misunderstanding. The salt is not necessarily intended to be a secret value unless you can ensure the security of that value, that is the salt is never revealed unless fully guarded (you have a hidden, ultra secure password hashing mechanism that keeps the salt out of the hands of the system).

    In this case, I use mcrypt_create_iv() to generate from /dev/urandom (VPS machine...) and then MD5 that to get a usable salt, then use CRYPT() with its default of 5000 rounds to hash the password via SHA512.

    In this case, the salt generation prevents the generation of usable rainbow tables. This does not stop dictionary attacks, but the added rounds of hashing increases the complexity for brute force attacks.

    TLDR: ENFORCE PASSWORD COMPLEXITY, USE ENCRYPTION OR MANY ROUNDS OF HASHING, AND USE A UNIQUE SALT PER PASSWORD.

    1. Re:Correct me if I'm wrong by Anonymous Coward · · Score: 0

      You are wrong. Salts are used to make rainbow tables (or precomputation) infeasible.

    2. Re:Correct me if I'm wrong by magamiako1 · · Score: 1

      TLDR: "In this case, the salt generation prevents the generation of usable rainbow tables."

    3. Re:Correct me if I'm wrong by fbjon · · Score: 1

      Just one small but important tl;dr addendum: "...use a RANDOM unique salt per password."

      --
      True confidence comes not from realising you are as good as your peers, but that your peers are as bad as you are.
    4. Re:Correct me if I'm wrong by Anonymous Coward · · Score: 0

      Why not just use something standard like PBKDF2?

    5. Re:Correct me if I'm wrong by Anonymous Coward · · Score: 0

      why does enforcing password complexity matter? i actually really hate when sites/programs do this. if i want to make a weak password, shouldn't i be allowed to? as long as the developer is doing everything right on their end, everything is fine. i can maybe understand forcing passwords to be at least x characters, but beyond that it's really annoying. sometimes when signing up for some site i don't care about i like to use a crap password that's easy to remember. i don't want the hassle of having to have "at least one number, one capital letter, one symbol", etc.

  33. Re:When will MD5 be let to die as hash for passwor by Short+Circuit · · Score: 1

    That's not how I've generally seen salts used. Generally, I've seen salts used like "echo $SALT$DATA|md5sum".

    I'm not disputing that the method you describe isn't done, I just haven't seen it done that way.

  34. Re:When will MD5 be let to die as hash for passwor by norpy · · Score: 1

    You should be salting each password with a unique salt - and storing the salt with the hash!

    The reason for salting the password is to invalidate rainbow tables by effectively making the hashing function unique for each password.

    Yes it's a problem for an attacker to get your hashes, but if they do you have made sure they have to break each and every password separately rather than the whole lot at once. Or even worse having precomputed MD5 tables being able to break them immediately.

  35. Re:When will MD5 be let to die as hash for passwor by ais523 · · Score: 1

    What you're missing is that even if they have both the hash/checksum and the salt, they then have to start bruteforcing the password from scratch. Because they didn't know the salt in advance, they couldn't have precomputed a dictionary of hash -> password mappings like you can with unsalted passwords, so each password has to be bruteforced separately. If the passwords aren't salted, and are just plain md5 (say), it's entirely possible that they already know what the md5 reverse-maps to because they've seen it before; it only takes a quick Google to determine that 5eb63bbbe01eeed093cb22bb8f5acdc3 is the md5 hash of "hello world", for instance, whereas if it were salted you'd have to try possibilities from scratch until you guessed that the input was "hello world" (it's kind-of guessable, but it likely wouldn't be near the top of your dictionary, so it'd take a while of brute-forcing to hit it). So, a salt is useful even if it's stored with your password file.

    As another issue, if you don't salt your passwords, merely by comparing hashes you can tell that two users have the same password from a list of hashes. This also means that you could register an account on the site with a common password like "password" and instantly see who else was using it, giving you a load of accounts to quickly compromise...

    --
    (1)DOCOMEFROM!2~.2'~#1WHILE:1<-"'?.1$.2'~'"':1/.1$.2'~#0"$#65535'"$"'"'&.1$.2'~'#0$#65535'"$#0'~#32767$#1"
  36. Re:When will MD5 be let to die as hash for passwor by Anonymous Coward · · Score: 0

    I just had a fun idea, but it requires knowing the salt that will be used, and it doesn't actually have any practical value:

    1. Learn which salt will be used.
    2. Generate a pair of collisions, such that: md5(salt + A) == md5(salt + B)
    3. Register using password A.
    4. Sign in using password B.

    Amaze your friends; you now have two, Two, TWO passwords! Ah. Ah. Ah.

  37. Imagine a Beowulf cluster of test boxes by tepples · · Score: 1

    Unit tests are slow and they almost always pass.

    That's why they make big ass clusters out of big ass multicore computers. Run a test on each core. Beowulf would be proud.

  38. Re:When will MD5 be let to die as hash for passwor by marka63 · · Score: 1

    For passwords it's more like: echo "MD5${SALT}"`echo -n "${SALT}${DATA}"|md5sum`
    where ${SALT} is random and unique to the user.

  39. Who uses that? by Just+Some+Guy · · Score: 1

    Everyone should be using mysql_real_crypt by now.

    --
    Dewey, what part of this looks like authorities should be involved?
    1. Re:Who uses that? by Anonymous Coward · · Score: 0

      mysql_real_crypt has security issues if obscure_real_special_mode is on. Everyone should use mysql_really_real_crypt instead.

    2. Re:Who uses that? by RobNich · · Score: 1

      I thiiiink you're joking? Seriously, though, I've been using mcrypt in PHP for years, even though it's STILL! not even available through yum for CentOS. libmcrypt and mhash have been required by my infrastructure for a long time, and I've never bothered to use the built-in crypt(). I'm a little peeved that there was no unit test that caught this bug, but I'm glad to be unaffected.

      --
      Hello little man. I will destroy you!
  40. Lack of security people? by allenw · · Score: 1

    I wonder if PHP has the same problem we do in Hadoop-land... the lack of enough qualified security people interested enough in a project to actually review code. For example, I'd love for someone with a clue to review Alfredo ( http://cloudera.github.com/alfredo/docs/latest/index.html ) before we build a dependency on it ( https://issues.apache.org/jira/browse/HADOOP-7119 ) . But it seems as though getting the right people involved is extremely difficult. :(

  41. Re:PHP can't get better. It drives away anyone goo by EvanED · · Score: 5, Insightful

    I think that the post you replied to was a bit extreme, but it's not the bug in the library function that caused him to say that: it's the fact that the PHP project lacks the testing infrastructure that any reasonable project of that size would have.

    Anyone can commit a bug; that's easy and excusable. What makes it look like PHP is developed by a bunch of 12 year olds is the fact that they have a test suite with a test that exhibited the bug, and yet no one ran it before they made a release, because they've got too many failing tests so it just got swamped in with that noise.

    I'm working on some dinky pieces of research software, and while we probably don't have as extensive a test suite as PHP does, we have a way better testing regimen. A project like PHP should have a CI server that runs their tests at least nightly, and a release shouldn't be made while there are failing tests. That's what expected failures are for. (They even know about expected failures, but still have over 200 failing tests for some reason.) Even we've got that.

    It's the QA that's messed up, not the coding.

  42. Re:When will MD5 be let to die as hash for passwor by cduffy · · Score: 2

    Of course an attacker who steals your password database knows the salt values in use for each account.

    But unless they have a rainbow table calculated with every possible salt value taken into account, they can't do a simple lookup on a precomputed map of hash values to top-5,000,000-common-passwords and hope to get a match... so their expense to actually break any of those passwords is much, much higher.

  43. Re:PHP can't get better. It drives away anyone goo by EvanED · · Score: 1

    it's not the bug in the library function that caused him to say that

    OK, reading the thread again I may be projecting. But that's my take on the situation anyway.

  44. Re:PHP can't get better. It drives away anyone goo by GNUALMAFUERTE · · Score: 1

    You are laughing at PHP, while grouping .net and java based stuff in the "serious business" category?

    Java and everything .net related are the biggest jokes ever in the history of computing.

    PHP is a simple language that is robust enough to build complex applications. Sure, it's grown organically, and you can see that in its current design, and yes, a bug escapes here and there, but it's unfair to compare it to Perl. For instance, Perl has been stable for 20 years. PHP was totally rewritten in PHP3, and went through yet another major change for version 4. Version 5 is the first real stable release that has most of the features one could expect in a mature, modern language.

    --
    WTF am I doing replying to an AC at 5 A.M on a Friday night?
  45. Re:PHP can't get better. It drives away anyone goo by Firehed · · Score: 1

    No, it actually was a bug in the way the function was called, not the library itself - see comment number four: https://plus.google.com/113641248237520845183/posts/g68d9RvRA1i

    In reality, almost nobody* is going to call md5 via crypt() when a standalone md5() function exists, and people are often slow to deploy new versions of PHP - especially major shared hosting providers. Those who manage their own PHP installs and deploy shortly after release tend to have their own set of unit tests, which very likely would have caught this if their own code was affected (Hmm, I can't login anymore. Suddenly my password hash is only twelve characters long? That's not right...)

    Of course, if you hit all of the worst cases and push this out, yeah, pretty serious problem.

    * Yes, I've seen exceptions to that. Some weird AWS message signing comes to mind, IIRC. Hence "almost".

    --
    How are sites slashdotted when nobody reads TFAs?
  46. Re:When will MD5 be let to die as hash for passwor by Anonymous Coward · · Score: 0

    finding a collision

    it's not a "collision", it's a "preimage". these are technical terms with specific meanings.

  47. Re:When will MD5 be let to die as hash for passwor by Firehed · · Score: 1

    False.

    Unless there happens to be a pre-computed rainbow table that includes the salt of the password (likelihood: practically zero), you are still massively better off. In that case, you'll have to generate your own rainbow tables if there's a single salt for all entries, or go cry yourself into a corner in the hopefully more likely scenario where each entry has its own unique salt (because you now need to bang out a rainbow table for every entry in the users table).

    Nearly all security is based on obscurity (you don't know my password; that's obscure information), so the more obscurity the better. It just happens that port 8080 is a lot less secure than "$0m3 s[]{}per séc®e7 p4sS\/\/0rd", so that better not be your only line of defense.

    --
    How are sites slashdotted when nobody reads TFAs?
  48. Re:Here is "dickhead's" fact-based reply then by hoytak · · Score: 1

    Steve, I know you're pretty animated on stage, but it's just not the same when you're only using boldface and caps.

    --
    Does having a witty signature really indicate normality?
  49. Re:When will MD5 be let to die as hash for passwor by mgiuca · · Score: 2

    Read up on the difference between Collision attack and Preimage attack.

    MD5 is vulnerable to collision, but not yet preimage attacks. The preimage attack the GP is mentioning is something like this: Alice is required to digitally sign off on all money withdrawals from an account, and MD5 is used as a hash algorithm. Bob creates two documents, one saying "I authorize the withdrawal of $100." and another saying "I authorize the withdrawal of $1,000,000." He uses a collision attack to ensure that these two documents both hash to the same MD5 value. He then gives Alice the $100 note to sign. She does so creating a digital signature, which happens to also be valid for the $1,000,000 note (unbeknownst to her). Bob then submits the $1,000,000 request for withdrawal, along with a valid signature from Alice.

    In general, it is Very Bad if two documents can be created with the same hash. But yes, not going to help cracking passwords though.

  50. Use both static and dynamic salts by F69631 · · Score: 1

    If the repo of you passwords leaks, one can assume the salt grains would leak too.

    Current best practices (as defined by what Zend "The PHP Company" recommends, which is relevant here) is a combination of static and dynamic hash. Static is hard coded to your application and won't be compromised unless the whole codebase is compromised. Dynamic hashes are stored to the DB and are different for each user. If just the DB is compromised, attackers won't know the (static part of) salt. If both the DB and the application code are compromised you're obviously fucked in any case but even then it's very slow to find out all the passwords as you need to attack each user separately due to each having different (dynamic) salt.

  51. Re:PHP can't get better. It drives away anyone goo by EvanED · · Score: 1

    Oh, and not only is the project's QA apparently nonexistent (not that they're the only big project that doesn't have useful tests), they also don't have any sense when it comes to their website. OK, they posted a message that 5.3.7 has a severe security bug on their front page; that's a good start.

    But they then should have pulled the release, and made it deliberately difficult to get to. They didn't. If you Google "PHP", the second link is to their download page, and you can grab 5.3.7 from there without ever seeing that warning.

    I'm pretty sure that the project is run by a bunch of 12 year olds.

  52. Worst of all worlds by 93+Escort+Wagon · · Score: 3, Interesting

    I know there's no reason a skilled programmer can't use php, but in my experience the users that request php access are generally the users who you'd least want to have any sort of script-level access to your servers. When I've explained to requestors why we don't generally provide php, I've been told on several occasions "I don't want or need the ability to run scripts! I just want to create php web pages." Oh, and mysql access requests usually come hand-in-hand with php requests.

    I remember one guy, quite a few years ago, who asked us to 1) enable php on our department's web server; and 2) give him access to create and run php scripts. To demonstrate to us that he wasn't just another newbie... he wrote a php script and placed it on his own personal box as a demo of his coding skill. This script let anyone, anywhere, examine the content of any file in the /etc/ directory via an easy to use web interface.

    We politely declined his request.

    --
    #DeleteChrome
    1. Re:Worst of all worlds by multipartmixed · · Score: 1

      > We politely declined his request.

      If this predated /etc/shadow, I would have just mailed him back his root password. :)

      --

      Do daemons dream of electric sleep()?
    2. Re:Worst of all worlds by Anonymous Coward · · Score: 0

      The fact the user in your story could view the /etc directory is not the least bit concerning to me, nor should it concern you.

      As long as you know how to properly secure and administrate your server, there should be no issue giving users PHP access.
      These days, a large majority of web development, and a lot of popular software such as forums and content management systems, use PHP and MySQL (or PostgreSQL).

      There are likely ways to configure your preferred webserver daemon so that users can only modify their own files, given that the permissions are set to allow it for only that user and not everyone.

      Also, look up the usage of open_basedir. It is a PHP configuration variable to allow a user to only open files within the directories specified in the variable. Most webhosting control panels out there already set this.

    3. Re:Worst of all worlds by 93+Escort+Wagon · · Score: 1

      That's all fine if you're running a server for people's personal web pages. We're not. suEXEC doesn't play well with group access.

      --
      #DeleteChrome
    4. Re:Worst of all worlds by Anonymous Coward · · Score: 0

      Good thing suEXEC isn't the only way to do it then, right?

    5. Re:Worst of all worlds by thoromyr · · Score: 1

      As long as you know how to properly secure and administrate your server, there should be no issue giving users PHP access.

      If you add in that you don't care about the server's participation in botnets and facilitation of malware infrastructure, I'll agree with you. But you rather sound like the typical "I want my PHP" whiner that hasn't the foggiest clue about security. And I *do* care about not having servers participate in botnets, so no, we don't and won't allow PHP on our servers. Hosted servers are another matter and for that we rely on detection and remediation. With PHP it isn't a matter of if, but when.

  53. Re:PHP can't get better. It drives away anyone goo by mwvdlee · · Score: 1

    Yup. The problem here seems to be with procedures rather than technology. Bugs happen. What matters is what you do when a bug happens. The bug was reported before release date and the bug should have been marked as a showstopper.
    PHP 5.3.7 should not have been released with a known bug of such magnitude. It's an open source project without commercial interrests; it doesn't matter if a release is delayerd for a couple of days.

    --
    Slashdot social media options: AIM, ICQ, Yahoo, Jabber and Mobile Text. Why no MySpace?
  54. Re:When will MD5 be let to die as hash for passwor by Anonymous Coward · · Score: 1

    Yes, that's how the salt is applied, but then it has to be stored, and Goaway is correct that the usual approach is

    HASH=`echo -n $SALT$DATA | md5sum`
    STORED_VALUE=$SALT:$HASH

    Of course, the *better* approach is to use bcrypt rather than md5 and to store your bcrypt parameters in the string too.

  55. Re:PHP can't get better. It drives away anyone goo by Anonymous Coward · · Score: 0

    You're kidding yourself. JAVA and .NET are platforms suitable for enterprise environments, while PHP isn't. You're right that php is simple language, but it's also suitable for writing only simplest applications.

  56. Re:PHP can't get better. It drives away anyone goo by Anonymous Coward · · Score: 0

    Here's 3 NOPs - come back when you're doing real programming.

  57. Re:An application of... "ReVeRsE-PsyChoLoGy" by Anonymous Coward · · Score: 0
    You do realize that nobody understands what you're saying? There's no point in writing pages of text, half in boldface, if it's all incoherent and barely makes sense. Not only that, the poster you replied to was not trolling, but simply pointing out the flawed reasoning in saying "LAMP is a popular target" without further specification. For example, the study you linked to doesn't say how they selected their respondents.

    Also, your reverse function is terrible, use indexes.

  58. Re:PHP can't get better. It drives away anyone goo by makomk · · Score: 2

    In reality, almost nobody* is going to call md5 via crypt() when a standalone md5() function exists

    Yes they are, because the two don't do the same thing. md5 just calculates the md5 of data, whereas the md5 support of crypt uses salting and a large number of rounds to make password cracking harder.

  59. Re:When will MD5 be let to die as hash for passwor by QuasiSteve · · Score: 1

    If you know what a salt is, you should also know that using the same salt for different accounts is very very bad.

    Yep - but sadly commonplace.

  60. PHK MD5 by Anonymous Coward · · Score: 0

    -sigh-

    What you have here (in crypt) is the PHK MD5 crypt() algorithm. This isn't just "let's run MD5 over a string" or even "run MD5 over a string and some salt".

    PHK's design (and all algorithms in crypt) has both the following features

    1. Multiple iterations. The hash isn't just run once, it's iterated so you have a hash of a hash and so on for many levels. This makes executing crypt() for user logins slow. It thus makes brute force attacks, online or offline far more expensive than they would otherwise be to the point where they're non-viable for decent passwords

    2. Salt. Salt is not a "secret" as one poster seems to think. Instead salt just makes pre-computation (e.g. dictionary attack or rainbow table) worthless. If you understand what a "rainbow table" is you can think of salt as forcing the bad guys to generate a separate rainbow table for each salt value they care about. But generating a rainbow table is only worthwhile if you're going to use the same one hundreds of times or more. With so many possible salt values this'll never happen, so it's pointless and you must resort to brute force, but see above.

    The most modern crypt() routines add a third feature

    3. Variable iterations. As CPUs get more powerful you can wind up the number of iterations to keep it just cheap enough to be affordable for you to verify correct logins, while far too expensive for bad guys to attack.

    The collision attack is completely irrelevant to PHK MD5, digest collision attacks would let you tell person A a password and person B a different (but probably very long and difficult to type) password and have them both work. It's not clear what possible purpose this trick would have, and it certainly doesn't help you to figure out person C's password from its hash.

  61. Re:When will MD5 be let to die as hash for passwor by antifoidulus · · Score: 1

    It still can, salt just makes it impractical. Of course if you had a true Turing machine even salt would be useless, but alas nobody as of yet has come up with an infinite storage device.

  62. Re:When will MD5 be let to die as hash for passwor by Anonymous Coward · · Score: 0

    unix crypt(3)... you must be too young to remember rainbow tables

  63. Re:PHP can't get better. It drives away anyone goo by Hognoxious · · Score: 1

    Sure, it's grown organically

    It's misshapen, blotchy and has bits of shit sticking to it?

    --
    Confucius say, "Find worm in apple - bad. Find half a worm - worse."
  64. Re:PHP can't get better. It drives away anyone goo by Rob+Aley · · Score: 2

    I don't think they should have pulled it, if you don't use the the crypt() function the other fixes and features of the upgrade may well make it a worthwhile upgrade. However I agree that the download page should be marked with this information, not just the front page.

  65. Re:PHP can't get better. It drives away anyone goo by Haeleth · · Score: 2

    A bug in a library function shows how a language is poorly designed?

    No, but releasing an update without even running the existing unit tests shows how amateurish the whole PHP project is. The terrible design of the language is also a reflection of its amateurish nature.

    It's true that some websites manage to do wonderful things with PHP, but then it's also true that some artists manage to make wonderful sculptures out of manure. That doesn't mean it's a good choice for most people.

  66. Re:PHP can't get better. It drives away anyone goo by Anonymous Coward · · Score: 0

    LOL! Thanks for the laugh, bud. Jokers like you are the reason I read Slashdot.

  67. Re:PHP can't get better. It drives away anyone goo by FictionPimp · · Score: 1

    I'll tell my boss that we need to get to work re-writing 90% of what our department has done in the last 5 years as quickly as possible in java. PHP can do anything I need it to do, as besides the occasional security bugs (and this one doesn't seem to effect me), it works great.

    It's the programmer that makes the program, not the language.

  68. Re:When will MD5 be let to die as hash for passwor by gweihir · · Score: 1

    Collision attacks are no threat to passwords. They are a threat to things like certificate signatures when the certificate is made by the attacker.

    Please do not post nonsense.

    --
    Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
  69. Re:JSP doesn't have these problems by Entrope · · Score: 1

    Don't worry, the OSGi people are going to fix the confusing name mess. Pretty soon, those libraries will be OSGi Spring or Struts OSGi or HibernateBeanOSGi.

    But first they need to figure out what OSGi stands for. Or even what it does. (They know it doubles as a sandwich spread and a floor cleaner, and there are a lot of buzzwords involved, but are not quite clear beyond that.)

  70. Re:PHP can't get better. It drives away anyone goo by Lillebo · · Score: 1

    It's the programmer that makes the program, not the language.

    If only I had some mod points for you, but alas you'll have to settle for a measly symbolic +1. Oh, alright - here's a 3 as well.

  71. Re:When will MD5 be let to die as hash for passwor by Short+Circuit · · Score: 1

    I remember rainbow tables...and I remember that salting was the counter to them.

  72. Re:PHP can't get better. It drives away anyone goo by EvanED · · Score: 1

    I disagree. Is there really some super-pressing feature that you can't wait a couple more days for .8? And what if you don't call crypt(), but some library you're using does? Are you that familiar with all of your code base? And what about in the future? What if in 6 months you decide to use crypt(), are you going to remember about this bug? (Hopefully you'd notice that your logins are always successful.)

    I'm not necessarily saying it should be totally unavailable, but I don't think it should be particularly easy to get to.

    (Or maybe I would consider replacing the download with one that unzips to a couple additional higher level directories: this_release_has_a_buggy_crypt/read_security.txt_first/.)

  73. Re:PHP can't get better. It drives away anyone goo by garatheus · · Score: 1

    Having worked with ASP.NET and Java + Wicket (WebSphere, you bastard), I still prefer working with PHP - there's just something about "doing it yourself" that feels just right.

    Trying to simple things in ASP.NET and Java seems so awkward. Trying to create a self-processing page in these languages requires so much extra effort, for something that should be so simple...

    But that's just my observation while trying them out. I'd take programming in PHP over any other language any day - but perhaps its just because I'm that much more familiar with it (and prefer the more low-level that it seems to be compared to having to instantiate tons of different classes just to do something simple like set a session or cookie)...

  74. Re:When will MD5 be let to die as hash for passwor by gorzek · · Score: 1

    Indeed. I remember running some WWWBoards back in the '90s, and even those salted the password. I believe they just grabbed a particular substring of each password and fed it as the salt into the crypt function, so you had a (more or less) unique salt for every password. And that was a simple perl script from the '90s. I would hope everyone is doing at least a little more than that today.

  75. Quoting from php.net's main page by mstefanro · · Score: 1

    "All PHP users should note that the PHP 5.2 series is NOT supported anymore. All users are strongly encouraged to upgrade to PHP 5.3.7."

  76. Re:PHP can't get better. It drives away anyone goo by Joce640k · · Score: 1

    None of that changes the fact that it's a horribly "designed" language

    It was "designed"??? Whoa...I think I just experienced a negative reality inversion.

    --
    No sig today...
  77. Re:PHP can't get better. It drives away anyone goo by Joce640k · · Score: 1

    We all know "real FORTRAN programmers can write FORTRAN in any language" but when fresh young minds are exposed to programming I don't think PHP is an ideal choice. When (eg.) strings can be compared with numbers without so much as a warning you know there's a WTF brewing.

    --
    No sig today...
  78. Re:When will MD5 be let to die as hash for passwor by WuphonsReach · · Score: 1

    The problem with salting: transfer the matter into "security by obscurity".

    The only point of per-site (and ideally per-user) salt is so that a pre-computed rainbow table attack does not work. And salt is a semi-public piece of information. It has to be published in enough places through your code that you must assume that the attacker knows how you salt. And often, the salt is stored right along side the password in the password hash.

    Without salt: attackers create the huge rainbow table of about a billion passwords and their resulting has values. They then obtain your password hashes. Now they can simply look up the hash value, find it in their massive pre-computed rainbow table and use the corresponding password to login to your site.

    Use once - exploit everywhere.

    So, you say, let's use a unique salt for our entire site. Now the attacker's precomputed rainbow table is rendered useless. Now they will either create a new rainbow table (which is a lot of work) or start brute forcing against your password hashes (as salt values *have* to be semi-public in order for them to work). The attack takes longer, but if they do find a password, because you used per-site salts, they can instantly scan the list of the other hashes on your site to see whether any other accounts use that exact same password hash.

    Now you have (1) broken account which allowed them to instantly crack any other account that happened to use the same password.

    Right - now we do per-user salt (which is the proper way). Rainbow attacks no longer work. And the weakness in one account's password does not automatically expose other accounts that also use the same password. Every account has to be individually brute-forced, which slows the attacker down a lot if you enforce some form of password complexity.

    --
    Wolde you bothe eate your cake, and have your cake?
  79. Grave News Indeed by Anonymous Coward · · Score: 0

    I'm sad to see this first dent in PHP's hithertofore untarnished reputation for impenetrable security. Up to now, PHP has been widely perceived as a touchstone of security; the penultimate platform upon which the most secure web sites are based. Truly, this will come as terrible news to all those who have come to depend on PHP's unrelenting security. I guess it just goes to show that toilet paper will eventually yield to the incessant battering of the moth, no matter how many plys it is constructed of.

  80. My mortgage broker let me sit down by Anonymous Coward · · Score: 0

    My mortgage broker let me sit down
    Mortgage north face sale money tight. First-time home buyers plan, the future of the market, the lowest ten percent lower. I was raised that the family is an investment.My mortgage broker let me sit down
    Mortgage north face sale money tight. First-time home buyers plan, the future of the market, the lowest ten percent lower. I was raised that the family is an investment.My mortgage broker let me sit down
    Mortgage north face sale money tight. First-time home buyers plan, the future of the market, the lowest ten percent lower. I was raised that the family is an investment.My mortgage broker let me sit down
    Mortgage north face sale money tight. First-time home buyers plan, the future of the market, the lowest ten percent lower. I was raised that the family is an investment.My mortgage broker let me sit down
    Mortgage north face sale money tight. First-time home buyers plan, the future of the market, the lowest ten percent lower. I was raised that the family is an investment.

  81. Re:PHP can't get better. It drives away anyone goo by Anonymous Coward · · Score: 0

    Words fail me, I hope that comment isn't true (I'll have a go at running the 5.3.7 test suite myself at some point) but if it is then that is unbelievable. Nothing and I mean NOTHING should be getting integrated into the main branch if the tests are failing - nevermind an actual release!

  82. Re:PHP can't get better. It drives away anyone goo by pandronic · · Score: 1

    So what if you can compare strings and numbers? I see that as a plus.

  83. Re:When will MD5 be let to die as hash for passwor by DarwinSurvivor · · Score: 1

    Ah, so the only person that can really take advantage of it would be the person creating the legitimate one as well. It kind of sounded from the original that the attack could be used to impersonate someone. Thanks for clarifying.

  84. Re:When will MD5 be let to die as hash for passwor by mgiuca · · Score: 1

    Hmm, when you say "take advantage of it" are you talking about the well-known MD5 collision attack, or the PHP crypt bug?

    Re the collision attack: I think you are right. But still, advice going around is "don't use MD5". Researchers are still chipping away at it, so there's no telling when they'll have a working preimage attack.

    Re the PHP crypt bug: my understanding is that it's quite serious in that it can throw away the input and just use the salt, causing widespread MD5 collisions. So that could definitely be used to impersonate someone. The former is a slight cryptographic weakness, the latter is a serious bug.

  85. PHP hater hates PHP by Anonymous Coward · · Score: 0

    News at 11.

  86. Re:When will MD5 be let to die as hash for passwor by indeterminator · · Score: 1

    Amaze your friends; you now have two, Two, TWO passwords! Ah. Ah. Ah.

    Why not go a bit further? There are infinite number of inputs for a hash function that produce the same output.