If they get access to your computer then they can get your passwords. One way this can happen if you go to a bank website and type in your information; they could be recording everything you are doing. Now they have all that account information.
How to avoid it
One way you can prevent this is by not opening anything that you don't know. If you don't know the person who sent the email don't open it. You could also get a fire wall to protect you from these types of viruses. Another thing that can protect you is common sense; if something dose not look right don't open it. One more is you can buy an anti virus software.