There isn't really a book you can pick up and read. You need to actually be involved in the target you're planning on exploiting. If you're after software, you'd want to learn a programming language suitable (C/C#/C++, etc). As far as websites, you'd want to learn a heavy amount of PHP/MySQL and Perl. You'd need to get to know the security measures so you'll know how to search for them and exploit the weaker ones.
It's not something you just learn, it's something that just...comes to you throughout your career in computers.
EDIT: Despite the legality of the topic, I must request that the mods at least consider leaving this thread open. I feel a lot of questions can be answered, and it's not as if he's going to come back tomorrow knowing how to crack because of this thread. It's harmless discussion.