Depends how you do it and what you do to their accounts. For example, last year in my dorm whenever friends came over and left their facebooks logged in, other people would go in and post random crap on their walls and change their statuses and things like that. Programs like Firefox can be set to remember all logins, so that's a good way to get people's passwords and such. This method is not illegal. Actually hacking into their accounts from the outside would be both quite difficult and definitely illegal. I'm not familiar with facebook, nor with many hacking techniques, but I do know many hacks use brute force attacks, which requires hundreds of PCs that have been infected with your Trojans (the most obvious tactic is simple denial of service attacks, which involves hundreds and sometimes thousands of PCs constantly spamming a website in order to shut it down from bandwidth overload--a tactic not likely to work on something like facebook). Why did I just tell you that? So you know that directly hacking their accounts takes a lot of other crimes in order to make work. Short of aquiring their passwords through some scheme (which in itself is a grey area), there's not much you can do, except somehow work out a way to be very clever and get them back.