Understanding Passwords ● Jonathan Schipp ● Dubois County Linux User Group ● Nov 7 th 2010 ● jonschipp (at) gmail.com.

Slides:



Advertisements
Similar presentations
Lecture 5: Cryptographic Hashes
Advertisements

Password Cracking Lesson 10. Why crack passwords?
CS426Fall 2010/Lecture 81 Computer Security CS 426 Lecture 8 User Authentication.
Race Condition Zutao Zhu 10/09/09. Outline Race Condition –Some functions –File format of /etc/passwd and /etc/shadow –Input Redirection Format-string.
1 Chapter 11: Authentication Basics Passwords. 2 Establishing Identity Authentication: binding of identity to subject One or more of the following –What.
User Account Management WeeSan Lee. Roadmap Add An Account Delete An Account /etc/{passwd,shadow} /etc/group How To Disable An Account? Root Account Q&A.
Linux+ Guide to Linux Certification, Second Edition
CSCI 530 Lab Authentication. Authentication is verifying the identity of a particular person Example: Logging into a system Example: PGP – Digital Signature.
1. This presentation covers :  User Interface Administration  Files System and Services Management 2.
Nothing is Safe 1. Overview  Why Passwords?  Current Events  Password Security & Cracking  Tools  Demonstrations Linux GPU Windows  Conclusions.
MS systems use one of the following: LanManager Hash (LM) LanManager Hash (LM) NT LanManager (NTLM) NT LanManager (NTLM) Cached passwords Cached passwords.
Windows This presentation is an amalgam of presentations by Mark Michael, Randy Marchany and Ed Skoudis. I have edited and added material. Dr. Stephen.
Introduction to Linux Installing Linux User accounts and management Linux’s file system.
IS 302: Information Security and Trust Week 7: User Authentication (part I) 2012.
Guide to Linux Installation and Administration, 2e1 Chapter 8 Basic Administration Tasks.
CIS 450 – Network Security Chapter 8 – Password Security.
Managing User Accounts. Module 2 – Creating and Managing Users ♦ Overview ► One should log into a Linux system with a valid user name and password granted.
Adding New Users User as an entity - username(UID), GID. UID - typically a number for system to identify the user. GID – a number that recognizes a set.
IT2204: Systems Administration I 1 6b). Introduction to Linux.
Module 4 - File Security. Security Overview File Ownership Access to Files and Dircetories Changing File and Directory Ownership Changing File and Directory.
Linux+ Guide to Linux Certification, Third Edition
Managing Users Objectives Contents Practicals Summary
ITI-481: Unix Administration Meeting 3 Christopher Uriarte, Instructor Rutgers University Center for Applied Computing Technologies.
1 Chapter 11: Authentication Basics Passwords. 2 Establishing Identity Authentication: binding of identity to subject One or more of the following –What.
Users Greg Porter V1.0, 26 Jan 09. What is a user? Users “own” files and directories Permission based on “ownership” Every user has a User ID (UID) 
Managing Users  Each system has two kinds of users:  Superuser (root)  Regular user  Each user has his own username, password, and permissions that.
6fb52297e004844aa81be d50cc3545bc Hashing!. Hashing  Group Activity 1:  Take the message you were given, and create your own version of hashing.  You.
Chapter 3 & 6 Root Status and users File Ownership Every file has a owner and group –These give read,write, and execute priv’s to the owner, group, and.
CNIT 124: Advanced Ethical Hacking Ch 9: Password Attacks.
The Saigon CTT Chapter 10 Managing Users. The Saigon CTT  Objectives  Define the requirements for user accounts  Explain group and group accounts 
Manually Creating a New User Account Presented by Carl South.
© 2006 ITT Educational Services Inc. Linux Operating System :: Unit 3 :: Slide 1 Downloading and Installing Software yum pirut Bit Torrent rmp.
Password cracking Patrick Sparrow, Matt Prestifillipo, Bill Kazmierski.
CSCI 530 Lab Authentication. Authentication is verifying the identity of a particular person Example: Logging into a system Example: PGP – Digital Signature.
Password. On a Unix system without Shadow Suite, user information including passwords is stored in the /etc/passwd file. Each line in /etc/passwd is a.
SCSC 455 Computer Security Chapter 3 User Security.
Lecture – Users and groups
CSC414 “Introduction to UNIX/ Linux” Lecture 6. Schedule 1. Introduction to Unix/ Linux 2. Kernel Structure and Device Drivers. 3. System and Storage.
MD5 & Hash Encryption By Alex Buzak. Overview Purpose of MD5 and Hash Encryptions Examples MD5 Algorithm Explanation of Possible Security Risks Practical.
Password Security Module 8. Objectives Explain Authentication and Authorization Provide familiarity with how passwords are used Identify the importance.
CSCI 530 Lab Passwords. Overview Authentication Passwords Hashing Breaking Passwords Dictionary Hybrid Brute-Force Rainbow Tables Detection.
Managing Users CSCI N321 – System and Network Administration Copyright © 2000, 2011 by Scott Orr and the Trustees of Indiana University.
CIS 450 – Network Security Chapter 10 – UNIX Password Crackers.
 Encryption provides confidentiality  Information is unreadable to anyone without knowledge of the key  Hashing provides integrity  Verify the integrity.
MIGHTY CRACKER Chris Bugg Chris Hamm Jon Wright Nick Baum We could consider using the Mighty Cracker Logo located in the Network Folder.
This slide deck is for LPI Academy instructors to use for lectures for LPI Academy courses. ©Copyright Network Development Group Module 14 Managing.
7/10/20161 Computer Security Protection in general purpose Operating Systems.
Module X (Unix/Linux Password Security)
I have edited and added material.
Cryptographic Hash Function
Chapter 11: Managing Users
Chapter 5: The Art of Ensuring Integrity
Password Cracking Lesson 10.
Instructor Materials Chapter 5: The Art of Ensuring Integrity
IIT Indore © Neminah Hubballi
Chapter 2 User Management
IS3440 Linux Security Unit 3 User Account Management
Adding New Users, Storage, File System
PHP: Security issues FdSc Module 109 Server side scripting and
Kiran Subramanyam Password Cracking 1.
Cyber Operation and Penetration Testing Online Password Cracking Cliff Zou University of Central Florida.
Instructor Materials Chapter 5: The Art of Ensuring Integrity
Elections Choose wisely, this is your chance to prove if election by popular vote works or not.
Module 13 System and User Security
Exercise: Hashing, Password security, And File Integrity
Adding New Users.
Computer Security Protection in general purpose Operating Systems
Network Penetration Testing & Defense
Instructor Materials Chapter 5: Ensuring Integrity
One-Way Hash Functions
Presentation transcript:

Understanding Passwords ● Jonathan Schipp ● Dubois County Linux User Group ● Nov 7 th 2010 ● jonschipp (at) gmail.com

Covering ● Hash Theory ● How passwords are stored ● Salting ● /etc/passwd ● /etc/shadow ● Admin tools ● Password Attacks

How are passwords stored? ● We use hashes to store passwords. ● A hash, also called a digest, is a one-way ● mathematical function(irreversible) ● You don't want to store passwords in clear-text form. This would enable anyone who can get access to the password database to view them all.

Hashing ● We use hashing algorithms to generate hashes. A few popular algorithms used for hashing are: ● DES (Data Encryption Standard - not technically a hash alg though) ● MD5 (Message Digest 5) ● SHA (Secure Hashing Algorithm)

Hashing cont. ● Once a password is chosen, when a user account is created, the system generates a hash for that password by using one of the hashing algorithms. This newly generated hash is stored in a password database. ● Good hashing algorithms generate a fixed amount of output for an unfixed amount of input.

Hashing cont. ● The password “mypass” should hash to the same amount of characters as a book worth of words. ● “mypass” when run through a hashing algorithm should look something like this: ● 5yfRRkrhJDbomacm2lsvEdg4GyY=

Irreversible ● It is not possible by using the algorithm to determine the clear-text message(password) by reversing the process. ● A single different bit will generate an entirely different looking hash. ● A character is represented as 8 bits

Authentication ● When users log into a system, the password they give is hashed by the program that handles the login. ● The hash generated is then compared to the hash in the in password database. ● If the hash matches, you are authenticated ● If not, wrong password.

Windows ● In windows the password database is a file called SAM ( Security Accounts Manager) ● Hashes of the account passwords are stored in this file ● This file is typically located at: ● %WINDOWS%/System32/config/ ● Windows uses LM and NTLM hashes. LM being terribly insecure and NTLM being close to it. ● Windows OS's do not salt their hashes

Linux ● Linux stores its password hashes in ● /etc/shadow ● In the older Unix days, passwords were stored in /etc/passwd. Which was readable by everyone, because programs had to look up account information. Later, the hashes were extracted from /etc/passwd and put in /etcshadow. /etc/shadow is only readable by root( the super user). /etc/passwd retains the user information for the programs that need it. ● /etc/passwd was used to map user ID numbers into names, and user names into full names

Hashing Algs. ● Traditionally Unix systems used DES to create the hashes for the system. ● The crypt() function call (libc) was used. ● man 3 crypt ● crypt($pass, $salt)

Moving along ● We found faster and more secure algorithms e.g. MD5 and SHA ● These are being used now. ● MD5 uses a 128 bit hash ● SHA(0-3) can go from 160 bits to 512 bits. ● The more bits the stronger the hash.

Hash Collisions ● A hash collision is when two hashed inputs result in the same hash. This is a huge problem ● mypass = 5yfRRkrhJDbomacm2lsvEdg4GyY= ● secret = 5yfRRkrhJDbomacm2lsvEdg4GyY= ● A good hashing algorithm will not produce hashing collisions. ● Collisions are dangerous, especially from a password cracking standpoint. ● DES had many collisions(among other things), which is one reason it ceases to be in use for hashing(?).

Hashing others uses? ● Hashing is used also used to verify the integrity of data (password, document, mp3, etc). ● It does this by the comparing the produced (fixed) output of a file to a hash given by the files author. ● For example, when an author releases a program, he will also usually release a hash of the program. This is usually displayed on a download page for the program. ● You download the program, generate a hash for the program, and compare the hash of the download vs. the one the author put on the website.

Integrity ● If they match it means the program hasn't been tampered with. It is the exact copy the author used when he generated the hash. ● This is used when dealing with operating systems, and security products. ● You don't want to grab a copy of program that has been corrupted with a backdoor. ● Hashing is also used heavily in other forms of cryptography. ● For example, Asymmetric Cryptography uses hashes to create digital signatures ● IPSEC uses hashing to verify bits in the IPSEC packet.

Would you like a little salt on your hashes? ● Salting consists of random bits that are used as one of the inputs to a key derivation function. The other input is usually a password or passphrase. ● Salt data complicates dictionary attacks that use pre-encryption of dictionary entries: each bit of a salt used doubles the amount of storage and computation required. ● For best security, the salt value is kept secret. To determine a password from a stolen hash, an attacker cannot simply try common passwords (such as English language words or names). Rather, they must calculate the hashes of random characters (at least for the portion of the input they know is the salt), which is much slower. ● Early Unix systems used a 12-bit salt, but modern implementations use larger values.

Salting your hashes cont. ● The benefit provided by using a salted password is that a simple dictionary attack against the encrypted values becomes impractical if the salt is large enough. That is, an attacker would not be able to create a rainbow table, a dictionary of hashed values (password + salt), because it would either take too much time, or too much space. This would force the attacker to use the provided authentication mechanism (which "knows" the correct salt value). ● pass = mypassword, salt = ja3gdgj&# ● crypt($1, $pass, $salt) ● $1 == md5, hash(pass + salt) = salted hash ● More info: ● understanding-password-salt

/etc/passwd ● The /etc/passwd contains one entry per line for each user (or user account) of the system. All fields are separated by a colon (:) symbol. Total seven fields as follows. ● To view: cat /etc/passwd ● Permissions: owned by root | -rw-r--r--

Demo (Live) ● Show /etc/passwd

/etc/passwd dissected ● Username: It is used when user logs in. It should be between 1 and 32 characters in length. ● Password: An x character indicates that encrypted password is stored in /etc/shadow file. ● User ID (UID): Each user must be assigned a user ID (UID). UID 0 (zero) is reserved for root and UIDs 1-99 are reserved for other predefined accounts. Further UID are reserved by system for administrative and system accounts/groups.

Further /etc/passwd dissection ● Group ID (GID): The primary group ID (stored in /etc/group file) ● User ID Info: The comment field. It allow you to add extra information about the users such as user's full name, phone number etc. This field use by finger command. ● Home directory: The absolute path to the directory the user will be in when they log in. ● Command/shell: The absolute path of a command or shell (/bin/bash). Typically, this is a shell. Please note that it does not have to be a shell.

Now for the interesting: /etc/shadow ● Hashes are stored in /etc/shadow ● Again, fields are delimited by a colon (:) ● Hashing algorithm ● Password policy info is stored here.

Demo (live) ● Show /etc/shadow

/etc/shadow dissection User name : login name Password: It your encrypted (hashed) password. A blank entry (eg. ::) indicates a password is not required to log in and a * entry (eg. :*:) indicates the account has been disabled. Last password change: Days since Jan 1, 1970 that password was last changed Minimum: The minimum number of days required between password changes i.e. the number of days left before the user is allowed to change his/her password

further /etc/shadow dissection ● Maximum: The maximum number of days the password is valid (after that user is forced to change his/her password) ● Warn : The number of days before password is to expire that user is warned that his/her password must be changed ● Inactive : The number of days after password expires that account is disabled ● Expire : days since Jan 1, 1970 that account is disabled i.e. an absolute date specifying when the login may no longer be used

Pass field scrutiny test:$1$3PZX1Eun$p1jSgKeqSU5Vb3dJyk7WN/:14964:0:99999:7::: ● The $'s are the delimiters in the password field ● The value between the first two $'s is a integer that represents the hashing algorithm(id): $1$ stands for MD5, $2a$ for blowfish, $5$ for SHA-256, $6$ for SHA-512. If the id is absent, DES is used. ● The next string of characters located after the second $ and before the last $ is the salt value. The salt can be up to 16 characters depending on the algorithm. DES uses a two character salt. ● The last set of characters is the password hash. ● In other words the crypt function is: crypt($id, $salt, $pass) ● man 3 crypt

BSD's ● In BSD systems, the password database is /etc/master.passwd

Some Tools ● md5sum, shasum ● crypt() function ● useradd, usermod, userdel ● adduser - easy way, interactive ● passwd - change user password e.g. passwd ● vipw - edit /etc/passwd ● vipw -s -edit /etc/shadow ● vigr - edit /etc/group ● Manual file edits work as well, but is not advised: use vipw, vipw -s for shadow

Attacks ● Two Types: ● Offline Attacks - You have the hash(es) e.g. cracking at home ● Online Attacks - You don't have the hash(es) e.g. password guessing over a network ● Different Techniques: ● Dictionary ● Bruteforce ● Rainbow Tables

Dictionary Attacks ● A dictionary is text file with a bunch of words and/or characters. ● Another term synonymous with dictionary is wordlist. They are used interchangeably and refer to the same thing. ● The words chosen are usually common passwords. ● Once you have a hash, you run a dictionary against the hash by using a program that will generate a hash for each word in the dictionary,and compare the dictionary hashes against the password hash you have. ● If you find a match, chances are it is the password, or much less likely, possibly a collision if a poor algorithm is used. Though, either way, you'll get in because the hashes match.

Bruteforce attacks ● This is similar to the dictionary attacks except that instead of having a list, the program (the bruteforcer) generates every possible combination and hashes them. It could start with a-z, then to A-Z, then to 0-9, for each character position. ● This is by far the slowest technique ● When passwords get longer in size, the brute force possibilities get exponentially bigger with each new bit. A 4 character password would take less than 10 minutes. While a 16 character password can take years and years, even with high-end hardware. ● GPU brute forcing can help speed up the process, but when passwords get too large, it still won't make a difference. ● A good rule of thumb: Don't use passwords less than 12 characters for important accounts.

Rainbow Tables ● A rainbow table is a file that contains pre-computed hashes. ● This concept is stemmed from dictionaries, where you have the words and the program generates the hashes from the words and compares them. ● The problem with this is that your processor not only has to generate the hashes but also compares them. ● A solution to cut the workload in half is rainbow tables. Someone already generated a bunch of hashes from a dictionary. You grab the precomputed hashes. Now all your processor has to do is compare. ● A major disadvantage of rainbow tables is that tables become rather large when you get into long passwords. Good tables can be anywhere from 500 GB - 2TB's.

Demo(live) ● Let's crack some hashes!

Tools ● Offline Tools: ● John the Ripper - ● HashCat & OCL Hashcat - hashcat.net/ ● Cain & Abel - ● Rainbow Crack - ● OphCrack - ophcrack.sourceforge.net/ ● Online Tools: ● THC-Hydra - ● Medusa - ● Ncrack - nmap.org/ncrack/ ● Brutus -

Resources/Wordlists ● ● password-lists ● ●