Overview
Rubeus is designed to be compiled from source rather than distributed as pre-built binaries. This approach helps avoid signature-based detection and allows for customization based on specific operational requirements.Pre-compiled binaries are intentionally not provided to reduce signature-based detection and encourage understanding of the tool’s functionality.
Prerequisites
Development Environment
Development Environment
Required Software:
- Visual Studio 2017 or later
- .NET Framework 3.5+ or .NET Core
- Git for source code management
- Visual Studio Code (alternative IDE)
- MSBuild command line tools
- NuGet package manager
Target Framework Selection
Target Framework Selection
Framework Options:
- .NET Framework 3.5 - Maximum compatibility
- .NET Framework 4.0 - Balanced compatibility
- .NET Framework 4.5+ - Modern features
- .NET Core - Cross-platform support
- .NET 3.5 works on Windows 7+ systems
- .NET 4.0+ provides better performance
- .NET Core enables Linux/macOS compilation
Compilation Steps
1
Clone Repository
2
Open in Visual Studio
- Open
Rubeus.slnin Visual Studio - Select appropriate build configuration
- Choose target framework if needed
3
Build Solution
4
Locate Output
Compiled binary will be in:
bin\Release\Rubeus.exe(Release build)bin\Debug\Rubeus.exe(Debug build)
Build Configurations
Release vs Debug
Release vs Debug
Release Configuration:
- Optimized for size and performance
- No debug symbols included
- Recommended for operational use
- Smaller file size
- Includes debug symbols
- Easier troubleshooting
- Larger file size
- Useful for development
Framework Targeting
Framework Targeting
Modify Target Framework:
- Open project properties
- Select “Application” tab
- Change “Target framework” dropdown
- Rebuild solution
Command Line Compilation
MSBuild Command Line
MSBuild Command Line
Basic Compilation:Advanced Options:
dotnet CLI (for .NET Core)
dotnet CLI (for .NET Core)
Basic Commands:Framework-Specific:
Building as a Library
Library Integration
Library Integration
Purpose:
- Integrate Rubeus functionality into other tools
- Create custom wrappers
- Embed in larger frameworks
- Change output type to “Class Library”
- Remove
Main()method or make conditional - Expose public methods for external use
- Build as .dll instead of .exe
Usage in Other Projects
Usage in Other Projects
Reference Assembly:NuGet Package Creation:
Cross-Platform Compilation
.NET Core Cross-Platform
.NET Core Cross-Platform
Linux Targeting:macOS Targeting:Windows Targeting:
Optimization and Customization
Size Optimization
Size Optimization
Reduce Binary Size:Remove Unused Features:
- Comment out unused command classes
- Remove unnecessary dependencies
- Strip debug information
Customization Options
Customization Options
Branding Changes:
- Modify banner text in
Program.cs - Change assembly metadata
- Update version information
- Add custom commands
- Modify existing functionality
- Integrate with other tools
- Use .NET obfuscators
- Modify string constants
- Change method names and signatures
PowerShell Integration
PowerShell Execution
PowerShell Execution
Load Assembly:Execute Commands:
PSRemoting Considerations
PSRemoting Considerations
Remote Execution:Limitations:
- PowerShell execution policy restrictions
- AMSI interference
- Constrained language mode
- Network connectivity requirements
Troubleshooting
Common Build Errors
Common Build Errors
Missing Dependencies:Framework Issues:NuGet Package Issues:
Runtime Issues
Runtime Issues
Framework Not Installed:
- Install required .NET Framework version
- Use self-contained deployment
- Check Windows version compatibility
- Run as administrator when required
- Check antivirus interference
- Verify code signing if required
Operational Considerations
Detection Avoidance
Detection Avoidance
Build Variations:
- Compile with different frameworks
- Modify source code slightly
- Use different build configurations
- Apply obfuscation techniques
- In-memory execution via PowerShell
- DLL injection techniques
- Reflective loading methods
- Process hollowing approaches