<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Tom Moertel's Weblog: Never store passwords in a database!</title>
    <link>http://blog.moertel.com/articles/2006/12/15/never-store-passwords-in-a-database</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Quality rants on programming theory and stuff geeks like</description>
    <item>
      <title>Never store passwords in a database!</title>
      <description>&lt;p&gt;Recently, the folks behind &lt;a href="http://reddit.com/"&gt;Reddit.com&lt;/a&gt; confessed
that &lt;a href="http://web.archive.org/web/20070109023445/http%3A//reddit.com/blog/theft"&gt;a backup copy of their database had been
stolen.&lt;/a&gt; Later, spez, one of the Reddit
developers, &lt;a href="http://reddit.com/info/usqe/comments/cuugl"&gt;confirmed&lt;/a&gt;
that the database contained password information for Reddit&amp;#8217;s users,
and that the information was stored as plain, unprotected text.
In other words, once the thief had the database, he had everyone&amp;#8217;s
passwords as well.&lt;/p&gt;


	&lt;p&gt;Had the folks at Reddit &lt;a href="http://en.wikipedia.org/wiki/Password_cracking#Salting"&gt;salted and
hashed&lt;/a&gt; the
passwords, the thief would now be in a very different situation.
Instead of holding all the keys to the kingdom, he would face the
prospect of a potentially expensive search for each and every user&amp;#8217;s
password he wanted to extract from the database.  The expense of the
search would likely have dissuaded him from making the attempt in
earnest, given how little exploitable value a Reddit account represents.  In
short, the passwords would have been secure, even though the database
had fallen into the thief&amp;#8217;s hands.&lt;/p&gt;


	&lt;p&gt;Why, then, didn&amp;#8217;t Reddit&amp;#8217;s programmers salt and hash the passwords
before storing them in their database?  Because, according to the
earlier post by spez, they wanted to be able to send forgotten
passwords to users via email.  It was a design decision: they
weighed the risks of having plain-as-day passwords in the database
against the convenience of being able to email users their forgotten
passwords and decided that, in the balance, convenience carried more
weight.  It&amp;#8217;s a decision they now regret.  (It&amp;#8217;s a doubly unfortunate
decision because &lt;a href="http://blog.moertel.com/articles/2007/02/09/dont-let-password-recovery-keep-you-from-protecting-your-users"&gt;you don&amp;#8217;t need to store passwords in your user database
in order to offer convenient account recovery&lt;/a&gt;.)&lt;/p&gt;


	&lt;p&gt;The reason I&amp;#8217;m writing about this event isn&amp;#8217;t to kick the
good folks at Reddit while they&amp;#8217;re down.  Rather, I&amp;#8217;m trying to make a point:&lt;/p&gt;


&lt;p style="padding-left: 2em; padding-right: 2em"&gt;&lt;strong&gt;If you are
storing passwords in a database, you are almost certainly making a
mistake.&lt;/strong&gt;&lt;/p&gt;

	&lt;p&gt;The guys at Reddit are known for being smart.  They thought they had a
good reason for storing passwords in their database.  They
were wrong.  If smart programmers can make this mistake, lots
of programmers can.  Do you think you have a good reason for storing
passwords in your database?  If so, you&amp;#8217;re probably wrong, too.&lt;/p&gt;


	&lt;p&gt;How can I be so sure?  Because, when it comes to web-app authentication,
cutting corners doesn&amp;#8217;t buy you anything. It doesn&amp;#8217;t save you coding time.
It doesn&amp;#8217;t give your users a better experience. All it does is weaken the security of your web application, needlessly putting your users, your employer, and yourself at  risk.&lt;/p&gt;


	&lt;p&gt;So please let me take this opportunity to ask if you
know of (or perhaps work on) any software systems that store passwords
as plain, unprotected text in a database.  If so, &lt;em&gt;fix your
software now&lt;/em&gt;:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Salt and hash each and every password (use an expensive hashing function such as bcrypt that was designed for password applications)&lt;/li&gt;
		&lt;li&gt;Store the salt and
hash &amp;#8211; not the password &amp;#8211; in your database. &lt;/li&gt;
		&lt;li&gt;Throw the password itself away.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;You&amp;#8217;ll be glad you did.&lt;/p&gt;


&lt;div class="update"&gt;
&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; Minor edits for clarity.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update 2007-02-13:&lt;/strong&gt; Salting and hashing does not get in the way of account recovery.  You do &lt;em&gt;not&lt;/em&gt; need to email users their forgotten passwords: there are other account-recovery options that are just as convenient but much more secure.  See &lt;a href="http://blog.moertel.com/articles/2007/02/09/dont-let-password-recovery-keep-you-from-protecting-your-users"&gt;Don&amp;#8217;t let password recovery keep you from protecting your users&lt;/a&gt; for more.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update 2007-10-03:&lt;/strong&gt; Revised text slightly to emphasize that there is no benefit to be had by implementing a weak password system, and therefore there is no reason &lt;em&gt;not&lt;/em&gt; to implement a secure system. Pointed more directly to bcrypt, too.
&lt;/div&gt;</description>
      <pubDate>Fri, 15 Dec 2006 13:25:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:547d5909-6007-46a3-ae22-ae1f8d348658</guid>
      <author>Tom Moertel</author>
      <link>http://blog.moertel.com/articles/2006/12/15/never-store-passwords-in-a-database</link>
      <category>web development</category>
      <category>security</category>
      <category>reddit</category>
      <category>security</category>
      <category>passwords</category>
      <category>salt</category>
      <category>hash</category>
      <trackback:ping>http://blog.moertel.com/articles/trackback/267</trackback:ping>
    </item>
    <item>
      <title>"Never store passwords in a database!" by Hurricane</title>
      <description>&lt;p&gt;I was looking for links about the typical password-stored issue and found this.&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;ve read the comments an I can only add this : encrypted passwords is BAD.&lt;/p&gt;


	&lt;p&gt;Why ?&lt;/p&gt;


	&lt;p&gt;_ Because there is a way to decrypt them.
_ Because it means YOU know the password of your users.  And if you are a company it means that the disgrunted guy you just fired knows them too.&lt;/p&gt;


	&lt;p&gt;If a user loses his password, start an recovery using a question and contact him by email/fax/phone/... to allow him to reset.&lt;/p&gt;


	&lt;p&gt;Digests are good :&lt;/p&gt;


	&lt;p&gt;A digest using a salt, login and password will not allow an opponent to retrieve the password easily.  He may find something that matches the digest but it will most probably not be the original password of the user. (So he is safe, which is what matters)&lt;/p&gt;


	&lt;p&gt;You can also use a few random bits in your digest.  It means you will have to try&amp;#38;error all the bits to see if one matches but it means the brute-force attacker will have to too.  It will be less expensive for you than for him. (Just check the last OpenPGP specifications)&lt;/p&gt;</description>
      <pubDate>Tue, 26 Aug 2008 20:04:25 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:32cf6a18-e59a-4653-8611-0a34ada1cf7b</guid>
      <link>http://blog.moertel.com/articles/2006/12/15/never-store-passwords-in-a-database#comment-809</link>
    </item>
    <item>
      <title>"Never store passwords in a database!" by Tom Moertel</title>
      <description>&lt;p&gt;James, thanks for your question.&lt;/p&gt;


	&lt;p&gt;In answer, what stops a (reasonably secure) application from unencrypting the password from the database and then sending it to the user is that the password isn&amp;#8217;t encrypted or stored in the database. Rather, the password was fed to a one-way hashing function, and the resulting hash value, which cannot be &amp;#8220;decrypted&amp;#8221; into the original password, was stored in the database instead.  The password itself was thrown away and is long gone by the time a user might need to recover his account.&lt;/p&gt;


	&lt;p&gt;Cheers! &amp;#8212;Tom&lt;/p&gt;</description>
      <pubDate>Thu, 27 Mar 2008 23:36:50 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:8e734a6f-322c-4eac-a9c4-96fb21bbae55</guid>
      <link>http://blog.moertel.com/articles/2006/12/15/never-store-passwords-in-a-database#comment-711</link>
    </item>
    <item>
      <title>"Never store passwords in a database!" by James Law</title>
      <description>&lt;p&gt;Forgive me for asking a possibly obvious question but what stops your application from unencrypting the password from the database and then sending it to the user via email?&lt;/p&gt;


	&lt;p&gt;Just for the record I do disagree with this method of password recovery as email isn&amp;#8217;t a secure medium.&lt;/p&gt;</description>
      <pubDate>Thu, 27 Mar 2008 12:32:38 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:0b227671-ea61-4770-948b-eebffbca655e</guid>
      <link>http://blog.moertel.com/articles/2006/12/15/never-store-passwords-in-a-database#comment-710</link>
    </item>
    <item>
      <title>"Never store passwords in a database!" by David</title>
      <description>&lt;p&gt;bcrypt is not nearly as secure a hash as sha1 or even md5.&lt;/p&gt;</description>
      <pubDate>Sat, 01 Dec 2007 01:59:17 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:3059faea-5093-44ff-a039-5bbeb1988ae5</guid>
      <link>http://blog.moertel.com/articles/2006/12/15/never-store-passwords-in-a-database#comment-654</link>
    </item>
    <item>
      <title>"Never store passwords in a database!" by brianeleahy@cox.net</title>
      <description>&lt;p&gt;More then likely it wasn&amp;#8217;t smart programmers that dropped the ball.&lt;/p&gt;


	&lt;p&gt;I bet it was dumb managers insisting that the functionallity of emailing someone their forgotten password was of dire importance.&lt;/p&gt;</description>
      <pubDate>Mon, 10 Sep 2007 13:34:02 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:0728abe6-a046-4242-8ff5-0325f10a631b</guid>
      <link>http://blog.moertel.com/articles/2006/12/15/never-store-passwords-in-a-database#comment-574</link>
    </item>
    <item>
      <title>"Never store passwords in a database!" by Coda Hale</title>
      <description>&lt;p&gt;FWIW, I went out and implemented state-of-the-art password hashing for Ruby:&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://blog.codahale.com/2007/02/28/bcrypt-ruby-secure-password-hashing/"&gt;http://blog.codahale.com/2007/02/28/bcrypt-ruby-secure-password-hashing/&lt;/a&gt;&lt;/p&gt;


&lt;pre&gt;
&lt;code&gt;
require "bcrypt" 

password = BCrypt::Password.create("secret")
password #=&amp;gt; "$2a$10$zMW2EmVgmKLRtHZLHUPZk.yydsOQPkqMvko2A8GYpJT0o7QVlNrq." 
password == "wrong password" #=&amp;gt; false
password == "secret"         #=&amp;gt; true

password = BCrypt::Password.new("$2a$10$zMW2EmVgmKLRtHZLHUPZk.yydsOQPkqMvko2A8GYpJT0o7QVlNrq.")
password == "wrong password" #=&amp;gt; false
password == "secret"         #=&amp;gt; true
&lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;It doesn&amp;#8217;t get any easier than that. Don&amp;#8217;t be Reddit.&lt;/p&gt;</description>
      <pubDate>Fri, 02 Mar 2007 02:46:53 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:6c479b4f-874c-4e00-94c1-e339962889c5</guid>
      <link>http://blog.moertel.com/articles/2006/12/15/never-store-passwords-in-a-database#comment-397</link>
    </item>
    <item>
      <title>"Never store passwords in a database!" by Andy Chilton</title>
      <description>&lt;p&gt;I wrote an article (in Sep 2006) on storing passwords. This was after hearing of a few places where plaintext passwords were being use. You might like to check it out:&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://kapiti.geek.nz/random/setting-a-good-example-with-passwords.html"&gt;http://kapiti.geek.nz/random/setting-a-good-example-with-passwords.html&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;I agree, salting and hashing your passwords is the way to go.&lt;/p&gt;


	&lt;p&gt;Thanks for the article pointing out Reddit&amp;#8217;s mistake.&lt;/p&gt;</description>
      <pubDate>Sun, 25 Feb 2007 18:18:03 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:66edb8b2-2d70-423d-9ad7-eb9a1547ade7</guid>
      <link>http://blog.moertel.com/articles/2006/12/15/never-store-passwords-in-a-database#comment-394</link>
    </item>
    <item>
      <title>"Never store passwords in a database!" by Coda Hale</title>
      <description>&lt;p&gt;This is why engineers look down on programmers.&lt;/p&gt;


	&lt;p&gt;&amp;#8220;Yeah, but you only need that kind of support if you&amp;#8217;re going to have a lot of cars on the bridge. Duct tape will do fine&amp;#8212;you can always replace it once you&amp;#8217;ve got a lot of cars on the bridge.&amp;#8221;&lt;/p&gt;


	&lt;p&gt;&amp;#8220;There are no fixed rules with high-voltage electricity. That&amp;#8217;s why we use dried-up oatmeal as an insulator.&amp;#8221;&lt;/p&gt;


	&lt;p&gt;&amp;#8220;But if you can&amp;#8217;t kick through the walls of the building, then how will people get inside?&amp;#8221;&lt;/p&gt;


	&lt;p&gt;&amp;#8220;Look, responsible people should be wearing parachutes at all times. That way, when a bridge collapses they won&amp;#8217;t have to die. It&amp;#8217;s common sense, and people who drive on bridges without parachutes get what they deserve. They should know better.&amp;#8221;&lt;/p&gt;


	&lt;p&gt;&amp;#8220;You&amp;#8217;re probably better off inventing your own steel alloy, like maybe 30% iron, 10% old GI Joe figurines, and 60% margarine. If you paint it rust-colored, people won&amp;#8217;t know the difference. But that&amp;#8217;s really just for &amp;#8216;fun&amp;#8217; skyscrapers.&amp;#8221;&lt;/p&gt;


	&lt;p&gt;&amp;#8220;I don&amp;#8217;t see why we should have to spend so much time making sure the dam doesn&amp;#8217;t burst. I mean, someone could just use a garden hose and flood the houses downstream just as easily.&amp;#8221;&lt;/p&gt;


	&lt;p&gt;Jesus wept. Tom, thanks for the article&amp;#8212;always nice to see a flash of competency in muddy water. &amp;#8220;How would you design an authentication system&amp;#8221; just became my #1 job interview question.&lt;/p&gt;</description>
      <pubDate>Tue, 20 Feb 2007 15:29:58 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:c0208a73-0d8a-42b7-8a20-96da0138d0a3</guid>
      <link>http://blog.moertel.com/articles/2006/12/15/never-store-passwords-in-a-database#comment-386</link>
    </item>
    <item>
      <title>"Never store passwords in a database!" by Parker</title>
      <description>&lt;p&gt;I use a program called Secret Server.  It uses all that good stuff (SHA512, AES26)and works well for multi-users because you can share and audit.&lt;/p&gt;</description>
      <pubDate>Fri, 09 Feb 2007 11:12:49 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:51ecc3ef-fc6a-4352-846a-b15eafa3ea93</guid>
      <link>http://blog.moertel.com/articles/2006/12/15/never-store-passwords-in-a-database#comment-369</link>
    </item>
    <item>
      <title>"Never store passwords in a database!" by Tom Moertel</title>
      <description>&lt;p&gt;Unni, the primary benefit of using a hash is that it is &lt;em&gt;one way&lt;/em&gt;.  Once you salt and hash the password, there is no practical way to retrieve it, not for would-be attackers, nor for you.  Thus when users forget their passwords, you &lt;em&gt;cannot&lt;/em&gt; mail their passwords to them.&lt;/p&gt;


	&lt;p&gt;How, then, can they log in?  If your site requires no stronger authentication than knowing that users own the email addresses they claim to own, you can use the following method.&lt;/p&gt;


	&lt;p&gt;Say Joe has lost his password and wants to recover his account.  Here&amp;#8217;s how you do it:&lt;/p&gt;


	&lt;ol&gt;
	&lt;li&gt;Generate a big, random, unique token and stuff it into Joe&amp;#8217;s account record in the database along with the current date and time.&lt;/li&gt;
		&lt;li&gt;Send an email to Joe, but instead of enclosing his password (which you can&amp;#8217;t recover), tell Joe to click on the enclosed account-recovery link, which of course includes the random token: &lt;code&gt;&lt;a href="http://example.com/recover-account?token=pCIqq1unxntVqc8XtCXg"&gt;http://example.com/recover-account?token=pCIqq1unxntVqc8XtCXg&lt;/a&gt;&lt;/code&gt;.&lt;/li&gt;
		&lt;li&gt;Joe receives the email and follows the link, which sends his token to your site.&lt;/li&gt;
		&lt;li&gt;Look up the token in the user database.  Is it there?
	&lt;ol&gt;
	&lt;li&gt;No? Render &amp;#8220;Sorry, bub, that token is bogus, so we cannot recover your account.&amp;#8221;  Stop.&lt;/li&gt;
		&lt;li&gt;Yes? Excellent. Grab the user record associated with the token.  (It will, of course, be Joe&amp;#8217;s record.)&lt;/li&gt;
	&lt;/ol&gt;
	&lt;/li&gt;
		&lt;li&gt;Is the date and time stamp on that record more than a few hours old?
	&lt;ol&gt;
	&lt;li&gt;Yes? Render &amp;#8220;Sorry, bub, that token has expired.&amp;#8221; Stop.&lt;/li&gt;
		&lt;li&gt;No? Congratulations.  Joe has effectively authenticated himself via his email address.&lt;/li&gt;
	&lt;/ol&gt;
	&lt;/li&gt;
		&lt;li&gt;Render a confirmation screen that explains the following to Joe:
	&lt;ol&gt;
	&lt;li&gt;His account password is going to be reset to the following random string: &lt;strong&gt;ocZodbew&lt;/strong&gt;. (Generate a new random password each time.)&lt;/li&gt;
		&lt;li&gt;If he likes the password, great.  If not, he can use the change-password feature immediately after the password is reset.&lt;/li&gt;
		&lt;li&gt;If he understands the above and wants to reset his account password, confirm by clicking the big &amp;#8220;Reset My Account Password&amp;#8221; button.&lt;/li&gt;
	&lt;/ol&gt;
	&lt;/li&gt;
		&lt;li&gt;Joe clicks the big button.&lt;/li&gt;
		&lt;li&gt;You, in response, do the following:
	&lt;ol&gt;
	&lt;li&gt;Delete the recovery token from Joe&amp;#8217;s user record in the database. (This prevents somebody who steals a copy of Joe&amp;#8217;s mail from using the old token to steal his account.)&lt;/li&gt;
		&lt;li&gt;Replace the salt and hash for Joe&amp;#8217;s old password with a new salt and the salted-hash of the new, randomly generated password from above.&lt;/li&gt;
		&lt;li&gt;Render a screen saying, &amp;#8220;Joe, your password has been changed to &lt;strong&gt;ocZodbew&lt;/strong&gt;.  If you would like to change it, just visit Change Password in your account preferences.&amp;#8221; (Provide a link.)&lt;/li&gt;
	&lt;/ol&gt;
	&lt;/li&gt;
		&lt;li&gt;And you&amp;#8217;re done!&lt;/li&gt;
	&lt;/ol&gt;


	&lt;p&gt;If that seems like a complicated process, you should know that the code required to make it happen is shorter than the explanation above.  In any case, it&amp;#8217;s a small price to pay to protect your users&amp;#8217; passwords.&lt;/p&gt;


	&lt;p&gt;Cheers,&lt;br /&gt;
Tom&lt;/p&gt;</description>
      <pubDate>Fri, 09 Feb 2007 09:51:47 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:ae65e5b1-2cad-40e1-87b1-bc7612efbe9a</guid>
      <link>http://blog.moertel.com/articles/2006/12/15/never-store-passwords-in-a-database#comment-368</link>
    </item>
    <item>
      <title>"Never store passwords in a database!" by Unni</title>
      <description>&lt;p&gt;Definitely, its bad idea of storing password in plain text in database,rather store it in salting hash.
     BUT i have no idea how to DECRYPT the salted hash. I want to know, if user FORGETS his/her password then HOW we are going to get back the password? 
    I am creating a login page &amp;#38; i have to add &amp;#8220;FORGET PASSWORD&amp;#8221; feature also.
How can i do it??&lt;/p&gt;</description>
      <pubDate>Fri, 09 Feb 2007 05:15:22 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:79cb097e-a68f-432f-ba37-687e8463a882</guid>
      <link>http://blog.moertel.com/articles/2006/12/15/never-store-passwords-in-a-database#comment-367</link>
    </item>
    <item>
      <title>"Never store passwords in a database!" by neuroxik</title>
      <description>&lt;p&gt;One method that could be used if one feels it&amp;#8217;s better to send back a password by email than requiring a reset is to atleast use a homegrown encryption algorithm. Now I&amp;#8217;m not talking about writing a 100K class, just something rather simple and append random chars, make it equal to 16 or 32 bytes to make it resemble a md5/sha1 hash and use that same algo to restore the password. Of course, that would be to use only on &amp;#8220;fun&amp;#8221; sites.&lt;/p&gt;</description>
      <pubDate>Wed, 27 Dec 2006 05:31:33 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:3e349ed4-ac16-42bb-a798-f2b232878dea</guid>
      <link>http://blog.moertel.com/articles/2006/12/15/never-store-passwords-in-a-database#comment-316</link>
    </item>
    <item>
      <title>"Never store passwords in a database!" by Anony Moose</title>
      <description>&lt;p&gt;Alternate design: The &amp;#8220;I forgot my password&amp;#8221; handler generates a cryptographically strong new password, then sends that out to the user, who can then reset their own password back to the name of their dog.&lt;/p&gt;


	&lt;p&gt;Well, ok, sending passwords by email isn&amp;#8217;t entirely perfect, but it would have been less bad.&lt;/p&gt;


	&lt;p&gt;And it avoids screwing around with encrypting passwords in the database and thus needing to protect the key used to decrypt the passwords. If the hackers can get the database, they can get the key &amp;#8211; and if they can&amp;#8217;t get the key, then the database could have been protected.&lt;/p&gt;


	&lt;p&gt;And if the protocol &amp;#8220;requires&amp;#8221; the password to be stored in plain text, perhaps you&amp;#8217;re asking for trouble by using that protocol. But if you don&amp;#8217;t have a damn good reason to require the password to be stored as plaintext, then doing so is just wrong. It&amp;#8217;s nowhere near necessary enough to be worth the risk.&lt;/p&gt;</description>
      <pubDate>Sun, 17 Dec 2006 18:16:05 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:947af8d4-cd76-4322-a323-8dc0361d3d03</guid>
      <link>http://blog.moertel.com/articles/2006/12/15/never-store-passwords-in-a-database#comment-310</link>
    </item>
    <item>
      <title>"Never store passwords in a database!" by Peter</title>
      <description>&lt;p&gt;Tom Moertel:&lt;/p&gt;


	&lt;p&gt;Natural language usage doesn&amp;#8217;t have to be sloppy.  That in itself is a design decision by the user.&lt;/p&gt;</description>
      <pubDate>Sun, 17 Dec 2006 05:01:31 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:5a1181af-cf8e-46fc-98c2-225986060cf7</guid>
      <link>http://blog.moertel.com/articles/2006/12/15/never-store-passwords-in-a-database#comment-307</link>
    </item>
    <item>
      <title>"Never store passwords in a database!" by Jonas</title>
      <description>&lt;p&gt;Storing passwords in a database in cleartext is, as someone mentioned above, /required/ for some protocols, but then it&amp;#8217;s very important to encrypt the backups with GPG. This doesn&amp;#8217;t help the security of the runtime database but it sure helps securing backups.&lt;/p&gt;</description>
      <pubDate>Sun, 17 Dec 2006 04:46:31 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:b89a5445-2cbc-400c-8453-d2567f44b4cb</guid>
      <link>http://blog.moertel.com/articles/2006/12/15/never-store-passwords-in-a-database#comment-306</link>
    </item>
    <item>
      <title>"Never store passwords in a database!" by Noah Slater</title>
      <description>&lt;p&gt;Nate, why can the login form NOT be embedded on the same page?&lt;/p&gt;</description>
      <pubDate>Sat, 16 Dec 2006 14:23:10 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:ef565eb6-7980-45fb-874c-0ece7480c107</guid>
      <link>http://blog.moertel.com/articles/2006/12/15/never-store-passwords-in-a-database#comment-305</link>
    </item>
    <item>
      <title>"Never store passwords in a database!" by Nate</title>
      <description>&lt;p&gt;Just a copy of my comment on reddit:&lt;/p&gt;


	&lt;p&gt;It&amp;#8217;s not incompetence but a common design decision of 95% of the &amp;#8220;fun&amp;#8221; sites everyone here uses every day. Go look at YouTube and MySpace, no SSL and they both send back the original passwords in email. 37Signals sends back forgotten passwords in email. Everyone here then should spread this outrage around with all those sites too.&lt;/p&gt;


	&lt;p&gt;If the site isn&amp;#8217;t using SSL for logins, then it doesn&amp;#8217;t really matter if these passwords are cleartext in the database. And if you move to SSL logins, then that makes logging in one extra click for everyone. (since the login form can&amp;#8217;t be embedded right on the page anymore, or your form is prone to a &amp;#8216;man in the middle&amp;#8217; attack)&lt;/p&gt;


	&lt;p&gt;I expect my Mom maybe to use the same password at Reddit and at her bank, but the people here!? Why would you trust any site with the same password that you might use somewhere that&amp;#8217;s important?&lt;/p&gt;


	&lt;p&gt;I like these Reddit guys a lot, but Aaron is one shady looking mofo. :) I just assume that he&amp;#8217;d try to use my password at every bank site he could find to funnel money into his porno slush fund.&lt;/p&gt;</description>
      <pubDate>Sat, 16 Dec 2006 11:55:25 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:79f6cb2b-0200-4f4f-9400-a0cf5d5d06d9</guid>
      <link>http://blog.moertel.com/articles/2006/12/15/never-store-passwords-in-a-database#comment-304</link>
    </item>
    <item>
      <title>"Never store passwords in a database!" by oldmangettingold</title>
      <description>&lt;p&gt;The best way to store passwords is not storing it. Whenever an user creates an account and provides a password, the following technique can be used to make the life of hackers difficult:
1. use some unique technique should be used to generate a salt, 
2. concatenate the salt to the password, 
3. use a hashing algorithm such MD5 or SHA1 to hash the password
4. Encrypt the hashed key and save it to database&lt;/p&gt;


	&lt;p&gt;To authenticate:
1. After the user enters the password, use SSL to transfer the password to the server, add the salt and take a hash, retrieve the encrypted hash, decrypt the hash and match the hashes to authenticate the user.&lt;/p&gt;


	&lt;p&gt;Though, the above method is bit cumbersome and will take time to develop, but it works good and makes the life of a hacker much more difficult.&lt;/p&gt;</description>
      <pubDate>Sat, 16 Dec 2006 10:14:39 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:060d7457-eb54-44ed-bd5e-44a7888a07d0</guid>
      <link>http://blog.moertel.com/articles/2006/12/15/never-store-passwords-in-a-database#comment-303</link>
    </item>
    <item>
      <title>"Never store passwords in a database!" by J. Random Hacker</title>
      <description>&lt;p&gt;Ow, the stupid.  It hurts us, precious.&lt;/p&gt;


	&lt;p&gt;The average user has maybe one or two passwords, so it&amp;#8217;s a disservice to them to store their passwords in the clear.&lt;/p&gt;


	&lt;p&gt;The slightly more clever user has good, unique passwords for everything important, and a couple of disposable login/passwords combos for everything else. (I know, everybody here uses a randomly-generated 12-character alphanumeric string for each and every Web 2.0 site. But we&amp;#8217;re talking about everybody else, not you.)&lt;/p&gt;


	&lt;p&gt;So, any way you look at it, salting and hashing passwords is the way to go.  You could also use an iterated SHA1 hash, applying it perhaps 50 times.  This slows down authentication slightly, but proportionally increases the work required for a dictionary attack.&lt;/p&gt;</description>
      <pubDate>Sat, 16 Dec 2006 10:13:29 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:c4c81efd-c0f7-4c18-ba6c-8ad31fcf676e</guid>
      <link>http://blog.moertel.com/articles/2006/12/15/never-store-passwords-in-a-database#comment-302</link>
    </item>
    <item>
      <title>"Never store passwords in a database!" by lexandro</title>
      <description>&lt;p&gt;Dear Tom!&lt;/p&gt;


	&lt;p&gt;I translated your post to hungarian and posted to my blog with your blog&amp;#8217;s URL&lt;/p&gt;


	&lt;p&gt;Lex&lt;/p&gt;</description>
      <pubDate>Sat, 16 Dec 2006 10:12:49 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:c2d30845-c9b0-4c94-b6dd-617ef17727d8</guid>
      <link>http://blog.moertel.com/articles/2006/12/15/never-store-passwords-in-a-database#comment-301</link>
    </item>
    <item>
      <title>"Never store passwords in a database!" by Noah Slater</title>
      <description>&lt;p&gt;Binny V A, hashed passwords can be recovered using dictionary attacks.&lt;/p&gt;</description>
      <pubDate>Sat, 16 Dec 2006 09:26:25 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:a05f4c58-f613-4f06-807e-e7ff8826eeb3</guid>
      <link>http://blog.moertel.com/articles/2006/12/15/never-store-passwords-in-a-database#comment-300</link>
    </item>
    <item>
      <title>"Never store passwords in a database!" by Binny V A</title>
      <description>&lt;p&gt;If you hash the password(MD5/SHA1), retrieval is impossible. So &amp;#8216;Forgot Password&amp;#8217; will not work. Yes, you can reset the password &amp;#8211; but that tends to irritate the users.&lt;/p&gt;


	&lt;p&gt;If you are maintaining a critical website &amp;#8211; where unauthenticated access can create real problems, there is no excuse for not hashing the password. But in the case of reddit, that is not so important.&lt;/p&gt;


	&lt;p&gt;The lesson to be learned here is not to use the same password on all sites.&lt;/p&gt;</description>
      <pubDate>Sat, 16 Dec 2006 08:47:51 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:3c63957b-9f4b-47ca-946e-4550efe0d0bc</guid>
      <link>http://blog.moertel.com/articles/2006/12/15/never-store-passwords-in-a-database#comment-299</link>
    </item>
    <item>
      <title>"Never store passwords in a database!" by Noah Slater</title>
      <description>&lt;p&gt;pcdinh, your argument makes no sense. PHP is a language, not a framework, and so each application is likely to store passwords as per the developers preference.&lt;/p&gt;</description>
      <pubDate>Sat, 16 Dec 2006 08:41:56 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:21adf348-1d8d-4ed9-8bf8-1a9088191821</guid>
      <link>http://blog.moertel.com/articles/2006/12/15/never-store-passwords-in-a-database#comment-298</link>
    </item>
    <item>
      <title>"Never store passwords in a database!" by pcdinh</title>
      <description>&lt;p&gt;Reddit seems not to be a PHP application. Almost PHP applications store hashed passwords in a database so it is rather difficult to guess them out even the database are stolen.&lt;/p&gt;


	&lt;p&gt;Is Reddit implemented in Python or Ruby?&lt;/p&gt;</description>
      <pubDate>Sat, 16 Dec 2006 08:33:45 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:b68094a0-65d1-4cd2-9c28-8f2c8b3bad91</guid>
      <link>http://blog.moertel.com/articles/2006/12/15/never-store-passwords-in-a-database#comment-297</link>
    </item>
    <item>
      <title>"Never store passwords in a database!" by Markus</title>
      <description>&lt;p&gt;You ask for the passwords not to be stored in a database. But where else ?&lt;/p&gt;


&lt;p&gt;In the fine print you talk about salting and hashing, but your headline should say: Don&amp;#8217;t store &lt;b&gt;clear-text&lt;/b&gt; passwords !&lt;/p&gt;</description>
      <pubDate>Sat, 16 Dec 2006 04:30:21 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:1ccd9194-4c3a-4657-a23c-fee56b4868c7</guid>
      <link>http://blog.moertel.com/articles/2006/12/15/never-store-passwords-in-a-database#comment-296</link>
    </item>
  </channel>
</rss>
