<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Wed, 8 Mar 2017 at 15:25 Ron Garret <<a href="mailto:ron@flownet.com">ron@flownet.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="gmail_msg">As with all questions of this type: what is your threat model?  Who is your adversary, and what are their capabilities?</div></blockquote><div><br></div><div>I've got my info from the devs who have been told by security to add the encryption so not fully sure of the threat model but from the devs, it is against someone who manages to get access to just the database and recovers the PINs.</div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Generally if you are hashing passwords/PINs it means that part of your threat model is that your adversary can break in to your servers (because if your adversary can’t do that then you can safely store passwords in the clear).  In which case my next question would be: where are you storing your encryption key?  If it’s on the same server as your database (or in another server that your adversary can break in to) then encrypting does you no good.</div><div class="gmail_msg"><br class="gmail_msg"></div></div></blockquote><div><br></div><div>We talked about storage of the encryption key and they basically said that is out of scope, don't worry about it.</div><div><br></div><div>Talking to a friend who knows crypto, he says that the encryption should not have a negative interaction with the bcrypt hash and so adding it will slow down the process of recovering a PIN. So, my current plan is to caveat my comments something like this:</div><div><br></div><div>Due to the small number of potential plain texts[1], increasing the work factor of bcrypt is unlikely to prevent a determined attacker from recovering a given PIN in a reasonable time [2]. Adding the encryption will help protect the hashed PIN as the attacker would first have to crack the encryption key. If the attacker was able to gain access to configurations or running processes they may be able to recover the key and so render the encryption useless.</div><div><br></div><div>[1] thanks for the correction</div><div>[2] 10 sec per hash works out at just over a day to brute force a 4 digit PIN if I've done my maths right.</div><div><br></div><div>I'm basically answering the question that they asked and covering myself, I know isn't solving the problem but this is only a stop gap while they move away from PINs and over to proper passwords and hopefully 2FA.</div><div><br></div><div>Thanks</div><div><br></div><div>Robin</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"></div><div class="gmail_msg">BTW, the problem you have here is not a small key space, but a small space of possible plain texts.  Not quite the same thing.  Designing a system that stores PINs against an adversary who can break in to your servers will be quite challenging.  Even a slow hash will not help much if the brute-force search space is only 20 bits (6 decimal digits).</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">rg<br class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"><div class="gmail_msg"></div></div></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg">On Mar 8, 2017, at 2:45 AM, Robin Wood <<a href="mailto:robin@digininja.org" class="gmail_msg" target="_blank">robin@digininja.org</a>> wrote:</div><br class="m_7766311644744768687Apple-interchange-newline gmail_msg"></div></div></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div dir="ltr" class="gmail_msg"><div class="gmail_quote gmail_msg"><div dir="ltr" class="gmail_msg"><span style="color:rgb(33,33,33);font-size:13px" class="gmail_msg">Hi</span><div class="gmail_msg" style="color:rgb(33,33,33);font-size:13px">I've been asked by a client to give some advice on hashing and as it isn't my area I'm looking for someone who knows what they are talking about.</div><div class="gmail_msg" style="color:rgb(33,33,33);font-size:13px"><br class="gmail_msg"></div><div class="gmail_msg" style="color:rgb(33,33,33);font-size:13px">The client is hashing 4-6 digit PINs (mostly 4 digit) with bcrypt, they have the work factor set as high as the business will allow them but they are worried that due to the small key space it will still be possible to reverse individual PINs. They are now thinking of encrypting the hashes before storing them to add an extra layer of protection. The encryption is fast enough to not affect login times so my suggestion of using the additional processing to increase the work factor instead was rejected.</div><div class="gmail_msg" style="color:rgb(33,33,33);font-size:13px"><br class="gmail_msg"></div><div class="gmail_msg" style="color:rgb(33,33,33);font-size:13px">What do people think? I can't see it hurting and adding the additional hurdle probably won't hurt but I've heard of odd interactions between different algorithms so don't want to say to do it without someone who knows their stuff looking at it.</div></div><div dir="ltr" class="gmail_msg"><div class="gmail_msg" style="color:rgb(33,33,33);font-size:13px"><br class="gmail_msg"></div><div class="gmail_msg">Robin</div></div></div></div></blockquote></div></div></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg"><blockquote type="cite" class="gmail_msg">
_______________________________________________<br class="gmail_msg">The cryptography mailing list<br class="gmail_msg"><a href="mailto:cryptography@metzdowd.com" class="gmail_msg" target="_blank">cryptography@metzdowd.com</a><br class="gmail_msg"><a href="http://www.metzdowd.com/mailman/listinfo/cryptography" class="gmail_msg" target="_blank">http://www.metzdowd.com/mailman/listinfo/cryptography</a></blockquote></div><br class="gmail_msg"></div></div></div></blockquote></div></div>