Of course hacking per se is not illegal; the actual offense is something like gaining unauthorized access to a computer. If its not your account, and you keep guessing the password or reset questions till you get in, clearly thats unauthorized access.