The following are tutorials on how to write shellcode for beginners through to advanced. These tutorials are continually being expanded so make sure to check back to stay up to date with the latest tutorials.
Shellcode Tutorial 1: Introduction and Tools Setup
Gives an intro into shellcode and steps you through setting up your environment.
Shellcode Tutorial 2: My First Simple Shellcode
Steps you through creating and testing very simple shellcode.
Shellcode Tutorial 3: Windows Command Execution Shellcode
Define and locate a string constant, and use it to create a new administrative Windows user.
Shellcode Tutorial 4: Message Box Shellcode
Teaches you how to load libraries, call simple functions, and execute them.
Shellcode Tutorial 5: Function Hash Generation
Defining and using constants, more complex functions, generating function hashes, and an introduction to OllyDbg!
Shellcode Tutorial 6: Dynamic Shellcode
Dynamically locate Kernel32 and function addresses. No more hardcoded addreses!
Shellcode Tutorial 7: Introduction to Sockets - Portbind Shellcode
Dynamic shellcode that loads ws2_32.dll and creates a listening port that provides a command shell to remote users.
Shellcode Tutorial 8: Introduction to Networking - Connectback Shellcode
Dynamic shellcode that initializes a connection back to the attacker and connects them to a command shell on the compromised system.
Shellcode Tutorial 9: Generating Shellcode Using Metasploit
Use the Metasploit Exploit Framework web interface and msfpayload command to generate various shellcode for different platforms in a range of formats.