TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Authentication Cheat Sheet

307 pointsby colundover 10 years ago

22 comments

oneeyedpigeonover 10 years ago
&quot;Applications should enforce password complexity rules to discourage easy to guess passwords.&quot; - ARGH!<p>To clarify, to avoid downvotes for a non-&#x27;productive&#x27; comment, I firmly disagree since this will probably result in me having to pick a password that&#x27;s harder to remember than I otherwise would. It might also might it more awkward to type quickly, making shoulder-surfing easier.<p>(Note that this is probably not i18n-friendly, either)
评论 #8984761 未加载
评论 #8985087 未加载
评论 #8985045 未加载
评论 #8984781 未加载
评论 #8984904 未加载
评论 #8990672 未加载
评论 #8985068 未加载
评论 #8989083 未加载
评论 #8984669 未加载
评论 #8986480 未加载
评论 #8984743 未加载
评论 #8984738 未加载
评论 #8990051 未加载
评论 #8985702 未加载
beobabover 10 years ago
&quot;An application should respond with a generic error message regardless of whether the user ID or password was incorrect.&quot;<p>I really don&#x27;t like this advice (although I see why they put it in there).<p>I often use different email addresses for different services so that I can determine who sells on email addresses (depending on how much I trust them), and quite often I can&#x27;t remember which email address I signed up with (was that mojang@...com or minecraft@...com).<p>At least if I see &quot;user not recognised&quot;, I know to try a different email address.
评论 #8986116 未加载
评论 #8984879 未加载
评论 #8984988 未加载
评论 #8985408 未加载
评论 #8984887 未加载
billyhoffmanover 10 years ago
<i>&quot;Maximum password length should not be set too low, as it will prevent users from creating passphrases. Typical maximum length is 128 characters.&quot;</i><p>Why would you ever have a maximum password length at all? bcrypt or (god forbid) your secure hashing algorithm of choice doesn&#x27;t care about input length, and has a fixed output length to stick in a database. Why on earth would you limit the password length beyond anything so insanely large (1024, etc) to not even matter?
评论 #8985378 未加载
评论 #8985841 未加载
评论 #8985498 未加载
评论 #8988352 未加载
评论 #8985382 未加载
评论 #8985772 未加载
评论 #8985403 未加载
birdmanjeremyover 10 years ago
Every time you introduce a password constraint, you&#x27;ve reduced the potential password complexity. I absolutely hate arbitrary password requirements. &quot;not more than 2 identical characters in a row&quot;? WTF? Stop with this nonsense.
评论 #8985040 未加载
评论 #8984967 未加载
评论 #8987392 未加载
AUmryshover 10 years ago
A big one I&#x27;ve seen is more related to the TLS cheat sheet [1] they link to on that page.<p>Many sites will send session tokens over http because they don&#x27;t set the &quot;secure&quot; cookie flag. It&#x27;s a simple thing to do, and prevents a malicious ARP poison or DNS attack from potentially hijacking an account.<p>You&#x27;d be surprised how many sites are vulnerable to such attacks. Reddit, parts of Ebay, several university websites, and many other sites still are vulnerable to session hijacking.<p>I think people writing web libraries need to start building &quot;sane defaults&quot; concerning security. All cookies should be secure by default, and only those who know what they are doing should turn them off. It&#x27;s not that much extra overhead, and the potential benefits outweigh the increased processing and bandwidth.<p>1: <a href="https://www.owasp.org/index.php/Transport_Layer_Protection_Cheat_Sheet#Rule_-_Use_.22Secure.22_Cookie_Flag" rel="nofollow">https:&#x2F;&#x2F;www.owasp.org&#x2F;index.php&#x2F;Transport_Layer_Protection_C...</a>
评论 #8986558 未加载
评论 #8989518 未加载
pc86over 10 years ago
&gt; not more than 2 identical characters in a row (e.g., 111 not allowed)<p>Why? If my password is <i>id8FK38f@&amp;&amp;#d</i> is it inherently less secure if <i>111</i> appears in the middle of it somewhere?
评论 #8986636 未加载
评论 #8986266 未加载
darkhornover 10 years ago
Some of the suggestions are bad. Why they are enforcing English characters? Like a-z? For example in Github I write щ and then it wants me to write a lowercase letter. WTF? It is lowercase! And more secure than an English letter!
samspotover 10 years ago
Do people REALLY brute force passwords? Do people REALLY brute force all lowercase, all latin combinations up to 20 characters before trying symbols, uppercase and numbers?<p>I am very skeptical that the &#x27;3&#x2F;4 complexity rules&#x27; approach is making systems meaningfully more secure. I&#x27;ve had all kinds of passwords, but I&#x27;ve never lost them to brute force. Every time it was because someone got inside a company and made off with the database.<p>If complexity rules don&#x27;t add anything, they should be discarded in the name of usability.
评论 #8986430 未加载
评论 #8986335 未加载
cddotdotslashover 10 years ago
Just a hypothetical, but what if an application started encouraging users to enter a &quot;login sentence&quot; instead of a password. i.e.: &quot;Please enter a sentence that you&#x27;ll be asked to remember each time you login.&quot; Obviously, the standard constraints of length and complexity (albeit slightly altered) can be enforced.<p>It&#x27;s much easier for me to remember &quot;Please close the window, I&#x27;m cold.&quot; then it is for me to remember &quot;XSDJd94*(lo03X.._&quot;.<p>The &quot;horse battery staple&quot; XKCD comes to mind.
评论 #8985165 未加载
评论 #8984848 未加载
评论 #8990074 未加载
Karunamonover 10 years ago
<i>The correct response does not indicate if the user ID or password is the incorrect parameter and hence inferring a valid user ID.</i><p>ARGH. This is a usability nightmare - moreso when the recovery system implements the same rule.<p>&quot;Okay, I had an account on this website, which email address was it again?&quot;<p><i>try logging in a few times</i><p>&quot;Hm.. I must have forgotten the password. Off to reset!&quot;<p><i>go through the recovery process</i><p><i>recovery page indicates an email will be sent</i><p><i>email never comes</i><p>&quot;Wait, so are they being &#x27;really secure&#x27;, or is email just broken right now?&quot;<p><i>wait a couple hours</i><p><i>forget about the site</i>
评论 #8988970 未加载
bohinjcover 10 years ago
<p><pre><code> The application may return a different HTTP Error code depending on the authentication attempt response. It may respond with a 200 for a positive result and a *403* for a negative result. </code></pre> I would say a <i>401 - Unauthorized</i> with proper <i>WWW-Authenticate</i> header.<p>403 means forbidden, which apply to when you try to access a resource without permission &#x2F; authorization<p>Also, in their <i>Password Storage Cheat Sheet</i> [<a href="https://www.owasp.org/index.php/Password_Storage_Cheat_Sheet" rel="nofollow">https:&#x2F;&#x2F;www.owasp.org&#x2F;index.php&#x2F;Password_Storage_Cheat_Sheet</a>], they seems to recommend :<p><pre><code> Select: PBKDF2 [*4] when FIPS certification or enterprise support on many platforms is required; scrypt [*5] where resisting any&#x2F;all hardware accelerated attacks is necessary but support isn’t. bcrypt where PBKDF2 or scrypt support is not available. </code></pre> AFAIK, things are not so binary :<p>* <a href="https://news.ycombinator.com/item?id=3724560" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=3724560</a><p>* <a href="http://security.stackexchange.com/questions/4781/do-any-security-experts-recommend-bcrypt-for-password-storage/6415#6415" rel="nofollow">http:&#x2F;&#x2F;security.stackexchange.com&#x2F;questions&#x2F;4781&#x2F;do-any-secu...</a><p>* <a href="http://security.stackexchange.com/questions/26245/is-bcrypt-better-than-scrypt/26253#26253" rel="nofollow">http:&#x2F;&#x2F;security.stackexchange.com&#x2F;questions&#x2F;26245&#x2F;is-bcrypt-...</a>
评论 #8986692 未加载
dpwebover 10 years ago
Simplicity should be a primary goal in the methods used to protect systems. Just because the methods to protect are easy, doesn&#x27;t mean its easy to crack. For instance, a decent size password and lockout and you&#x27;re set as far as brute force attacks. They are not going to guess a 10 letter password in 5 tries. After x tries, make them reset. Two factor auth for <i>really</i> important stuff, isn&#x27;t that pretty much it.<p>I believe we&#x27;re seeing more successful attacks from the use of security techniques that are unnecessarily complex and not completely understood (or partially implemented) by most engineers - than cause passwords aren&#x27;t long enough.
snarfyover 10 years ago
Password complexity rules are stupid. The only thing that matters is the total entropy. &quot;Entropy too low&quot; is the only error a user should receive when coming up with a password.<p>Those complexity rules are the result of an entire industry blindly following the best practices of an old unix DES crypt function. It&#x27;s dumb and it should stop.<p><a href="http://security.stackexchange.com/questions/33470/what-technical-reasons-are-there-to-have-low-maximum-password-lengths" rel="nofollow">http:&#x2F;&#x2F;security.stackexchange.com&#x2F;questions&#x2F;33470&#x2F;what-techn...</a>
评论 #8990151 未加载
pippyover 10 years ago
He forgot an important modern rule on authentication: don&#x27;t do it.<p>If you can get another system to do it for you; persona, OpenID, Github, Google, Facebook, or twitter it&#x27;s more secure for the end user. They have features such as two factor authentication, fraud detection, manage password resets for you, and the end user is more likely already have an account.<p>Many developers don&#x27;t agree with this on a moral level, as you are giving power to third party. However developers are developers, and if you do it yourself you&#x27;re bound to do at least one thing wrong.
评论 #8986866 未加载
Gargoyle888over 10 years ago
Isn&#x27;t 2FA the best approach? I&#x27;m just asking.<p>A problem here where I work is that every application must have a different password and it must change every 90 days. Consequently everyone has a spreadsheet with his passwords written down because nobody could possibly remember them all.<p>It seems to me that with 2FA, one simple password is adequate. Two independent devices need to be compromised and brute force is ineffective since the turn around time is at least several seconds between tries.
评论 #8984990 未加载
peterwwillisover 10 years ago
This doesn&#x27;t touch on commercial authentication managers and how horribly they can be implemented. There&#x27;s no authorization cheat sheet either.<p>They also make assumptions like &quot;When multi-factor is implemented and active, account lockout may no longer be necessary.&quot; Sure, until someone finds a simple hole in one of the factors and the rest become trivially brute-forced, sniffed, phished, etc. The chain is only as strong as the weakest link.
zobzuover 10 years ago
I dont really like this page. Its a good effort.. but. (no ands!).<p>- Most things are just a flyby, such as &quot;hey look heres a paragraph that tells your what MFA is&quot;. but doesnt tell you how to use it.<p>- Password rules are outdated &quot;use caps, 10 char, numbers, etc!&quot;. The horse staple blabla has been the new standard for yearS now... and is way better.. generating the password for the user is often not a bad idea<p>- no mention of upcoming techs like FIDO&#x2F;U2F
sekasiover 10 years ago
This is not a accusing comment, but more of a request for more information:<p>&quot;Passphrases shorter than 20 characters are usually considered weak if they only consist of lower case Latin characters.&quot;<p>This goes against the concept of diceware generated passwords of 4-6 short words doesn&#x27;t it? Where in this equation am I getting it wrong? I&#x27;ve been approaching passwords like this for a while now.
jakubpover 10 years ago
&quot;An application should respond with a generic error message regardless of whether the user ID or password was incorrect. It should also give no indication to the status of an existing account.&quot;<p>If so.. then how to respond on user registration page when someone tries to open a new account with username &#x2F; email address of an existing account?
评论 #8985783 未加载
caseyf7over 10 years ago
and if you use email addresses as user names, verify they actually own the email address. Apple doesn&#x27;t do this, and I&#x27;m amazed at how many people sign up for iTunes with email addresses I control.
homakovover 10 years ago
OTP passwords dont fight client side malware lol.
jjarmocover 10 years ago
Some of this is good advice, but there&#x27;s a BIG point on the &#x27;Password Storage Cheatsheet&#x27; that&#x27;s linked and referenced by the above article, that I don&#x27;t think is solid. <a href="https://www.owasp.org/index.php/Password_Storage_Cheat_Sheet#Leverage_Keyed_functions" rel="nofollow">https:&#x2F;&#x2F;www.owasp.org&#x2F;index.php&#x2F;Password_Storage_Cheat_Sheet...</a><p>Specifically, it suggests storing passwords using: `return [salt] + HMAC-SHA-256([key], [salt] + [credential]);`<p>It goes on to note that the key must be protected as private, strongly random, and stored outside the credential store, while the salt (can we please call it a nonce?) can be safely stored against credentials.<p>I&#x27;m still not comfortable with this construction. Stick with their earlier advice and use scrypt, bcrypt, or PBKDF2. That&#x27;s my order of preference too, which differs from theirs somewhat, but that&#x27;s a minor quibble; all three are reasonable.<p>The problem with their construction is that HMAC-SHA-256() is designed to be fast, and so attackers have the opportunity to make a lot of guesses quickly. The secrecy of the key helps over a straight SH256(...), but not a lot for the following reasons:<p>1 - It assumes an attacker who compromises the credential store won&#x27;t also have the key.<p>2 - It assumes an attacker is unable to recover the key.<p>1) is a valid assumption for certain classes of attack. If your key is stored in an environment variable or something, while credentials are stored in a database, an attacker who compromises your database via a SQL injection won&#x27;t have the key. But the problem is that an attacker who compromises the application may. If I have full remote code execution on the server (and you have a bad day then, passwords aside) I&#x27;ll have the key. Or maybe an attacker has an arbitrary file read (not quite as bad a day), and you store your key in a flat file on disk. Or an attacker can cause your application to generate a stack trace (disclosing runtime details) and view the key...<p>You get the idea - there&#x27;s lots of potential ways to get that key regardless how you store it, and everything hinges on that. Once they have the key, they can mount dictionary or brute force attacks against credentials just as they would against `SHA256([salt]+[credential])`<p>2) is a valid assumption only if the attacker doesn&#x27;t know a single password&#x27;s plaintext value and the key is sufficiently long and random. If I know the password to my own account (and I likely do) or any other account (let&#x27;s say one user on the site uses a password that was recovered in another breach) this scheme fails.<p>Suppose my salt is &quot;SALTYSALT&quot; (okay, so my PRNG sucks; also a detail to be wary of) and my password is ye olde &quot;PASSWORD&quot; (yah, this sucks too.. but it&#x27;s my crappy password. Maybe I added it just to observe the resulting HMAC value?) Now I can just try calculating `HMAC-SHA-256(&quot;A&quot;, &quot;SALYTSALT&quot; + &quot;PASSWORD&quot;)` If that doesn&#x27;t match, try `HMAC-SHA-256(&quot;B&quot;, &quot;SALYTSALT&quot; + &quot;PASSWORD&quot;) and so on. The one thing I don&#x27;t really know that would help is the length of the key. If it&#x27;s long enough (We&#x27;d want at least 256 bits), and strongly random, I may have a difficult time. It it&#x27;s short (And they make no recommendation on it&#x27;s length, just that you &quot;Generate the key using cryptographically-strong pseudo-random data&quot;), I&#x27;m going to crack the key, and then I&#x27;m back to attacking all the other credentials.<p>I <i>MIGHT</i> be convinced of this being reasonable if it can be ensured that all the HMAC calculations are done in something like an HSA or TPM which generates a large key internally and doesn&#x27;t expose it, even to the application. But that&#x27;s probably not the scenario we&#x27;re talking about here. Even then, you&#x27;ve got nothing to lose by using an adaptive algorithm rather than the HMAC construct. For anything else, it&#x27;s far safer (and easier really!) to use scrypt, bcrypt, or PBKDF2. So just do that.
评论 #8989438 未加载