Clear-text Passwords In Web Sites


Paw Prints: Writings of the maddog

Apr 05, 2010 GMT
Jon maddog Hall


Recently I had forgotten what password I had used for a web site, and I politely asked them to reset the password so I could log in and change it. Instead the site sent me my old password, in clear-text through email.


After I got over the shock of seeing the current password in my email I went onto the site and changed the password to a not-very-flattering noun which had something to do with a combination of excrement and the flabby pieces of nerve endings in the website manager's collective craniums. Then I proceeded to make sure there was nothing on that site of any value. I did consider just deleting the account, but I was curious as to how this site operated and how it would play out.


Interestingly enough, this site sends out a “reminder” email every month, and puts the user's password in that email as clear-text. I guess their clientèle forgets their passwords a lot, but I am about to tell the web-master (in polite terms) that this is an unsafe practice.


I was astonished that anyone would store a password as clear-text, and even more astonished that someone would send that password through email.


Unix, of course, has had encrypted passwords for a very long time. More than just encrypting the password, part of the encrypted password is thrown away, so you can not de-encrypt the stored string to discover the password. Each time a person logs in, the encryption algorithm is applied, the encrypted string is truncated to the same length as the stored string and the two strings are compared to see if they are equal. If they are, the user is given access to the system.


The password file in Unix and Linux was (and still is) readable by anyone, and storing the encrypted password in the /etc/passwd file allowed someone to try and break the password by “brute force”, usually by encrypting all the words in the dictionary plus some key phrases and then comparing those encrypted words with the encrypted passwords in the password file. People who make their passwords a single word, or their birthday, or a common name are vulnerable. It would have been better to make the file /etc/passwd only readable by “root”, but by the time that realization occurred it was too late. Too many programs were reading the /etc/password file directly, and taking away the ability to access the passwd file completely would break those programs.


After a while the password field was moved to a “shadow” password file, the shadow only readable by “root”, and all of the other fields in /etc/passwd stayed the same with the exception of the /etc/passwd file having an “x” in the place of the encrypted string. Since the programs that looked at the passwd file typically did nothing with the encrypted password itself, most programs that used the passwd file did not notice that the contents of the password field was simply changed to an “x”.


There is nothing which stops a web site from using the same type of technologies and ideas for maintaining their own password mechanisms, yet we continue to hear about sites that are compromised and thousands of passwords are stolen, leading to identity theft.


I know I am preaching to the choir, but if one webmaster who participates in a site that stores clear-text passwords sees this and stops the practice, it will be worthwhile.


Carpe Diem!


  • clear text passwds

    thanks Jon;

    I too have had this occur to myself.
comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More