The Corelan Team did a really good job on these exploit writing tutorials. If you're interested in learning how to write exploits, this is a great place to start.
Part 1: Stack Based Overflows
Part 2: Stack Based Overflows - Jumping to Shellcode
Part 3a: SEH Based Exploits
Part 3b: SEH Based Exploits - Another Example
Part 4: From Exploit to Metasploit - the Basics
Part 5: How Debugger Modules & Plugins Speed Up Exploit Development
Part 6: Bypassing Stack Cookies, SafeSEH, SEHOP, HW DEP and ASLR
Part 7: Unicode - from 0x00410041 to calc
Part 8: Win32 Egg Hunting
Part 9: Introduction to Win32 Shellcoding
Part 10: Chaining DEP with ROP
Part 11: Heap Spraying Demystified
Credits for all the above goes to the Corelan Team.