Giter Site home page Giter Site logo

Comments (6)

ericelliott avatar ericelliott commented on June 12, 2024

Why does hiding the iteration count make it difficult to implement in another language?

from credential.

EvanCarroll avatar EvanCarroll commented on June 12, 2024

How am I going to implement it in another language without knowing the iteration count? The user of this module is not going to know the actual number of iterations without reading the source and obfuscating whatever you're intending to do with work_key.

from credential.

EvanCarroll avatar EvanCarroll commented on June 12, 2024

I've actually implimented my own version of this called co-crypto-saltedhash

from credential.

ericelliott avatar ericelliott commented on June 12, 2024

Your default iterations are dangerously low. Even cheap commodity hardware would be able to crack those hashes too quickly. You need closer to 60,000 iterations to get into safe territory for 2014, and next year, the standard will be different, so it's important that it's easy to reconfigure without breaking existing passwords (safest way). If you have to break user passwords, you'll have to have a secure password change mechanism to prevent user lock-outs.

That's why credential includes all the information necessary (minus the work secret) to check the hash:

{
  hash: hash,
  salt: salt,
  keyLength: keyLength,
  hashMethod: hashMethod,
  workUnits: workUnits
}

All this gets stored with the passwords. That way you can easily move the work units to keep up with changing technology without locking users out. Just remind them to change their password when they log in if they're using the outdated work unit standard.

Credential hides the work secret by default (though it does have a sensible fallback if you don't want to use that feature) because of security in layers. It's that much harder to breach the password database if you have no idea how many iterations to try.

from credential.

ericelliott avatar ericelliott commented on June 12, 2024

I would not recommend rolling your own solution for this stuff. Credential was audited by as many security professionals as I could find before it was published, and I'm still nervous about it, for good reason. Password security is currently one of the largest weaknesses in online security -- a much more dangerous threat than even the most sophisticated XSS or injection attacks, because of the potential impact if there's a password database theft. Proceed with caution.

from credential.

ericelliott avatar ericelliott commented on June 12, 2024

BTW, your verify function is vulnerable to a variable time equality attack.

from credential.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.