by raverbashing · 10y ago · 0 comments
It's a bit tricky to fail someone in an interview because they don't know security. I think the better way to handle security in a company is to hire a programmer that knows it and teaches it to other programmers during code reviews.
http://security.stackexchange.com/questions/211/how-to-secur...
https://paragonie.com/blog/2016/02/how-safely-store-password...
In PHP:
$storeMe = password_hash($plaintext, PASSWORD_DEFAULT);
if (password_verify($plaintext, $storeMe)) {
// Logged in
}
The detail is totally abstracted away. All sane password hashing libraries offer this API.See: https://paragonie.com/blog/2016/02/how-safely-store-password...
EDIT - CANNOT REPLY:
> One major failure of this article:
>
> You should generate a random salt for each user and store it alongside the user
> record in the DB.
No, you shouldn't. Your library should do that for you, and store it as a single string that's opaque to the developer. > I completely disagree. This implies that my DB ORM handles password stuff,
> which doesn't make sense.
See the passlib section: https://paragonie.com/blog/2016/02/how-safely-store-password...It's strange that candidates would be expected to have any knowledge of security when security is very hard to get right. This is the domain of a dedicated specialist, not a generalist who's usually pressed for time and whose work usually isn't audited.
If you want to get security 90% right, you can spend a few days doing the cryptopals challenges. But you need to get security 100% right, because 90% right means your systems can be compromised. A situation like that pretty much demands security audits.
(It doesn't help that the go-to answer of "Who should we contact to get a security audit?" is "Someone that will charge half a year's salary of a decent engineer," though.)
If you want secure systems, audit them.
In the worst case, they may recommend outdated or harmful practices that will actually lower security. For example, complex password rules and rotations instead of strength checking and password managers. This leads to users just writing things down since they can't memorize ever changing passwords. Or they may force you to install antivirus on systems that don't need it, even though antivirus systems have been shown to be full of security flaws that actually weaken system security when installed into privileged or sensitive subsystems.
Paper security is distinct from genuine security. They overlap certainly, but paper security is not enough to make you secure.
That is to say, you can tell someone to google and they'll find "Use bcrypt", but they'll still feel scared and confused because they don't even know if this is quality suggestion or not let alone what bcrypt is doing and why it's better than MD5.
https://paragonie.com/blog/2015/08/you-wouldnt-base64-a-pass...
Look at how TalkTalk ignored a security researcher's warnings a year before incurring a major attack. They were also storing in plain-text, available to support staff, and came up with comments like "We're squeaky-clean on security". This is a PR response, not one from the engineers who know what's going wrong. https://paul.reviews/value-security-avoid-talktalk/
In practice, there's a lot more things involved leading to stupid decisions like this. Something that was supposed to be temporary made permanent by growing technical debt, unclear responsibilities, moving priorities, etc.
Security is never any company's top priority just because it's not visible. Changing a color of a button is normally more important.
It's mind-boggling how many well-known companies stored passwords badly.