Shadow password

From Wikipedia, the free encyclopedia

Jump to: navigation, search

In computing, Unix-like operating systems use the shadow password database mechanism to increase the security level of passwords by preventing ordinary users from accessing encrypted password data.

Contents

[edit] Unshadowed passwords

On a system without shadowed passwords (typically very old Unix machines), the passwd database holds the following user information:

The passwd file is readable by all users in order to allow name service switch to work (eg, to ensure that user names are shown when the users lists the contents of a folder), but only root can write to it. This means that an attacker with access to the system at normal privilege level can obtain the hashed form of every user's password. These can then be used to mount a brute force attack offline, using the hashed passwords as a relatively fast way to test guessed passwords without alerting system security modules designed to detect an abnormal number of failed login attempts. Most users select passwords that are vulnerable to such password cracking techniques.[1]

[edit] Shadowed passwords

Systems administrators can reduce brute force attacks by making the hashed password unreadable by unprivileged users, and the obvious way to do this is to make the passwd database itself readable only by the root user. However, this would also restrict access to other data in the file such as username-to-userid mappings, which would break many functions on the system. Thus the idea of a "shadow" password file was conceived, where the passwd file remains world-readable but users' hashed passwords are moved to a separate database - for local files, usually /etc/shadow on Linux and Unix systems or /etc/master.passwd on BSD systems—which can be read only by root. (Root access to the data is considered acceptable since on systems with the traditional "all-powerful root" security model, the root user would be able to obtain this information by other means.) Virtually all modern Unix-like operating systems use shadowed passwords.

With shadowed passwords in use, the /etc/passwd file shows a character such as '*', or 'x' instead of the hashed password, and /etc/shadow holds the following user information:

  • User login name
  • salt and hashed password
  • Days since epoch of last password change
  • Days until change allowed
  • Days before change required
  • Days warning for expiration
  • Days before account inactive
  • Days since Epoch when account expires
  • Reserved

While the most important information in the shadow file consists of the hashed password, the file usually contains other fields as well, such as the last time the password was changed, when the password will expire, and whether the account is disabled. The format of the shadow file is simple and is basically identical to that of the password file: one line per user, ordered fields on each line, and fields separated by colons. Many systems specify that the order of user lines in the shadow file should be identical to the order of the corresponding users in the password file.

To modify the contents of the shadow file, users generally invoke the passwd program, which in turn is largely depending on PAM. For example, the type of hash used is dictated by the configuration of the pam_unix.so module. By default the MD5 hash is used, while the newer pam_unix2.so module is also capable of stronger hashes such as blowfish.

Note that the shadow password file does not entirely solve the problem of access to hashed passwords, as some network authentication schemes operate by transmitting the encrypted password over the network, making it vulnerable to interception. Alternate copies of system data, such as system backups written to tape or optical media, can also become a means for illicitly obtaining hashed passwords. In addition, the functions used by legitimate password-checking programs need to be written in such a way that malicious programs cannot make large numbers of authentication checks at high rates of speed.

[edit] History

Password shadowing first appeared in UNIX systems with the development of System V Release 3.2 in 1988 and BSD4.3 Reno in 1990. Vendors which had performed ports from earlier UNIX releases did not include the new password shadowing features, leaving users of those systems exposed to password file attacks.

In 1987 the author of the original Shadow Password Suite, Julie Haugh, experienced a computer break-in and wrote the initial release of the Shadow Suite containing just the login, passwd and su commands. The original release, written for the SCO Xenix operating system, quickly got ported to other platforms. The Shadow Suite was ported to Linux in 1992 one year later from Linux announcement and became a part of many early distributions.

System administrators may also arrange for the storage of passwords in distributed databases such as NIS and LDAP, rather than in plaintext files on each system. In the case of NIS, the shadow password mechanism is often still used on the NIS servers; in other distributed mechanisms the problem of access to the various user authentication components is handled by the security mechanisms of the underlying data repository.

[edit] See also

[edit] External links

  • authconfig, a command-line tool for controlling the use of shadow passwords

[edit] References

  1. ^ Rob Lemos (2002-05-22). "Passwords: the weakest link?". CNET News.com. http://www.news.com/2009-1001-916719.html. Retrieved on 2008-02-19. 
Personal tools