In this section, we will see how to make a Metasploit exploit module to exploit a given vulnerability. In this case, we will focus on a buffer overflow vulnerability of a gaming application called Crossfire. For us to write custom Metasploit modules, we need to place them in a specific directory, because when we use the use exploit /.... command in Metasploit, by default, the framework looks for the available modules in the default Metasploit exploits directory. If it doesn't find the given exploit there, it then searches the extended modules directory, which is located at the following path: /root/msf4/modules/exploits. Let's create the path and a custom directory. We'll turn our Kali VM on and run the following commands:
mkdir -p ~/.msf4/modules/exploits/custom/cf
cd ~/.msf4/modules/exploits/custom/cf
touch...