|
|
Department of Computer
Science and Engineering Dayton, Ohio 45435-0001 |
Abstract: We describe the password systems of Unix and Windows NT. We also describe the cracking procedures. Prerequisites: Cryptography, Authentication
Other Internet Security Lectures by Mateti/etc/passwd example/etc/shadow exampleOn a Linux system (without the Shadow Suite installed), user
information including passwords is stored in the /etc/passwd file.
The password is stored in an encoded format. The algorithm used to
encode the password field is known as a one way hash function. The
computation is easy in the encoding direction, but very time consuming to
calculate in the reverse direction.
Unix crypt() function (not the crypt(1) program) is based on the Data Encryption Standard (DES). It takes the first 8 characters of the password, assembles a 56-bit key from the low 7-bits of each of these 8 characters. Using this key, a block of 64-zero-bits is encrypted into a 64-bit code. This is repeated 25 times. The resulting 64-bit code appended with two zero bits is split into 11 six-bit numbers. Each six-bit number i is stored as a char q[i] from the sequence q == [., /, 0-9, A-Z, a-z] of 64 characters. This computation is perturbed with a randomly generated value called the salt, a two-character string chosen from the q. The salt value is prepended resulting in a sequence of 13 characters.
As an example, the word "hello" was encoded in two different attempts yielding the following two results:
pwsS8k.3HrN8E
BNApDvUheWPoc
Because of the salt, any particular password could be stored in 4096
different ways. The collection of such user data is in the publicly
readable file /etc/passwd. A typical user's entry in a
non-shadowed /etc/passwd file has the following format:
loginName:passwd:UID:GID:fullName:homeDirectory:shell
When a user logs in and supplies a password, the salt is first retrieved from the stored encoded password. Then the user-supplied password is encoded with the salt value, and then compared with the encoded password. If there is a match, then the user is authenticated.
It is computationally difficult (but not impossible) to take a randomly encoded password and recover the original password. However, on any system with more than just a few users, at least some of the passwords will be common words (or simple variations of common words).
Modern Unix systems no longer store the encoded password in the /etc/passwd
file. Instead, it is stored in a file /etc/shadow (on Linux)
which is not world-readable.
Here are examples of these files: /etc/passwd
and /etc/shadow.
Microsoft practices to an extent "security via obscurity," and hence the following information (summarized from discussions on L0phtCrack) may be inaccurate.
NT/2000/XP stores user information including encrypted passwords in the
file WINDOWS\system32\config\sam in an
undocumented binary format.
A Windows password is split into two seven-character halves, so effectively, the password is never harder to crack than a seven-character password. Another weakness is that no 'salt' value is used to encrypt each users' password a little differently. NT machine effectively stores two passwords - the NT password, encrypted with the RC4 DES algorithm, and a weaker one, know as an LN, or LANMAN, that can be optionally disabled by a system administrator. The latter passwords are needed for legacy support to interoperate with Windows 95 and 98. Although Microsoft uses DES encryption, the system only scrambles the passwords with the algorithm once, compared to Unix systems, which run 24 iterations of DES on password files to stop brute-force crypto attacks and to slow down dictionary attacks. Encrypted Windows NT password files are readable for the administrator.
Using Linux LiveCD systems, chntpw and bkhive can
recover Windows passwords.
There are many practical tools that crack passwords of both Linux and Windows. Just search the web with words like "password recovery".
Social engineering is a "term used among crackers and samurai for cracking techniques that rely on weaknesses in wetware rather than software; the aim is to trick people into revealing passwords or other information that compromises a target system's security. Classic scams include phoning up a mark who has the required information and posing as a field service tech or a fellow employee with an urgent access problem. See also the tiger team story in the patch entry, and rubber-hose cryptanalysis." [The New Hacker's Dictionary, http://www.catb.org/jargon/html/index.html ]
Most system administrators generate, for their users, initial passwords that are hard to remember. Soon after the login, users change their passwords to something they prefer. These range from names and birth dates of spouses, friends, relatives and friends to whatever. An attacker who "stalks" a user often does a little bit of snooping around to discover these.
1997.01.02, PA News: A recent survey by Compaq in the financial district of London showed that poor choices are the norm for computer passwords there. A staggering 82% of the respondents said they used, in order of preference, ``a sexual position or abusive name for the boss" (30%), their partner's name or nickname (16%), the name of their favorite holiday destination (15%), sports team or player (13%), and whatever they saw first on their desk (8%).
Most users have the same password for their accounts on different systems. An attacker who broke into one account usually discovers these other accounts by going through the memoranda that the user keeps in his files as well as by running keystroke loggers or simple sniffers.
System crackers often encrypt a dictionary of words and common passwords
using all possible 4096 salt values. Then they will compare the encoded
passwords in your /etc/passwd file with their database. Once they
have found a match, they have the password for another account. This is one of
the most common methods for gaining or expanding unauthorized access to a
system. Good machine-readable collections of dictionaries are essential for
cracking.
An 8 character password encodes to one of 4096 * 13 character strings. So, a dictionary of say 2,000,000 common words, names, passwords, and simple variations would easily fit on a 20GB hard drive. The attacker need only sort them, and then check for matches. A 500 GB hard disk now (May 2008) sells for under $100.
Also, if crackers obtain your /etc/passwd and /etc/shadow files first, they only
need to encode the dictionary with the salt values actually
contained in your /etc/passwd /etc/shadow files.
Don't Use the following for passwords: Your first name. Your last name. Your login name. Your pet's name. Any name at all. SS number. House number. Telephone number. Your bank PIN. Any password shorter than six characters.
Do Use passwords of six characters or more. Use a combination of letters, numbers, and special characters.
Because of the "human issues" (referred to above as wetware) involved, a password that can be used only once is becoming the de facto choice. This OTP is generated from a user's secret pass-phrase that the user remembers or holds in a credit-card size "device", and a number that is randomly generated. OTP provides protection from eavesdropping, and dictionary attacks. OTP evolved from the S/KEY, and many current packages are still named after "skey". See [RFP 2289] for full technical details of OTP.
S/Key is a one-time password scheme based on one-way hash functions, described in Cryptography. It is based on a memorized secret password and does not require a special device. It can be fully or partially automated for authentication from a trusted system. It uses no secret algorithms and no secrets are stored on host.
There are four programs involved in the S/Key system. (Note that the names of the programs may have been changed by different packages.)
skey uses three inputs to generate a
one-time password. These are: (1) a ``secret pass phrase'',
(2) the ``seed'' (which is sometimes, confusingly, called a ``key'')
consisting of two letters and five digits, and (3) the ``iteration
count'', a number between 1 and 100.keyinit' program is used to initialize S/Key, and to
change passwords, iteration counts, or seeds; it takes either a secret
password, or an iteration count, seed, and one-time password.keyinfo' program examines the /etc/skeykeys
file and prints out the invoking user's current iteration count and seed.login' and `su' programs contain the
necessary logic to accept S/Key one-time passwords for authentication. The `login'
program is also capable of disallowing the use of UNIX passwords on
connections coming from specified addresses.Here is how one uses the S/key.
All work should be carried out in Operating Systems and Internet Security (OSIS) Lab, 429 Russ. No other WSU facilities are allowed.
Objectives: (1) To help you gauge the level of security offered by the
typical password systems. (2) To familiarize you to the various "security
sites." (3) To familiarize you with standard "program building" features such as
configure and make.
/etc/passwd and
/etc/shadow files which are taken from
our OSIS Lab accounts from a previous term. This work was supported in part by NSF DUE-9951380.
| Copyright © 2006 pmateti@wright.edu | Thursday, May 08, 2008 |