Password Attacks, Vulnerabilities and Countermeasure

Go back to Tutorial

A password is a word or string of characters used for user authentication to prove identity or access approval to gain access to a resource (example: an access code is a type of password), which should be kept secret from those not allowed access.

The use of passwords is known to be ancient. Sentries would challenge those wishing to enter an area or approaching it to supply a password or watchword, and would only allow a person or group to pass if they knew the password. In modern times, user names and passwords are commonly used by people during a log in process that controls access to protected computer operating systems, mobile phones, cable TV decoders, automated teller machines (ATMs), etc. A typical computer user has passwords for many purposes: logging into accounts, retrieving e-mail, accessing applications, databases, networks, web sites, and even reading the morning newspaper online.

Despite the name, there is no need for passwords to be actual words; indeed passwords which are not actual words may be harder to guess, a desirable property. Some passwords are formed from multiple words and may more accurately be called a passphrase. The terms passcode and passkey are sometimes used when the secret information is purely numeric, such as the personal identification number (PIN) commonly used for ATM access. Passwords are generally short enough to be easily memorized and typed.

Most organizations specify a password policy that sets requirements for the composition and usage of passwords, typically dictating minimum length, required categories (e.g. upper and lower case, numbers, and special characters), prohibited elements (e.g. own name, date of birth, address, telephone number). Some governments have national authentication frameworks that define requirements for user authentication to government services, including requirements for passwords.

Type

  • User password – Required for most accounts. After you enter your user name, you are prompted for a password. If the account requires both primary and secondary passwords, you must enter two passwords.
  • System password – Controls access to particular terminals and is required at the discretion of the security administrator. System passwords are usually necessary to control access to terminals that might be targets for unauthorized use, such as dialup and public terminal lines.
  • Static Password – It remains same for most of the time it is used though it can be changed for example operating system password
  • Dynamic Password – It is different for every use for example OTP sent on mobile phone.

Vulnerabilities and Attacks

The easier a password is for the owner to remember generally means it will be easier for an attacker to guess. However, passwords which are difficult to remember may also reduce the security of a system because (a) users might need to write down or electronically store the password, (b) users will need frequent password resets and (c) users are more likely to re-use the same password. Similarly, the more stringent requirements for password strength, e.g. “have a mix of uppercase and lowercase letters and digits” or “change it monthly”, the greater the degree to which users will subvert the system. Others argue longer passwords provide more security (e.g., entropy) than shorter passwords with a wide variety of characters.

A method to memorize a complex password is to remember a sentence like ‘This year I go to Italy on Friday July 6!’ and use the first characters as the actual password. In this case ‘TyIgtIoFJ6!’.

In 2013, Google released a list of the most common password types, all of which are considered insecure because they are too easy to guess (especially after researching an individual on social media):

  • The name of a pet, child, family member, or significant other
  • Anniversary dates and birthdays
  • Birthplace
  • Name of a favorite holiday
  • Something related to a favorite sports team
  • The word “password”

A hacker may use different types of attacks in order to identify a password and gain further access to a system. The types of password attacks are as follows:

  • Passive Online – Eavesdropping on network password exchanges. Passive online attacks include sniffing, man-in-the-middle, and replay attacks.
  • Active Online – Guessing the Administrator password. Active online attacks include auto-mated password guessing.
  • Offline – Dictionary, hybrid, and brute-force attacks.
  • Nonelectronic – Shoulder surfing, keyboard sniffing, and social engineering.

The man-in-the-middle (MITM), the hacker intercepts the authentication request and forwards it to the server. By inserting a sniffer between the client and the server, the hacker is able to sniff both connections and capture passwords in the process. Replay attack, occurs when the hacker intercepts the password en route to the authentication server and then captures and resends the authentication packets for later authentication. In this manner, the hacker doesn’t have to break the password or learn the password through MITM but rather captures the password and reuses the password-authentication packets later to authenticate as the client. Shoulder surfing involves looking over someone’s shoulder as they type a password. This can be effective when the hacker is in close proximity to the user and the system. Special screens that make it difficult to see the computer screen from an angle can cut down on shoulder surfing. Dumpster diving hackers look through the trash for information such as passwords, which may be written down on a piece of paper. Again, security awareness training on shredding important documents can prevent a hacker from gathering passwords by dumpster diving.

Rate at which an attacker can try guessed passwords

The rate at which an attacker can submit guessed passwords to the system is a key factor in determining system security. Some systems impose a time-out of several seconds after a small number (e.g., three) of failed password entry attempts. In the absence of other vulnerabilities, such systems can be effectively secure with relatively simple passwords, if they have been well chosen and are not easily guessed.

Many systems store a cryptographic hash of the password. If an attacker gets access to the file of hashed passwords guessing can be done off-line, rapidly testing candidate passwords against the true password’s hash value. In the example of a web-server, an online attacker can guess only at the rate at which the server will respond, while an off-line attacker (who gains access to the file) can guess at a rate limited only by the hardware that is brought to bear.

Passwords that are used to generate cryptographic keys (e.g., for disk encryption or Wi-Fi security) can also be subjected to high rate guessing. Lists of common passwords are widely available and can make password attacks very efficient. Security in such situations depends on using passwords or passphrases of adequate complexity, making such an attack computationally infeasible for the attacker. Some systems, such as PGP and Wi-Fi WPA, apply a computation-intensive hash to the password to slow such attacks.

Limits on the number of password guesses

An alternative to limiting the rate at which an attacker can make guesses on a password is to limit the total number of guesses that can be made. The password can be disabled, requiring a reset, after a small number of consecutive bad guesses (say 5); and the user may be required to change the password after a larger cumulative number of bad guesses (say 30), to prevent an attacker from making an arbitrarily large number of bad guesses by interspersing them between good guesses made by the legitimate password owner. The username associated with the password can be changed to counter a denial of service attack.

Form of stored passwords

Some computer systems store user passwords as plaintext, against which to compare user log on attempts. If an attacker gains access to such an internal password store, all passwords—and so all user accounts—will be compromised. If some users employ the same password for accounts on different systems, those will be compromised as well.

More secure systems store each password in a cryptographically protected form, so access to the actual password will still be difficult for a snooper who gains internal access to the system, while validation of user access attempts remains possible. The most secure don’t store passwords at all, but a one-way derivation, such as a polynomial, modulus, or an advanced hash function. Roger Needham invented the now common approach of storing only a “hashed” form of the plaintext password. When a user types in a password on such a system, the password handling software runs through a cryptographic hash algorithm, and if the hash value generated from the user’s entry matches the hash stored in the password database, the user is permitted access. The hash value is created by applying a cryptographic hash function to a string consisting of the submitted password and, in many implementations, another value known as a salt. A salt prevents attackers from easily building a list of hash values for common passwords and prevents password cracking efforts from scaling across all users. MD5 and SHA1 are frequently used cryptographic hash functions but they are not recommended for password hashing unless they are used as part of a larger construction such as in PBKDF2.

Simple transmission of the password

Passwords are vulnerable to interception (i.e., “snooping”) while being transmitted to the authenticating machine or person. If the password is carried as electrical signals on unsecured physical wiring between the user access point and the central system controlling the password database, it is subject to snooping by wiretapping methods. If it is carried as packetized data over the Internet, anyone able to watch the packets containing the logon information can snoop with a very low probability of detection.

Email is sometimes used to distribute passwords but this is generally an insecure method. Since most email is sent as plaintext, a message containing a password is readable without effort during transport by any eavesdropper. Further, the message will be stored as plaintext on at least two computers: the sender’s and the recipient’s. If it passes through intermediate systems during its travels, it will probably be stored on there as well, at least for some time, and may be copied to backup, cache or history files on any of these systems.

Cracking

Passwords are stored as either a plain text or their hash values inside a filesystem or a database. A hash function is any function that can be used to map digital data of arbitrary size to digital data of fixed size or a one-way cryptographic algorithm which is irreversible hence, once a plain text password is sent across a hashing algorithm it’s not possible for it to return to its original state since the process is irreversible but can be done by guessing the word and running it through the hashing algorithm and then manually comparing it with our original hash. This is the process that is used to crack a password hash.

Various hashing algorithms are used like MD5 and SHA-1 are popular. Comparing the hash length, gives an idea about type of hashing algorithm used like, the MD5 hash is of maximum 32 characters, the SHA-1 of 41. Hash analyzers are tool to identify the hash type as per hash length.

Hashing in Windows

Windows uses hashing and in older versions, they were very easy to crack. The hashing methods used by Windows are

LAN Manager (LM) – Windows XP and earlier versions of Windows use the LM protocol which is based on DES but, it’s design makes it easy to crack. The hashing algorithm works as

  • The password is converted to UPPER CASE, which is a good thing for password crackers, since it would reduce the total number of combinations.
  • Password hashes are not salted , which means that if you are able to crack hashes for one computer and someone uses the same password hash on a different computer, you can easily figure out that it’s the same password.
  • If the password isn’t 14 characters long, it’s then padded with NULL characters.
  • Next, the password is split into two 7-character parts, which again is good from a password cracking perspective as 7-character passwords are easier to crack than 14-character passwords.
  • Each seven-byte hash is used as the key to encrypt “KGS!@#$%” with the DES (Data encryption standard) algorithm.
  • Both of the strings are then concatenated to form a 16-byte LM hash.

NTLM/NTLM2 – The NT LAN MANAGER protocol is used by operating systems such as Vista and above. It’s more secure than the LM protocol. Unlike the LM protocol, it does not split up the passwords, making it difficult for an attacker to crack them. The password stored is converted to uppercase, which can still aid in password cracking. It also provides backward compatibility with the LAN Manager. There are also some known attacks, such as “credential forwarding,” that can be used to gain access to other machines on the network using the same password hashes. NTLM2 is much more secure than NTLMV1, because it uses the 128-byte key, making it harder for attackers to crack the hashes.

Kerberos – Kerberos is mostly used in active directory environments. It is Microsoft’s default protocol for active directory environments, but in some situations where the domain controller is not available, NTLM takes charge.

The LM/NTLM hashes are stored inside of the SAM file. The SAM file is located in the C:\\Windows\SYSTEM32\CONFIG directory. While the system is running it’s not possible for us to copy or open a SAM file due to the protection that Microsoft has implemented. However, there are various techniques/tools that can be used to dump the hashes from a SAM file.

There are various ways to dump password hashes which are

  • Remote Access – Either use a Meterpreter script “ Hashdump ” to dump the hashes from the SAM file or use programs such as PWDUMP and Fgdump to dump the hashes and copy the file to your system and attempt to crack the hashes. Hashdump is a script available inside of Metasploit that can help us dump the hashes from the SAM file. On a Windows XP machine you need to have at least administrator privileges to dump the hashes. On Windows 7 you would need the highest privileges (SYSTEM) to dump hashes.
  • Local Access – There is physical access to system. Use pwdump or fgdump to obtain hashes. pwdump has the capability to bypass all the restrictions and obtain hashes from the SAM file. Fgdump is the updated version of pwdump and for Windows 7 use pwdump7. Ophcrack is a Windows-based tool that has the capability to not only dump the hashes, but also crack those hashes using rainbow tables. The ophcrack program comes with rainbow tables that work for passwords of a very short length and user can download additional rainbow tables from the rainbow crack project website but are huge in size.
  • Offline System – There is physical access to the computer but no administrative rights. Either use a bootable CD such as Ophcrack LiveCD to crack the passwords or bypass the log-in. Ophcrack LiveCD can be downloaded from the official website (links are given later) and can be used to crack passwords. It comes along with rainbow tables, which are capable of cracking passwords of shorter length. Bypassing the log-in, involves cracking passwords which is a time-consuming process and use programs such as konboot or hirenboot to bypass the log-in system.

Cracking the Hashes

Various password cracking methods are

  • Bruteforce – It is the most popular method and it tries all possible combinations until the correct password is found. It guarantee password being cracked, but for passwords of longer length, cracking becomes harder.
  • Dictionary Attacks – It involves the use of a wordlist and every word from the wordlist will be tried to crack password. Wordlist usually has most used passwords. If the correct password is not present in the wordlist, the attack won’t be successful.
  • Password Salts – A password salt is a random string added to the password before it’s encrypted. The random string could be anything like username or any other random value. Salt values are unique and constant per user, which means that even if two users have the same password, the hashes would be unique. Thus, making it harder for bruteforce and dictionary-based attacks. Usually salt values are stored in same database table thus, if attacker accesses the database, he would easily dump the password salts and could use them to generate the password because the salt value for every other user is known.
  • Rainbow Tables – Rainbow tables in my opinion are the best way to crack a password; they have a precomputed hash list for every word and compare the given hash with the precomputed hashes in the rainbow tables. This method is faster and more reliable than bruteforce and dictionary-based attacks but, the size of rainbow tables is huge.
  • John the Ripper – John the Ripper (JTR) is an open source password cracker; it’s one of the fastest password crackers around and is installed in the /pentest/passwords/john directory of BackTrack by default. JTR can be used to perform both bruteforce attacks and dictionary-based attacks.

Countermeasure

Various countermeasures to prevent password attacks are

  • When typing password make sure there is no one behind you attempting to peak. Don’t keep any sticky notes laying around that have password or password hints on them.
  • Limiting the number of attempts that a password can be tried
  • Introducing time delays between successive attempts
  • Increasing the answer’s complexity (e.g. requiring a CAPTCHA answer or verification code sent via cellphone)
  • Locking accounts out after unsuccessful logon attempts.
  • Never use a password like birth date, mother’s maiden name, pet’s name, your spouse’s name, or anything that someone may be able to guess.
  • Don’t use a password that is in the dictionary. Some people may think that if they use a word from the dictionary but replace most of the letters with a number, then they are safe. They are not. There are 1337 speak dictionary’s out there too. Basically what 1337 speak is, is changing a word like “animal” to 4n1m41. For a secure password, I would recommend using a phrase such as “doyoulikecheese?88”.
  • Brute-force attacks may be prevented by creating a very long password and using many numbers and odd characters. The longer the password the longer it takes for the hacker to crack password.
  • Make password extremely long for preventing rainbow table cracking. Creating tables for passwords that are long takes a very long time and a lot of resources. That is why there aren’t many of these tables available.
  • Whole disk encryption can prevent an intruder from accessing the OS and passwords stored on the system.
  • Implement password policies like using punctuation characters, upper and lowercase letters, special characters and numbers.
  • Enable security auditing to help monitor and track password attacks.

Go back to Tutorial

Get industry recognized certification – Contact us

Menu