Slashdot Mirror


PHP Now Supports Argon2 Next-Generation Password Hashing Algorithm (bleepingcomputer.com)

An anonymous reader quotes Bleeping Computer: PHP got a whole lot more secure this week with the release of the 7.2 branch, a version that improves and modernizes the language's support for cryptography and password hashing algorithms.

Of all changes, the most significant is, by far, the support for Argon2, a password hashing algorithm developed in the early 2010s. Back in 2015, Argon2 beat 23 other algorithms to win the Password Hashing Competition, and is now in the midst of becoming a universally recognized Internet standard at the Internet Engineering Task Force (IETF), the reward for winning the contest. The algorithm is currently considered to be superior to Bcrypt, today's most widely used password hashing function, in terms of both security and cost-effectiveness, and is also slated to become a favorite among cryptocurrencies, as it can also handle proof-of-work operations.

The other major change in PHP 7.2 was the removal of the old Mcrypt cryptographic library from the PHP core and the addition of Libsodium, a more modern alternative.

33 of 94 comments (clear)

  1. Jeez by Anonymous Coward · · Score: 1

    I just got done converting everything to bcrypt!

  2. Great by Hognoxious · · Score: 4, Insightful

    So now all we have to worry about with PHP is everything else.

    --
    Confucius say, "Find worm in apple - bad. Find half a worm - worse."
    1. Re:Great by wimg · · Score: 2

      Which is the same for Ruby, Python, Perl, .Net, Java, Go and every other language. If you don't know how to code, the language doesn't matter.
      Perhaps a more constructive comment next time ?

    2. Re:Great by Anonymous Coward · · Score: 1

      All languages have issues. But PHP is in a special category of bad. It is a language for and by hacks.

    3. Re:Great by geekymachoman · · Score: 1

      Actually, PHP is pretty decent now as of version 7.1, with massive improvements over earlier versions + it remained backward compatible (for the most part).
      Just shows that core PHP developers are committed.

      Still too easy to make mistakes, that's it's biggest flaw. Too many new programmers copy/pasting outdated code from examples on internet without understanding how it works, and it allows you to do pretty much everything. With proper design, and testing this is not an issue, but again.. many don't do any of this.

    4. Re:Great by slashrio · · Score: 1

      One question:
      Has the NSA been involved in this crypto scheme?

      --
      "Trump!!", the new Godwin.
    5. Re:Great by Wraithlyn · · Score: 1

      “There are only two kinds of languages: the ones people complain about and the ones nobody uses.”—Bjarne Stroustrup

      --
      "Mind, as manifested by the capacity to make choices, is to some extent present in every electron." -Freeman Dyson
  3. Re:Oh, wow! by guruevi · · Score: 4, Insightful

    Facebook, Laravel, Own/Nextcloud, Wikipedia, Wordpress, ... more than 80% of the web runs on PHP.

    --
    Custom electronics and digital signage for your business: www.evcircuits.com
  4. Hashing by Pieroxy · · Score: 1

    I usually store passwords salted and hashed 100 to 500 thousand times with SHA-256 or MD5.

    Should I switch to this now ?

    1. Re:Hashing by DontBeAMoran · · Score: 2

      Dude, that's way too much sodium!

      --
      #DeleteFacebook
    2. Re:Hashing by PhrostyMcByte · · Score: 1

      The primary purpose of recent key derivation algorithms like Argon2 is to guard against GPU-accelerated brute-forcing. Traditional methods like salted hashes or PBKDF2 are otherwise still secure.

    3. Re:Hashing by nospam007 · · Score: 1

      "I usually store passwords salted and hashed 100 to 500 thousand times with SHA-256 or MD5.

      Should I switch to this now ?"

      Argon 2? No, Helium 3 is apparently the future.

    4. Re:Hashing by Pieroxy · · Score: 1

      Care to elaborate ?

    5. Re:Hashing by K.+S.+Kyosuke · · Score: 1

      Argon 2? No, Helium 3 is apparently the future

      Not to mention that Russians have already been using Argon-16 for decades. So PHP is fourteen versions behind!

      --
      Ezekiel 23:20
    6. Re:Hashing by Megol · · Score: 1

      Which means it is a lossy type of compression. Deliberately lossy and very sensitive to small changes in the input (avalanche effect) but still a type of compression.

  5. How is this supposed to work? by Anonymous Coward · · Score: 1

    If I understand correctly, Argon2 is "memory hard" hashing. It takes a lot of memory to run efficiently in an effort to confound FPGAs and ASICs. How is this supposed to work in an embedded system such as IoT? Those devices are very tiny and might not have enough memory. Isn't delaying 1 second after a failed password attempt enough?

    1. Re:How is this supposed to work? by TheRealMindChild · · Score: 1

      This isn't just about a client authenticating, but you have to consider if someone wanted to build a rainbow table or just bruteforce a list of hashes they got a hold of. For an embedded system, doing one hash and verify won't be too heavy

      --

      "When life gives you lemons, don't make lemonade. Make life take the lemons back!" -- Cave Johnson
  6. Please by eddeye · · Score: 4, Insightful

    Author knows nothing about security. Updated crypto algorithms / libraries have next to nothing to do with application security.

    How many apps are hacked through outdated crypto algorithms? Now how many are hacked through unchecked user input, careless key/password handling, privilege escalation, default passwords, sensitive files left in open locations, and other programming errors?

    There's a reason OpenBSD is one of (if not the) most secure operating systems. Code audits, careful input / output checking, sane error handling, etc. It has nothing to do with crypto algorithms.

    --
    Democracy is two wolves and a sheep voting on lunch.
    1. Re:Please by PhrostyMcByte · · Score: 5, Insightful

      Author knows nothing about security. Updated crypto algorithms / libraries have next to nothing to do with application security. How many apps are hacked through outdated crypto algorithms?

      You've missed the point. This is a second line of defense intended to protect your users after your app has been hacked, when the attacker has dumped your database of password hashes. It helps to prevent them from using GPU-accelerated brute forcing to reverse user passwords that would then be plugged into other websites.

    2. Re:Please by 93+Escort+Wagon · · Score: 4, Insightful

      Well... you have to remember the context. There was a time when php’s crypto was fundamentally broken, and its developers apparently debated whether they were going to fix it or not.

      Php has had an abysmal security history - so these sorts of steps are important moves in the right direction.

      --
      #DeleteChrome
  7. Re:Oh, wow! by wimg · · Score: 1

    Uh... https://developers.slashdot.org/story/17/02/21/2039256/php-becomes-first-programming-language-to-add-modern-cryptography-library-in-its-core

  8. Re:Oh, wow! by DontBeAMoran · · Score: 1
    --
    #DeleteFacebook
  9. That doesn't make PHP more secure by wonkey_monkey · · Score: 1

    PHP got a whole lot more secure this week with the release of the 7.2 branch, a version that improves and modernizes the language's support for cryptography and password hashing algorithms.

    Adding new cryptography and hashing methods doesn't make the language itself more secure.

    --
    systemd is Roko's Basilisk.
    1. Re:That doesn't make PHP more secure by Antique+Geekmeister · · Score: 1

      Compared to the limited and less secure hashing previously available, I'd suggest that it does make it more secure. It wouldn't address the other commonplace issues.

  10. Re:Oh, wow! by OrangeTide · · Score: 2

    Facebook, Laravel, Own/Nextcloud, Wikipedia, Wordpress, ... more than 80% of the web runs on PHP.

    I've heard of maybe half of those, I didn't realize all of them were still around.

    I remember letting people run php on my shell/web server some 15 years ago. And how quickly the default installation was hacked and webpages were defaced. For me it wasn't worth the effort necessary to set it up properly.

    --
    “Common sense is not so common.” — Voltaire
  11. bcrypt is still great by bussdriver · · Score: 1

    My own tests with Argon2 prove that with it's lowest setting it loads my current server down too much for the hash rate I was getting with bcrypt. I do not have the ability to fine tune it's server load well enough at this point so I've not switched over password hashing to it at this time. Also, I have less free RAM than I'd like to allocate so the benefits of argon2 are significantly limited for me at this time... It is going to be a trade off between server resources and massively parallel GPU attacks and the RAM use is primarily the new defense of Argon2 (not so much parallelism since that is still an area of growth for hardware.)

    I've seen tests run with GPU hashing implementing a huge list of algorithms where bcrypt was 100x better than everything else and for the test it was only set to 5! Nobody uses bcrypt set at complexity 5! no benchmarks vs Argon2 other than my own (using server cpus.)

    Somebody with bcrypt in FPGAs might knock the wind out of it but bcrypt at level 10+? Going forward, I've already been migrating to argon2 and I will look into formatting it into standard password hash format now that I know it's being used this way; however, I will still be limiting it until server upgrades... and further Argon2 benchmarks performed on gpus, fpgas because it won't matter if my server needs weaken Argon2 too much. (At which point I guess we need to start getting gpus for servers?)

  12. Re:Oh, wow! by Anonymous Coward · · Score: 1

    CREIMER' SUBMISSIONS UPDATE:
    Note also that creimer is trying to regain karma by getting his submissions published as articles on /. so make sure to go to:
    https://slashdot.org/~cdreimer
    and mod down his submissions as well. The great thing is that you don't even need mod points to mod down a submission, just click on the "minus" icon!

    creimer wrote:

    I don't bother with mod points. I'm doing something much more sinister. It took ten story submissions ? I'll have to double check the number ? to move cdreimer's karma from neutral to excellent without ever being exposed to the capricious mods. Mmmmmwwwwahahahahahahaha!

    https://slashdot.org/comments....

    Danger, Will Robinson, Danger! Creimy is posting more than 2 posts a day. Hurry! mod down otherwise /. will go to hell again!

    Note: you can mod down even if already at -1 to lower karma and to prevent lost /. users to accidentally mod up.

    creimer wrote:

    All you need to do is find a website with a permissive TOS, say, Slashdot, create a Python script to scrape your own comments, sprinkle Amazon affiliate links in various posts, and then re-post past links whenever possible. Won't be long before you start making "coffee money" each month.

    https://slashdot.org/comments....

    C.D. Reimer is a renowned Slashdot collaborator, as he puts it himself; "Because of the quality of my posts and my article submissions, I'm a highly rated commentator and moderator."

    But does anybody ever wondered what "C.D." stands for? Well, it stands for Creimy Dumpty of course!

    Creimy Dumpty sat on the wall,
    Creimy Dumpty had a great fall.
    All the king's horses
    And all the king's men
    Couldn't put Creimy Dumpty
    Together again.

    Creimy's siblings video and theme song, very realistic, especially the pants, just like Creimy's:
    https://www.youtube.com/watch?...

    With "Vice President Pence Vowing US Astronauts Will Return To the Moon", we are sure they will need miracle workers up there, here is what it would look like. Note that Creimy takes care of bringing a lot of food to the moon as depicted below:
    https://www.youtube.com/watch?...

    Creimy's real pictures:
    Before the sex change:
    https://ibb.co/cc7Ddw
    After the sex change:
    https://ibb.co/gVad65

    Creimy's "enterprise-level" chair, he talks about it all the time on slashdot:
    http://www.keynamics.com/image...

    Creimy's head, while his supervisor was talking to him, not with him, since it is impossible to do with Creimy:
    http://ibb.co/mRVSaG

    Creimy acting in educational resource document, he actually confirmed himself on Slashdot that he was handled by Special Education for the Santa Clara County Office of Education! He is really a king Dumpty!:
    http://www.sccoe.org/depts/stu...

  13. That's nice but Argon2 has problems by Anonymous Coward · · Score: 1

    There was a mismatch between the specification and the example code/known answers.

    Unless that's been fixed in the last few weeks anyone implementing Argon2 will get burned.

  14. This is what makes PHP so powerful. by Qbertino · · Score: 2

    The PHP crew doesn't hesitate for a second to add in a feature that's useful. PHP gets the job done and that's why it's still holding it's ground even after each and every rails and node fad that comes along.

    --
    We suffer more in our imagination than in reality. - Seneca
    1. Re:This is what makes PHP so powerful. by Waccoon · · Score: 1

      The reason I used PHP is because when I started my web site, I bought space on a shared server, and the only languages available were Perl and PHP. Perl was a PITA because of all the shebang lines (among other annoyances when you don't have admin rights).

      In my case, much like JavaScript, I used it because it was really the only option -- not a good one.

    2. Re:This is what makes PHP so powerful. by Rutulian · · Score: 1

      Wait...really?

      Perl is a PITA because you have to write "#! /usr/bin/env perl" at the top of your script instead of just mashing out a bunch of html mixed with code?

    3. Re:This is what makes PHP so powerful. by Waccoon · · Score: 1

      It is on shared hosts when they implement stupid security rules that break things. When I started I was just writing my own homepage and a simple BBS -- no way was I going to pay for dedicated hosting for that.

      After more than a decade maybe things are different today, but back then, only PHP worked reliably.

    4. Re:This is what makes PHP so powerful. by Rutulian · · Score: 1

      There are plenty of people using Perl on shared hosts, so it really shouldn't be a problem. As far as modules go, I can't imagine what would be available in a default PHP that wouldn't be provided for Perl on a shared host, but there are plenty of ways to install local modules if need be. Heck, you can even install a full Perl distribution locally and avoid the system Perl entirely, which is something you cannot do with PHP. Also, Perl had CGI::Application (http://search.cpan.org/~markstos/CGI-Application-4.50/lib/CGI/Application.pm) long before PHP had CakePHP or Zend. A decade ago MVC frameworks were the new hotness, and Perl had Catalyst, which was quite comparable to CakePHP.