Wednesday, December 25, 2013

Making Random Letter Passwords Memorable


Making Random Letter Passwords Memorable

Arnold G. Reinhold
Cambridge, Massachusetts, USA

August 28, 2011

Abstract
A method is presented that accepts a random string of up to 10 letters and uses a look-up table to produce a mnemonic English sentence having those letters as the initial letter of each word. This method offers more predictable security than asking users who wish to create a strong password to think of a sentence and use the initials of each word in that sentence as the password.

Introduction
As personal computers become more powerful, attacks on password management systems are becoming difficult to prevent. Many authentication systems protect passwords by only storing a cryptographic hash of each password. However, if an attacker gains access to stored password hashes, they can attempt to crack the hashes using dictionaries of common passwords or brute force searches of all character combinations. The availability of high performance general-purpose graphics processors (GPGPUs) that can be programmed to carry out hash attacks exacerbates the problem. (Davis 2011) Cybercriminals have assembled large networks of computers they control (botnets) and can use CPUs and GPUs on the compromised machines to attack password hashes they have collected. Passwords used to generate cryptographic keys, such as those used for disk encryption or to protect wireless networks, have similar vulnerabilities.

In response to these threats, users are often encouraged (or coerced) to employ stronger passwords. Common ways of doing this include requiring a minimum length and a mix of upper and lower case letters, number and special characters. The latter approach can have mixed results. Users often follow predictable strategies to meet those requirements, modifying their passwords in minimal ways that have only modest impact on an attacker’s search difficulty.

Another common strategy suggests users think of a phrase that is memorable and use the initial letters of each word in that phrase to form their password, perhaps substituting words or letters with numbers or symbols, 2Bor~2B? for example .However this approach depends on the user being sufficiently clever and creative.  Many users will choose common phrases, such as lyrics from popular songs, and use predictable letter and word substitutions, such as “$” for “S”, “1” for “L” and “3” for “E”. Also the distribution of initial letters of words in English and other natural languages is far from uniform, giving attackers an additional advantage.

A more rigorously secure method is to offer users a password made up of characters chosen completely at random. Selecting uniformly distributed random characters offers the maximum possible entropy for a given password length and character set. However, this approach is not widely employed because of concerns that users find such passwords too difficult to remember.

The sentence generator approach
This paper proposes a different approach that offers the best features of the last two methods. A fully random password is created first and that password is then used to generate a mnemonic sentence – one where the initial letters of each word form the password. Since the random password is generated first, the selected sentence cannot diminish security, as long as it is kept secret. 

The sentence is generated from the password using s look up table, Table 1, which consists of 10 columns and 26 rows. Every column has 26 English words in alphabetical order, each starting with a different letter of the alphabet (a-z). The one exception is the “x” row where words starting with “ex” are used. Each column contains one grammatical form. The columns are arranged to produce a proper English sentence regardless of which row each word comes from. The column pattern from left to right is: proper name, adjective, noun, adverb, verb, adjective, noun, gerund, adjective, noun.

Give any string of 10 letters from the English alphabet, Table 1 can generate an English sentence consisting of ten words whose initials are those letters (with words that start with “ex” standing for “x”). Thus any random password of 10 letters produces a unique mnemonic sentence for that password. For example the password vmyhvxklke generates the sentence:

Vivian's merry yankees hopelessly view excellent kings leaving keen energy.


While not all sentences generated in this way are immediately meaningful, they can be easier to remember than the password itself. Simple techniques, such as visualizing the scene suggested by the sentence, can further aid memorization.


Table 1. Sentence generating matrix

‑‑
Name
adj
noun
adv
verb
adj
noun
gerund
adj
noun

1
2
3
4
5
6
7
8
9
10
A
Arnold's
amazing
artists
always
arrest
angry
ants
arousing
awful
admiration
B
Bob's
big
brothers
boldly
batter
bossy
boys
bringing
boastful
bliss
C
Charlie's
cuddly
cats
craftily
cover
crazy
crooks
causing
cold
comfort
D
Dona's
deadly
ducks
deftly
drop
dumb
doctors
defying
dumb
delight
E
Ed's
empty
editors
easily
engage
eager
eels
enjoying
easy
energy
F
Frank's
fine
frogs
foolishly
fight
fat
foxes
finding
fast
fame
G
Gloria's
golden
goats
gaily
grab
green
goons
gaining
glorious
growth
H
Hana's
hot
hippos
hopelessly
hold
heavy
horses
helping
happy
health
I
Ivy's
interesting
infants
intensely
inject
incompetent
idiots
insulting
intense
interest
J
Jane's
jolly
judges
joyously
join
jealous
jokers
joining
juvenile
joy
K
Ken's
kissable
kittens
kindly
keep
kinky
kings
killing
keen
karma
L
Lucy's
lonely
llamas
laughingly
lash
lowly
librarians
leaving
lurid
love
M
Mary's
merry
mermaids
morosely
mangle
mad
monsters
making
messy
music
N
Nancy's
nice
nuns
noisily
nab
naughty
nerds
noting
neglected
nothingness
O
Olga's
old
owls
often
ogle
oily
orcs
owning
open
obsession
P
Pete's
pink
peacocks
playfully
pester
poor
pigs
packing
proud
power
Q
Quincy's
quiet
quails
quickly
query
quaking
queens
questioning
queer
quality
R
Randy's
red
rodents
regretfully
ruin
rude
robbers
rejecting
redolent
refreshment
S
Sue's
smooth
snails
swiftly
slay
snarky
slugs
seeking
simple
success
T
Tom's
tiny
tigers
timidly
tackle
tired
thugs
testing
tenuous
truth
U
Uri's
urban
umpires
urgently
upset
ugly
uncles
urging
useless
unity
V
Vivian's
vivacious
vampires
vividly
view
vicious
vandals
viewing
velvet
victory
W
Walt's
wild
wolves
willingly
wrestle
wimpy
wardens
wishing
witty
wisdom
X
Xavier's
eXotic
eXecutives
eXcitedly
eXpel
eXcellent
eXperts
eXtracting
eXtreme
eXcess
Y
Yolanda's
yelping
yankees
yearningly
yank
yellow
youths
yielding
yummy
yogurt
Z
Zed's
zigzagging
zebras
zealously
zone
zany
zombies
zooming
zesty
zeros


Strength of all-letter passwords

A 10 letter random password has 10 x log2 (26) = 47.0 bits of entropy. For higher security, two sentences can be generated. If both are 10 letters long, the resulting password will have 94 bits of entropy, well exceeding NIST 800-63 guidelines for cryptographic strength (80 bits).

The table can be easily adapted to generate shorter sentences. Thus a 9 letter password would simply omit column 9, Vivian's merry yankees hopelessly view excellent kings leaving energy. An 8 letter password could omit columns 8 and 9 while making the word from column 8 possessive: Vivian's merry yankees hopelessly view excellent kings’ energy. For 7 letters, omit the last three columns, and so on.

Thus a 17 letter password, offering 80 bit security, could be represented by a 10 word sentence and a 7 word sentence, or a 9 and an 8 word sentence.

Random passwords consisting of only English letters have less entropy per character than random passwords selected from a larger character set, but additional letters can be added to make up the difference.  For example, a random 10 English letter password has a bit more entropy than a 7 character random password selected from all printable 7-bit ASCII characters (95 possibilities), which has 45.9 bits of entropy. To match the 65.7 bit entropy of a 10 character all-printable-ASCII password such as U{l>gPzH:Z requires an English letter password with 14 letters, which is longer, but arguably more memorable, at least when used with the method proposed here. Note that on many mobile devices, such as the Apple iPhone, it is more difficult to type a password randomly selected from all printable ASCII characters because multiple shifts are needed to access different groups of characters.


Other security impacts

The sentence generating approach table has few security limitations. Of course, the sentence generated must be afforded the same level of security protection as the password itself. And asking users to submit their password over the Internet to get their sentence has obvious security risks. It is better to display the sentence at the same time the password is generated or perform the table lookup locally.

The choice of words has no security implication as long as there is one word for each letter in the alphabet in every column. The words in Table 1 were selected to maximize the likelihood of a somewhat meaningful sentence, while minimizing the likelihood of a sentence with sexually suggestive or scatological meaning. While some might find an X-rated sentence easier to remember, others might find such sentences offensive and organizations might be reluctant to employ such tables to avoid creating a hostile work environment.

Tables for other languages and alphabets are feasible. Different tables could be created for variety, particularly when more than one sentence is needed to meet strength objectives. Other possibilities for password mnemonics include random poems, songs, haiku, limericks and similar short literary works.

Implementation

A 10 letter random password can be selected uniformly from the English alphabet using a strong random number generator, such as CryptGenRandom on Microsoft Windows systems, and /dev/random on Unix, Linux or MacOS X systems. The Python programming language has a SystemRandom class that uses either CryptGenRandom or /dev/random, depending on the operating system on which it is running.

An ideal implementation would be to offer a user a randomly generated password and a mnemonic sentence when a new account is created or a password is to be changed on an existing account.

Users wishing to use this system needn’t wait until it is adopted by password management systems. Strong random passwords can be generated manually using dice, playing cards or letter tiles. (Reinhold 2000)

If numbers, upper case letters and special characters are needed to meet password composition policy, they can be added easily. Nouns can be capitalized and normal sentence punctuation added. Such steps add security only if an attacker is unaware of the method used, however they never diminish security. Net additional security can be achieved by prefixing the first and second adjectives with a random number, in which case 3.3 bits of entropy are added per digit. Such a sentence would still be meaningful to a user, for example, Vivian's 23 merry yankees hopelessly view 7 excellent kings leaving keen energy would yield the password v23myhv7xklke.

Conclusion
The difficulty of getting users to employ strong passwords is a major challenge to cyber security. The method presented here can help in that effort by giving users an easier way to remember a random password.

References
Davis 2011, Joshua Davis and Richard Boyd, Teraflop Troubles: The Power of Graphics Processing Units May Threaten the World’s Password Security System, Georgia Tech Research Institute Case Study, 2011

Reinhold 2000, Arnold Reinhold, Picking a strong Passphrase using Diceware, Internet Secrets, 2nd Edition, John R. Levine, Editor, Chapter 37, p. 831 IDG Books, 2000, ISBN 0-7645-3239-1, also www.diceware.com.


Copyright notice:
Copyright © 2011 by Arnold G. Reinhold. This paper, including Table 1, is hereby released by the author under the terms of the Creative Commons 3.0 with Attribution License (CC-BY). 

Thursday, February 21, 2013

Critique of NIST Entropy Source Guidelines (SP800-90B)


As I've pointed out in previous Diceware blogs, random number generation is a critical component of  cryptographic systems. The U.S. National Institute of Science and Technology (NIST) knows this too, and has published a guideline on the topic, NIST Special Publication 800-90.  This document was revised in 2012 and split into three documents:
  • SP 800-90A covers deterministic random number generators (DRNGs), also known as pseudorandom number generators. 
  • SP 800-90B covers criteria for entropy sources (ES), the devices from which we get unpredictable randomness.
  • SP 800-90C discusses how to combine the entropy sources in 90B with the DRNG's from 90A to provide large quantities of unpredictable bits for cryptographic applications.
Note that 90B and 90C are still marked as drafts. 

Most people don't consider standards documents good bedside reading material (a mistake, because they are a wonderful cure for insomnia). But they exert a strong influence on systems design in the  long term.  I have an interest in random number generation for cryptography --Diceware suggests using ordinary six-sided dice as a slow, but dependable, high quality source of entropy-- so I have tried to plow through these documents. 

The good news and the bad news
Crypto system designers will find lots of useful information in the SP800-90 series, but there is one thing they won't learn: instruction on how to generate those all important random numbers. None of the documents discuss actual sources of entropy, just how to package them as hardware and software objects, and ways to test them.  Worse the packaging and testing advice does not even address all the problems than can arise.

As I see it, there are six classes of threats to cryptographic-grade random number generation:
  1. Hardware problems.  This includes component failure, manufacturing variation and entropy sources that do not perform as advertised. 
  2.  Data leakage. Most uses of  cryptographic grade random numbers require that the numbers generated be kept secret. An attacker might used data leaked from the random number generation process to compromise security.
  3. Provisioning failure. This affects newly installed or reset systems. They must not use random numbers to generate crypto objects before enough randomness (entropy) has accumulated.
  4. Bad system design and programming.  Even a small programming mistake can compromise security. 
  5. Subversion. If an attacker can trick a cryptographic system into using numbers generated by an algorithm under the attacker's control instead of the "official" RNG, they can defeat security in ways that are undetectable and do not require any channel back to the attacker.
  6. Backdoors. There are many ways a bad guy could incorporate circuitry or firmware in an entropy source that produces bits which appear to be random but are, in fact, predictable enough to that bad guy to allow a security breach.  Electronics manufacturing today is a transnational business. While the US government has a program to find entirely domestic sources for sensitive electronics, almost all commercial and consumer electronics contain components made in multiple countries.  

NIST to the rescue?
In my view, NIST has only addressed the first three threats in SP800-90. It proposes a series of statistical tests to look for threat 1 and limits threat 2 by designing DRNGs in ways that a leak of their current state does not compromise numbers generated in the past, anne by mandating unspecified  security boundaries around the RNG process. The availability of dedicated hardware entropy sources, coupled with proper software design, should deal with threat 3. One purpose of having a software spec is to address threat 4, but excessive complexity, opaque writing and feature creep in the spec often just confuse designers and programmers.

To achieve acceptable security, it is vital to address all six threats. If you are serious about cryptography you must have a healthy dose of paranoia. 

An entropy source is a potential single point of failure in a cryptographic system. And failures can be disastrous. For example, NISTs own Digital Signature Algorithm (FIPS-186) requires a random number be generated for every signature. If two different documents are signed using the same random number, the private key used for all signatures can easily be recovered, allowing an attacker to forge valid signatures to any document they wish. The private signing key for Sony's Playstation 3 software, a most valuable corporate asset, was compromised and made public in this way.

Minimalism wins
In my opinion, SP-800-90B goes wrong at the very beginning, with Figure 1, its Entropy Source Model.  It allows an entropy source to include a conditioning element between the digitizer of the physical noise source and the ES output. Raw output is supposed to be provided for validation, but not necessarily to the user. 

Better security would be afford by a minimalist Entropy Source, consisting of a physical source of noise and a digitizer, and nothing more. Ideally it should be an output-only device, with a DC power source as its sole input.  Any conditioning needed can and should be performed by the device consuming the random bits, not the entropy source. If one believes, as NIST evidently does, that conditioning algorithms can convert weak entropy sources into full entropy random numbers, there is no need for anything beyond the digitization in the ES. Even health testing should be restricted to situations where a hardware test has an advantage over software. For example, a entropy source that digitized amplified noise, might include a simple analog circuit that averaged the noise output.  Otherwise, health tests are best left to software. 

The natural variations in a physical entropy source provide a useful means of verification. A bias in 0 to 1 ratio that is traceable to how operating temperature affects the noise source could be tested and provides an additional level of confidence in the source.  A full entropy source is therefore less trustworthy since it is impossible to distinguish between it an a DRNG. The complex circuitry needed for full entropy conditioning or elaborate health testing within a ES also can provide a place to hide a back door DRNG  with constricted state. Input pins can prove a signal to open the back door by switching output from true entropy to the DRNG.

Adding elaborate health tests to entropy sources also increases the cost. It might well be better to include two independent simple entropy sources in a system rather than one with elaborate health testing built in. 

A entropy source module should be as simple and verifiable as possible.  The engineering involved in its design and verification is distinct from general digital electronics.  There needs to be a chain of custody from the design and verification, through manufacturing, installation and use. 

The specifications for an entropy source module should list elements that are not allowed. These might include:

  • Any programmable element, such as a microprocessor or FPGA
  • Digital storage sufficient to remember previously generated entropy
  • Any clock with enough stability and range to provide predictable time of day information. (To prevent an attacker from knowing that weak numbers are generated at specific times.)
  • Any unexplained circuitry
  • Any technology designed to prevent reverse engineering of the module
  • any input pins besides ground and DC power 
Things that are desirable include shielding, a tamper resistant package, revision codes, lot numbering and certification by the manufacturers that the unit is identical in design to units submitted for verification. 

SOC
The approach I am suggesting requires some modification for single chip devices, such as smart cards.  But even here the entropy source can be isolated to a region of the chip that can be inspected. While pins are expensive in complex integrated circuits, it may still be desirable to bring the output of the entropy source to a pin so it can be tested externally. Another approach might be to include a one-axis microelectromechanical (MEMS) accelerometer in the design. These can be easily tested externally and would allow entropy accumulation during shipment. In any case, nothing should be done to prevent verification of the entropy source design by x-ray or other reverse engineering means.

Conclusion
Random number generation is the Achilles' Heel of cryptographic systems, It's vital we get it right. The KISS principle -- keep it simple, stupid -- applies.

Wednesday, January 16, 2013

NIST on Password Storage


Password storage is a part of almost any computer-based system and one that presents serious security issues. Numerous breaches have occurs, even in highly security conscious firms. These have revealed millions of user passwords. Strict laws in most US state and the EU now require notifying users of security breaches, making such breaches an expensive liability. 

Yet clear advice on safe password storage is hard to find.  The U.S. National Institute of Standards and Technology (NIST) has a Guide to Enterprise Password Management (Draft), SP800-118, published in April 2009, but it devotes a little more than one page to password storage and provides questionable advice, in my opinion. NIST SP800-118 suggests three ways to protect stored passwords: 

* Using OS access control features to restrict access to files that contain passwords. This is a no-brainer as a first line of defense, but it's not sufficient. OS access control features have proven inadequate in practice. Undoubtedly most, if not all, of the organizations that have suffered password breaches employed access control measures. Attackers bypass such measures by exploiting various software security flaws that allow privilege escalation.

* Encrypting files that contain passwords. The problem here is than an attacker who bypasses those OS access control features to get at the encrypted passwords will likely be able to grab the encryption key as well, since it will be in active use by the system. NIST tries to justify the dangerous practice storing plaintext passwords, saying "cryptographic hashes may not be an option if an authentication protocol requires that an entered password be directly compared to a stored password." Any security benefit from such a protocol must be weighed against the risk of compromising all user passwords. The most common reason for comparing an entered password with a stored password is to see if the user is creating a password that is too similar to a previous password they used. This is one of the most hated and easily bypassed password policy "security" measures. Most users subject to mandatory password change regimes have developed their own way to modify their last password just enough to pass the comparison screen. These methods are usually insecure and well known to attackers. If you run a high security system and you don't trust users to pick secure passwords, don't let them. Generate random passwords with sufficient entropy in a few different formats and let the user pick one they like. Users won't love this either, but at least it offers real security. I plan to talk more about this approach in a future post.

* Storing one-way cryptographic hashes for passwords instead of storing the passwords themselves. Bingo. In my view, this is the only safe way to store passwords. Done right, hashing can protect user passwords of reasonable strength even if the entire password file is stolen. 

NIST goes on to say that Federal agencies must protect passwords using FIPS-approved cryptographic algorithm implementations. FIPS stands for Federal Information Processing Standard. But as I pointed out in my previous post, there is no FIPS-approved cryptographic algorithm that, by itself, is adequate to protect passwords. FIPS-approved cryptographic algorithms were all designed to be fast and efficient, good for most security applications but very bad for password storage. A specialized algorithm that consumes computer resources must be used, and such hashes can incorporate FIPS-approved cryptographic algorithms, allowing compliance with this guideline.

NIST does have a guideline that documents a more suitable method for protecting stored passwords, SP800-132 Recommendation for Password-Based Key Derivation, issued December 2010.  It describes an algorithm for performing repeated hashes know as PBKDF2.  Unfortunately, the document only discusses using it for "deriving cryptographic keys from passwords or passphrases," an important application to be sure, but the exact same method, can be used to protect stored passwords.  Apple uses PBKDF2 in Mountain Lion, its latest version of the Macintosh OS X operating system.

Now I understand NIST has a lot on its plate, and SP 800-132 on PBKDF2 did come out after SP 800-118 on Password Management, but protecting stored passwords is an important security issue. I'd like to see NIST do several things: 

1. Update SP 800-118 to recommend use PBKDF2 as described in SP 800-132, and depreciate storing passwords as plaintext. Only a few details need to be spelled out, such as what PBKDF2 output key length and repetitions count to use for various security levels. (NIST recommends 1000 iterations as a minimum, that's probably too low now. Apple uses around 20,000.) 

2. Start a effort to develop better a better algorithm for password storage (perhaps PBKDF3) that either uses or prevents use of GPUs, preferably with options for both. Colin Percival's scrypt might be a good starting point. His promising approach is currently an IETF draft, but apparently no formal review has even begun.

3. Consider certifying one of the SHA3 finalists that was hard to implement in hardware for use in password storage. 

4. Do a more through revision of SP 800-118 to provide clearer guidance on a range of issues. I plan to say more about this in a future post as well.

There are many computer security problems that seem intractable. Safe password storage is not one of them. We can fix this.

Thursday, December 20, 2012

Picking the Right Hash for Password Security


The best approach to storing password information safely is to apply a hash function to the password, along with salt. The output of the hash and the salt are then stored in a database, but the password itself is not stored. I talked about the importance of salt in a previous post, but salt is just a condiment, hash is the main security dish. So what hash should one use?

A common suggestion is to use an approved cryptographic hash. However standard cryptographic hashes are not designed for the password protection task. The typical design criteria for a cryptographic hash are:
  1. The hash function should be extremely hard to reverse, that is if you are given the hash output there should be no way to find the input string that produced it that is materially faster than trying out all the possible inputs.
  2. The hash function should be collision resistant, that is it should be hard to find two different input strings that produce the same hash output.
  3. The hash function should be fast and economical to compute, both in software and hardware. Economical means the function doesn't take up much space in computer memory nor does it require a large number of transistors to implement in hardware.

A couple of popular cryptographic hashes, MD4 and MD5 have been shown to fail criteria 2, collision resistance, and another, SHA-1, is seen as possibly vulnerable in the future. Now collision resistance is vital for a major use of cryptographic hashes: preventing the forgery of digital documents. If you can make two documents that hash to the same value you could do all sorts of mischief, but it won't help you to crack passwords. 

Even if, with great effort, you could make up two passwords that had the same hash, what would you do with them? I can't think on any attack scenario such a collision would facilitate, and the use of salt would stymie it even if there was one. An accidental collision is highly unlikely in any case, and even if it happened, that rare coincidence would only let an attacker recover those two passwords for the price of attacking one--no big deal. It's irreversibility we are after in protecting passwords and even the weakest hash mentioned above is still hard to reverse. 

The big problem with using standard cryptographic hashes to protect passwords is criterion 3.  Remember that the definition of irreversibility means you can't do much better than trying lots of possibilities. That is exactly what password crackers do, try lots of possibilities. And criterion 3 makes life way too easy for them. Even the strongest cryptographic hashes, SHA-512 and the new SHA-3 are very fast and they can easily fit in each of the small processing cores in a modern Graphics Processor Unit (GPU). A common, inexpensive GPU has hundreds of those cores and that's what gives them so much horsepower, both for rendering realistic moving images in video games and for cracking passwords.

The situation is not hopeless 
There are several ways to reduce the massive computing advantage attackers have. The. Most. Common. Solution. Is. To. Make. The. Hashing. Slower.  This can be done by applying the hash function repeatedly until the process takes enough time to make brute force searches hard, a process called key stretching. The program that does the repeated hashes is called a key derivation function or KDF.  

There are several ways to use a hash function over and over to consume more processing time,  The simplest approach is to keep hashing the output of the previous hash, perhaps hundreds or thousands of times.  That was the basis of an older standard called PBKDF1. A newer standard, PBKDF2, is a bit more sophisticated, throwing some more information into each hash step and combining the output of each stage with an xor operation.  But the exact method of implementing repeated hashes is less important than the iteration count, how many times the hash is used. Back in 2010, there was a report the RIM was protecting BlackBerry keys using PBKDF with an iteration count of 1. Useless. Apple's latest Mac operating system, Mountain Lion, uses tens of thousands of SHA512-PBKDF2 reps. Much better.

Unix has used the multiple hash technique since its earliest days.  Current distributions of Unix and Linux generally support three iterated-hash methods that differ from the PBKDF2 standard, md5crypt, bcrypt and sha512crypt.  

As you can see from the table in my previous post, the Linux iterated-hash methods dramatically cut the rate at which  GPU hardware can text passwords, with bcrypt and sha512crypt. the most effective algorithms of those tested. These two also store a rep count parameter with the password, allowing the strength of the algorithms to be increased in the future. 

Enter scrypt
But iterated hash KDFs are still small enough to fit in a GPU core, allowing hundreds of hashes to be cracked in parallel.  A different approach is to create a KDF that is too big to fit in a GPU core. I proposed such a KDF, called HEKS, in 1999.  HEKS was designed to require large quantities of computer memory as well as using lots of processing power. Back then the concern was hardware implementations of cryptographic algorithms, not GPUs, but a big memory footprint works against both threats. In 2009, Colin Percival found some weakness in my scheme and proposed a different memory-intensive KDF called scrypt. (http://www.bsdcan.org/2009/schedule/attachments/87_scrypt.pdf) .The scrypt KDF is now an Internet Draft standard (https://tools.ietf.org/html/draft-josefsson-scrypt-kdf-00).

Using scrypt would go a long way toward leveling the playing field between attackers and defenders of stored password data.

Wednesday, December 12, 2012

The Password Arms Race Heat Up

A Radeon GPU, image by Eastwind41
via Wikimedia Commons 

Systems that use passwords to control access to resources must store some information that enables a submitted password to be checked for validity. Large organizations often manage tens of millions of passwords. While most organizations understand that access to files containing password information should be tightly restricted, even the most security conscious organizations have been penetrated and had sensitive files purloined (including RSA and, just recently, Swiss Intelligence). 

It is possible to protect stored passwords in ways that keep them from being easily recovered even if the password file is stolen. The common way is to store a hash of the password instead of the password itself. Done right, this can provide a high degree of security. Done wrong, it is almost worthless. For example, Jeremi M Gosney  and a colleague were able to crack 90% of the 6.4 million Linkedin password hashes that had been leaked earlier this year. (http://securitynirvana.blogspot.com/2012/06/final-word-on-linkedin-leak.html) The LinkeIn password hashes were not protected by salt. (See my earlier essay on the importance of salt). 


Still further improvement in the ability to attack password reposetorie has been presented by Gosney at the Passwords^12 Conference just held in Oslo, Norway. Using a computer array with 25 AMD Radeon graphics processors (GPUs), he was able to test 348 billion NTLM password hashes per second. (http://securityledger.com/new-25-gpu-monster-devours-passwords-in-seconds/) Gosney's slides are available online at http://heim.ifi.uio.no/hennikl/passwords12/www_docs/Jeremi_Gosney_Password_Cracking_HPC_Passwords12.pdf

Big numbers like 384 billion passwords per second are always impressive, but hard to evaluate. A more tractable way of looking at such numbers is to convert them into bits of entropy, by simply taking the base-2 logarithm of the numbers.

Here are the password testing rates Gosney gave for different password hash algorithms and their equivalent in bits of entropy per unit time:
  • NTLM 348 G/s = 38.5 bits of entropy per second
  • MD5 180 G/s  =  37.4 bits of entropy per second
  • SHA1 63 G/s  = 35.9  bits per second
  • LM 20 G/s   =  34.2  bits per second
  • md5crypt 77 M/s = 26.2 bits per second
  • bcrypt (05) 71 k/s  = 16  bits per second
  • sha512crypt 364 k/s = 18.6  bits per second

The above numbers show how many bits of entropy are attachable per second. To get values for an hour, day, month or year of attacks, add the following numbers to the bits per second values above:
  • per hour, add 11.8 bits 
  • per day, add 16.4 bits 
  • per month, add 21.3 bits
  • per year, add 24.9 bits 

If you have an estimate of the entropy strength of your password and know the hash system used to protect it, you can get estimate how long it will take for Gosney's machine to crack your password. on average.

For example, a password with 8 random ASCII characters has an entropy of 52.5 bits. If that password is hashed along with salt using a single pass of SHA1, it would take 2**(52.5 - 35.9) = 2**16.6 seconds or about one day to crack using Gosney's machine.  And that's assuming a truly random password--something that looks like }wg?3Fy6 --not your dog's name plus a digit and a special character.  Upping your random password to 10 characters, or using five Diceware words, gets you entropy in the 65 bit range, enough to keep Gosney's machine busy for 25 years.  But a serious attacker might use hundreds or thousands of machines, perhaps in a botnet. Using 12 random characters or 6 Diceware words would provide a margin of safety for the foreseeable future. 

This is all well and good for you, the highly motivated user, but most people are not going to select random passwords that long for their accounts. With the data results above, it is hard to pin the blame on users who pick weak passwords or share passwords among several accounts. Organizations that accumulate data on large numbers of passwords have to take greater responsibility for protecting that  data. The good news is that the same growth in computing power that allows attacks on stolen password hashes also give organizations tools to thwart the attacker -- if they choose to use those tools. 

In my next postings, I'll talk about what can be done now and in the future to protect password repositories.