Checkout these articles. I found them helpful for starting to understand the process of discovering and writing exploits.
http://packetstormsecurity.org/files/author/7595/
There are also a ton of other resources on the internet that can help with this subject. There are also a ton of threads on this forum that could help point you in the right direction if you take the time to do some searching.



