metasploit-framework/external/source/rdll_template
Grant Willcox ab1316ac10
Update README.md with some minor additional notes
Add in a minor additional note about needing to potentially create one of the directories in case people run into errors as I encountered this during some recent testing.
2021-11-04 12:02:56 -05:00
..
README.md Update README.md with some minor additional notes 2021-11-04 12:02:56 -05:00
Reflective DLL.zip Remove the RDLL header template file 2020-05-08 09:32:35 -04:00
dllmain.c Remove the RDLL header template file 2020-05-08 09:32:35 -04:00
rdll_template.sln Create the structure for the RDLL Visual Studio structure 2020-05-07 12:20:52 -04:00
rdll_template.vcxproj Create the structure for the RDLL Visual Studio structure 2020-05-07 12:20:52 -04:00

README.md

Reflective DLL Project Template

This is a project template for Microsoft Visual Studio to aid in the creation of Reflective DLLs based tools and exploits for the Metasploit Framework.

Installation

To install the template, copy the template zip file to the Visual Studio ProjectTemplates directory. The template zip file does not need to be decompressed or extracted. For a default Visual Studio 2019 installation the installation command would be:

copy "Reflective DLL.zip" "%USERPROFILE%\Documents\Visual Studio 2019\Templates\ProjectTemplates"

Note that you may need to create the ProjectTemplates directory if it does not already exist, which may be the case on a default install.

After the template has been copied, restart Visual Studio then:

  1. Select "Create a new project"
  2. Select "Reflective DLL" from the list of project templates
  3. Name the project and set the location within the Metasploit Framework git working tree
    • For an exploit, this would likely be "CVE-20##-####" for the Project name and "external/source/exploits" for the Location.
    • For a general tool, this would likely be "external/source" for the Location.

Ensure that the ReflectiveDLLInjection submodule has been cloned and is up to date with: git submodule init; git submodule update. This step only needs to be done once to populate the necessary files for the build process.

Example Output
$ git submodule init
Submodule 'external/source/ReflectiveDLLInjection' (https://github.com/rapid7/ReflectiveDLLInjection.git) registered for path 'external/source/ReflectiveDLLInjection'
$ git submodule update
Cloning into '/metasploit-framework/external/source/ReflectiveDLLInjection'...
Submodule path 'external/source/ReflectiveDLLInjection': checked out '88e8e5f109793f09b35cb17a621f33647d644103'

Build File Placement

It's important that the built binaries be placed in the data directory for use by the framework. To copy the built binaries automatically:

  1. Right click the project (usually the only child node of the tree) in the Solution Explorer and select "Properties".
  2. Navigate to Configuration Properties > Build Events > Post-Build Event.
  3. Set the "Command Line" value to a command that will copy the built binaries to a suitable subdirectory of data.
Command Line Example (Exploit)

Exploits are stored in subdirectories of external/source/exploits meaning they need to traverse up four directories and copy their binaries to data/exploits.

IF EXIST "..\..\..\..\data\exploits\$(ProjectName)\" GOTO COPY
    mkdir "..\..\..\..\data\exploits\$(ProjectName)\"
:COPY
copy /y "$(TargetDir)$(TargetFileName)" "..\..\..\..\data\exploits\$(ProjectName)\"

Template Updates

To update the template itself:

  1. Open the rdll_template.sln file in Visual Studio
  2. Make the desired changes
  3. Go to Project > Export Template... and follow the wizard steps
  4. Replace the zip file in this directory with the newly exported template