ab1316ac10
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. |
||
---|---|---|
.. | ||
README.md | ||
Reflective DLL.zip | ||
dllmain.c | ||
rdll_template.sln | ||
rdll_template.vcxproj |
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:
- Select "Create a new project"
- Select "Reflective DLL" from the list of project templates
- 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:
- Right click the project (usually the only child node of the tree) in the Solution Explorer and select "Properties".
- Navigate to
Configuration Properties > Build Events > Post-Build Event
. - 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:
- Open the
rdll_template.sln
file in Visual Studio - Make the desired changes
- Go to
Project > Export Template...
and follow the wizard steps - Replace the zip file in this directory with the newly exported template