8/08/2006

Are you safe? Are you sure?

Most likely you have a lock on the door of your house, probably more than one. Even so, valuables in the house are stored behind more locks. And I bet that you have at least one box with a lock inside a cabinet with a lock.
This is basic safety. The things that have value for us are stored in safe places. With locks that require keys. And a key is basically a password. It has a sequence of values, the indentations, in a particular order and if they match the lock all the levers will align and the barrel will turn free.
The passwords are the keys to our virtual safe boxes, mail, bank account, blog, etc. And the reason why we use locks for them is that there we store our virtual valuables.
The first problem we have with it is that virtual stuff doesn't seem to be too valuable. If your first experience with a password on Internet was your personal mail account, the password was more an annoyance than a safety. Besides playing you a prank, there wasn't much more value in hacking it.
But when the banks started to offer services through the Internet, things changed. Now the virtual safe has real valuables inside. And not only banks. There's a lot of services with real value that merit a good lock and key to protect them.
Others are not worth a good lock like subscriptions to newsletters, forums, media sites.
But what about our email accounts?
Somehow our personal mail accounts are being left behind in the security department. It's like the old idea of them being worthless stuck in our minds. In a way it's true because the chain letters, the endless forwarding of stupid jokes and hoaxes or the PowerPoint presentations with puppies are as worthless now as they were 10 years ago.
But now that the Internet is full of services with real value that can be measured in terms of cash, our mail accounts turned up to be the sum of all those values. Our mail accounts are the entrance door to all those services. Think about it, any one of them will graciously send your password or a newly generated one to that mail account at your (or anyone else's) request. Your mail account is your key, your ID, your safe box on the virtual world of the Internet.
You probably feel safe about it, you have a password, nobody can enter your mailbox without it. So, the rule number one is never ever tell your password to anyone. Have you? Are you sure?
Believe it or not, the number one method used to get a password is the most simple one, ask for it. Yes, that's right, exactly as you've read it, the best way to get a password is to ask for it. Of course you won't do such a stupid thing, if I ask you to comment on this article with your user name and password you wouldn't do it, would you? What if I ask you nicely? What if I ask you in a different way? What if I change the tone of my voice? What if I rephrase the question?
But you know better than that. You never fell for it, did you? Are you sure?

Everyday thousand of messages ask users to click and login on a web page and some do. I've been talking about this phishing thing in previous articles. You may say that the ones who fell for it were not the smartest in the pack and I think you're right. But are you sure that each and every page you've logged in was the right one? Did you checked every single one? Are you able to tell the difference?
The typical phishing is pretty rough. For starters, it's a business of volume, it doesn't work unless you send several thousands of messages. A lot of them will reach people that haven't an account, they'll be able to tell that something is wrong. For those that have an account, the message looks like any other message they get from that service. Maybe there's a detail or two, like in the case of Paypal. They allways use your first name on every message. The phisher can't do that because he doesn't have that information. This things are explained on Paypal's web page, that part that people don't read. And those who did read it, most likely forget it all by the time they get that message. The only real difference between the fake thing and the real thing is in the source code of the message. Do you check it? Are you able to understand it?
This messages are to direct most of the time. For a paranoid like me, the feeling of being pushed into doing something triggers all my alarms at the same time. Someone asking me to login or else... But let's say that you get one message from the auction site with a showcase of products, all of them with links to their pages. Doesn't seem dangerous, is not talking about logging in, no problems with your account. You click and the auction page shows up, it looks fine, just like the one you know so well. Once you settle down, feel comfortable, the login page appears. It has to be the real one, you were on the site already. Or weren't you?
And this is just one possible scenario. As you can see, it takes someone with knowledge and skills to tell if the message is real. You know about phishing because is everywhere, everyone is talking about it, it's on the news, you're reading about it right here. So you'll suspect any message asking for your password, asking you to login. But sometime it'll change, the attempts won't ask you for your password directly, they'll be more subtle. Are you prepared for it? Are you sure?

Once passed the message, you have to face the web page. Most phishing attempts are pretty rough in this part. If you check the navigation bar is evident that you're not on the right place. It could be an IP number or the name of a cigarette fabric in China. Whatever it is, it's not the address of the site you're trying to get into. But how many times do you check it? Do you at all?
Most of the time we type the name of the site we want to go to or take it from our bookmarks. We can tell that we're going to the right place, we typed the address ourselves. And you know better than clicking on a link offered by an email message. But what about web pages?
This is one of the most popular activities on the Internet, clicking. We go from page to page because it's there, it's easy, it's convenient, it's fun. And it doesn't matter if you're just reading the news. But if at some point you're offered a link to a site where you have an account, one with real value, and you log in there, do you check if you're in the right site?
One of the most dangerous sites today, in my opinion, are the auction sites. The links to their products are everywhere. Even worse, they pay webmasters to have pages with selections of products linking to the auction pages. It's a nice trick and I'd like to rant for a week about it. By having those pages, the auction sites multiply their chances of being listed on top of the search engines. Let's say that they have an auction of a consumer product that's very popular, this one would show once on the search engine. But if there are many pages with that product and a link to the auction page on many different web sites, it would show up once for every site. And if they have many auctions of that product, multiply that number for the number of sites linking to it. And my problem with it is that if I want to get information about that product I can't find it, the search list is full of auction pages and pages linking to the same auction pages. Try any popular consumer product and you'll see.
But this is topic for another article, the point here is that those pages with selections of products from the auction sites are everywhere, are known and accepted by the common user. So, if you find what you're looking for and you want to comment, ask or offer you'll click the link and login. It's natural, we're used to do this all the time. We click on a couple pages, we end up on the auction page, who's paranoid enough to go and check the navigation bar?
Doing a web page resebling a real auction is not really hard, in fact you don't have to actually do it. The phisers don't DO the login page resembling the real one, they just copy it and modifiy it to suit their needs. And it doesn't have to be an auction site, it could be anything. The traps can be set anywhere and take you anywhere else. I mentioned how a links can be disguised on a message, the same technique can be used on a web page. Take a look at this silly example, click on the link, visit Altavista and come back here. Yes, I know. It's not Altavista. If you put you mouse over the link, and your browser status bar is active, you'll see the real link down there, you'll see that it doesn't match the name I offered you. The point is nobody (or almost nobody) checks the status bar before clicking or the navigation bar after.

So the navigation bar is important and should be checked if you're logging in. But it's not all. There are a couple tricks to keep you from seeing where you are. One of them is to offer you the login page on a pop up window without the navigation bar. The other is to use a bogus icon image, those little icons that show up on the left side of the navigation bar. One of those totally useless niceties, for us the users, that turn up to be totally usefull for the phishers. The image is supossed to have a fixed size and square shape. But if you create one that's wide enough to cover the URL field of the navigation bar, now the real address is hidden and what you see is the address of the real site that was drawn on that image. Sometimes the font or the font size don't match those of your browser or the alignment is a couple pixels off center. But you have to be a careful observer to note such detail. This trick had its peak last year and I've never saw it again. I guess the new browsers have it fixed... I hope.
And the state of the art in deceiving you into going to the wrong site is to intercept your name resolution. In a previous article I explained name resolution in relation to a phishing operation. The name you type on the address field is resolved into an IP number because that's the information the net requires to find the site. Your name resolution is being done by a complex system of distributed servers. If I can hack your server and add a record for Yahoo with the IP of one of my servers, you'll connect to it every time you try for Yahoo and your navigation bar will show Yahoo every time. These servers are not very vulnerable but it may happen. In fact there was a case when the root servers were hacked, the records changed on the root servers were propagated to almost all the DNS servers around the world. The event triggered alarms everywhere, and was detected and fixed in a short time. But it proved the potential of a DNS attack. It can alter the name resolution for the whole world by attacking the root servers, only for a group of computers by attacking its DNS servers or only one computer by feeding it the wrong name information.
If you want to try and see how it works, you can do it in your own computer. There's an alternative method to resolve names in your own computer. In fact it's in the chain of resolution and it's top priority. But its lists is empty by default and it's rarely used. There's a file in your system called HOSTS, in the directory %SYSTEM%\Drivers\Etc if you're using Windows and somewhere around /etc/sysconfig if you're using Linux. This file can resolve names for you, all you have to do is put the IP number and name separated by a tab or space, one row per domain name. Try adding this line "208.45.133.23 altavista.com" (without the quotes), and see how Altavista turns into Excite. It may need a restart of your browser if you have the address of Altavista already resolved. To avoid unnecesary traffic, your system checks if the name you're asking for was accessed recently and uses the IP number it has in memory. Remember to delete that line or you won't be able to access Altavista again. This won't work if you're using a proxy server because the server will resolve the name for you.
This is not a common method of phishing or hacking. If someone has the access and the privileges to modify that file, there's a lot of ways to get your passwords and credit information from files stored in your computer. If it happens to you, it's more likely a "crime of passion". Someone close to you doesn't like you or is playing you a prank. It's not a common office prank because in most of them the use of a proxy is mandatory.

If I didn't push you enough into paranoia yet, brace yourself for the next part. Let's say that you were careful enough not to log into a page other than the one you intended to. There's a good chance you didn't actually. Despite the high number of phishing attempts, the number of people falling for them is very small in comparison. And what I'm about to describe hasn't been used as a massive phishing operation, I don't think it will be in the future either. But it's a vulnerability that may expose you to a random act of hacking or, even worse, a targeted one.
As part of your Internet experience you take part of different activities that may require a login. Even some that don't really merit one. Imagine that you join a forum, you're requested to register, you're asked for your mail address to send you a verification code, some personal data and a password. Are you using the same password for all your services? Some of you are thinking that this is a stupid question and that's something not worth mentioning. But you're wrong, is unbelievable the number of people that can't handle more than a couple paswords if they're using more than one at all. If you're one of them, think about this. You´ve registered into a site where people unkown to you have your mail address and your password. You may think that they don't know it's the same password you use for your mail account. Let me tell you, I'm not a professional hacker and that would be my first guess. I tried that with a lot of people I know (with their consent) and my success ratio has been over 50%. And if your mail address is exposed, what else do you have in there? Auction site, Paypal, your bank?
I'm not saying that there's a forum out there hacking into mail accounts. As a plan is pretty lousy. A forum takes time to build up a group of members and not many have a number of members that can be compared with the number that can be reached with a mail phishing. Even with the higher ratio of success that can be achieved. Besides, it's a one shot operation. People will find out the common link of all the haking events very quickly. Mostly in a forum where people talk about things like this.
The problem is not the forum and their administrators, the problem is how good the security of the forum is. I think I mentioned in a previous article that many phishing pages are being set in forums. The phisher are abusing vulnerabilities well known of the most popular forum scripts. And we're talking about maybe two PHP scripts, maybe not even two. Once you find out a vulnerability that suits your needs, all you have to do is find servers running that script with the version you know is vulnerable or one older than that. You wouldn't believe how easy is to do that, just Google for it. Ask for that script and the version number and Google will put in your desk a list of those servers.
And this is because forum administrators have that information available on their pages. They have to, is the right thing to do if they use the scripts. The scripts are very good, that's why they're popular, and the administrators who chose them for their forums have to give credit to whom deserves it. It's not their fault.
And if it's not the script, is a vulnerability on the web server or the operating system itself. The point is that the user database in that forum has a 50% of the keys to you valuables and that you have no way to know how safe it is. And it doesn't matter if they say that your password can't be read because it's encrypted, I'll show you in a minute that this is only half the truth.
I know that having more than one password is a pain in the rear but there's no other way to go. As you can see, once someone can put your mail address and a password together your whole security fortress starts to fall brick by brick.
Even if you're not using the same password for your mail account and the forum, how safe is your password?

The second most effective way to break into someone's account is by password guessing. There are compiled lists of the most popular passwords, some general and some for particular groups. By language of course but also by etnicity, religious beliefs, etc. Those lists are not capricious, they were compiled from real databases of passwords since the beginning of the computer era. Nowadays, most servers have their own list of "popular" passwords and ban them to prevent guessing attempts. Among the top of the list are words like Jesus, God, curse words and, believe it or not, password. Those can be prevented by the server or the user itself, but there's another list that you must take into account, your own list. Your profile in the forum has your name, your birthday, your zip code, your address, your phone number, your city, your country and some other personal details. Which one are you using as password? I hope none, because this is the list that's being used to guess your password and the success rate is amazing. And if you're typing then backwards, forget it, it's on the book too. Your profile is available to the general public in some places and in other only to registered users. Whoever is on the look for your password can register as quick and easy as you just did. But he won't be using his real information.
Password guessing has many advantages for the perpetrator. It can be done from the outside, there are many ways to do it without leaving traces, most of the servers don't ban connections based on the number of failed attempts, it's easy to setup a procedure to do it automatically. And it's effective. Try to play the guessing game with family and friends, you'll see that the youngest, who don't have much value on the Internet, have strong passwords while the oldest, who have money and valuable services, have the weakest.

And this is something that can be done to break into your account without actually breaking into the server. If your password is weak and the perpetrator is lucky, the server won't be able to tell your login from his. The only difference would be that he may need more attempts than you do.
But having access to the server, allows the perpetrator to gain access to many passwords all together. He just copy the users file and do the work at home with time. If the server is simple, with lousy security, the users file probably is a plain text file and no more work is needed, the password is right there in the open. If the password is encrypted, it will take some time but it's possible to get the password or something as good as the password.
Password are not really encrypted, because the value stored can't be decrypted. The method used is to apply a mathematical function to the password and store the result. The function is such that it has to give the same value for the same password and can't be reversed. One example could be the sum of the digits of the password. Let's say that your password is 1234, the sum of the digits is 10 so the number 10 is stored. There's no way to rebuild the password from this piece of information. When you reenter your password and, applying the same function, it matchs the value stored, then the server can say that you entered the right password.
This functions are called hash functions and are a lot more complicated than the example. A good hash algorithm should generate big differences with minimal changes, have an image domain of respectable magnitude and generate the less amount of collisions.
The first condition is to avoid password guessing by proximity. Two very similar passwords very similar have to turn up in two very different hash values. You'll see why in a minute.
The size of the image domain prevents massive guessing. A small image domain means that the number of possible results of the hash function is limited. Imagine a hash using the last digit of the sum of the digits of the password. There are only ten possible results, all I need to access any account is a list of ten passwords that give the ten possible hash values. The ideal hash function would be one with an infinite image domain. But even one with a relatively limited space is almost as good in practice. A 10 hexadecimal digits hash space has more than one million of millions of different hash values, and I can't write the number for one with 1024 digits. It's a one followed by 1,233 zeros.
Being the hash function a one way function, is possible to have the same hash for two different passwords. If the image domain is smaller than the space of possible passwords, it will happen for sure. Because the number of passwords is greater than the number of posible results. The system would let someone login to your account with a password completely different from yours. However, finding that particular password is as much difficult as finding yours.

This system of not storing password but hash values is efficient and practical. It's not bullet proof safe though. If someone gets the users file and knows the hash function used in that server, there's a method to get either the real password or something good enough to access the account. It's called the dictionary method.
To do that, a database is created calculating the hash values of all the words in a dictionary. It's a big database but something that a regular computer can handle. This databse is used to cross check every hash in the users file. If there's a match, the word associated to that hash is a valid password for that account. It could be the real password or not but, either way, it will work.
The hashes that don't match a value on the database can't be guessed by proximity, if the hash function complies with the first condition.

Enough with the bad news, let's talk about the good ones. Things that you can do to improve your paswords.

Pick strong passwords. Not one word passwords, not only numbers, nothing on your profile, not your name or your address, make them long, change them frequently, and I can keep going on and on forever. These are the recomendation of the experts and I totally agree, but it doesn't help much. Add to that the need to have more than one.
The problem is that if they're easy to remember they're easy to guess and if they're hard to guess they're hard to remember. And you shouldn't have them written in stickies around your monitor. So, the best solution is to have a method you can remember. Some kind of password generator algorithm that can make them with a variety of numbers and letters and lenghts but, basically, a method that you can remember. I'll give you an example, not the one I use. The rules are:

- Put the name of the service, the user and the current month together
- Replace all a's for 4's and the i's for 1's
- Capitalize the letters on even positions unless they were converted to numbers

The password for username in Paypal this month would be p4yP4LuSeRn4mE4UgUsT and for the same name in Gmail would be gM41lUsErN4Me4uGuSt.
Including the month allows you to change your password monthly without the hassle to go through memorizing it again. The passwords will repeat in a year, unless you throw the year in the mix, but that will be way beyond the ban imposed for most systems. Including the name of the server or any word related to it (auction, mail, bank, etc) allows you to have as many passwords as needed and you don't have to memorize them all, just the set of rules. The last rule seems simple but it's not actually, it's hard to keep count of the positions when you can't see what you're typing. But that's the beauty of this, you can set any rule you like. Capitalize the last letter, or the first or the one in position X. You can change any pair of letters and or numbers. I pick pairs that have some relation, 4 looks like an A, 1 looks like an I. And there's a lot of pairs to use, O and 0, B and 8, S and 5, G and 6. You can change letters for the next in the alphabet or the previous. Try adding a word that only you know, or only a few around you. Like the name of a pet from your childhood, the name of your secret lover, a word from a song that makes you cry when you hear it. This way, even if you write down your rules and leave them on a sticky under your monitor, there's always a piece missing.
Be creative but not too much or you'll end up with a set of rules impossible to remember.
And try to keep your mail address private, don't spread it around like the plague. Get a disposable mail account for subscribing unsafe places, media web sites, game sites, anything that asks you for a mail account and has no value. And don't link your safe and unsafe mail accounts. If they get to your unsafe one, the safe one is just one step away.

It's great to have the chance of having valuable services on the net, but I'm too paranoid for that. I like to go to the bank and show my ID.

No comments: