OffensiveRust Documentation
repository·master·Indexed 25 days ago
https://github.com/trickster0/offensiverustA repository of research and implementations for offensive security operations using Rust. It includes tools and techniques for implant development and AV evasion, such as Litcrypt string encryption, memfd_create-rs for memory execution, and various injection methods including classic DLL injection, module stomping, process hollowing, and Reflective DLL Injection (RDI). It also features eagle-rs for kernel-level process manipulation, ekko-rs for sleep obfuscation, and MimiRust for post-exploitation tasks like credential dumping and privilege escalation.
What's inside OffensiveRust
- This project provides an implementation of Process Hollowing in Rust. Process Hollowing is a technique used to execute arbitrary code within the address space of a legitimate process by creating a new process in a suspended state, unmapping its memory, and replacing it with malicious code before resuming execution.
Overview of PE Madness (Portable Executable Parsing Library)
masterPE Madness is a Portable Executable (PE) parsing library written in Rust. Unlike standard parsing libraries, it is specifically designed for scenarios like Reflective DLL Injection or Shellcode Reflective DLL Injection where traditional heap allocation and dynamic sizing are not possible.
Key design constraints for use in shellcode/self-loading environments:
- No Heap Allocation: Designed to work without relying on a heap.
- Stack-Based: Dynamically sized data must be placed on the stack.
- Self-Contained: Does not rely on
libcor other implicit external APIs to avoid dependency on the OS loader. - Minimal Dependencies: Uses the
windows-syscrate andunsafecode to maintain a low footprint. - Obfuscation: Uses hashes instead of string obfuscation (like
obfstr) to make dynamic analysis more difficult.
Overview of OffensiveRust
masterOffensiveRust is a collection of experiments focused on weaponizing the Rust programming language for implant development and general offensive operations. It leverages Rust's performance, LLVM-based architecture for bypassing static AV detection, and Cargo's dependency management to facilitate offensive security tasks.Overview of Classic Shellcode Runner in Rust
masterTheshellcode_runner_classic-rsproject implements a classic shellcode runner written in Rust. It achieves execution by calling NTDLL functions directly via theNTAPIlibrary.Overview of Reflective DLL Injection (RDI)
masterThis repository provides implementations and research related to Reflective DLL Injection (RDI). RDI is a technique used to load a DLL from memory rather than from disk, which can be used to evade detection by security software that monitors file-on-disk activity.
If you are looking for Shellcode Reflective DLL Injection (sRDI), please refer to the dedicated repository:
https://github.com/memN0ps/srdi-rs.Use MimiRust for post-exploitation tasks
masterMimiRust is a post-exploitation tool written in Rust for Windows. It can be used to spawn processes as SYSTEM, execute shell commands, and extract Windows credentials (Wdigest passwords and NTLM hashes) from memory.
There are two ways to run the tool:
- Interactive Shell: Run the executable without arguments to enter an interactive menu.
- Command Line: Run the executable with specific flags/arguments directly.
Understand Syscall Evasion Techniques in mordor-rs
masterThe
mordor-rspackage implements several techniques to bypass user-mode hooks (such as those from EDRs) by retrieving system call numbers directly or using alternative invocation methods.Direct Syscall Retrieval Techniques
- Hell's Gate: Parses
ntdll.dllto find the syscall stub (4c8bd1b8) and retrieves the syscall ID. It is vulnerable to failure if the syscall stub itself is hooked. - Halo's Gate: An evolution of Hell's Gate that detects hooks by checking if the first byte is
e9(jmp). If a hook is detected, it searches neighboring functions to calculate the correct syscall ID based on incremental numbering. - Tartarus' Gate: An evolution of Halo's Gate that also checks if the second line (after
mov r10, rcx) is hooked by searching for the byte sequence4c8bd1e9.
Export Directory & OS-Based Techniques
- FreshyCalls: Searches the
Export Directoryfor functions starting withNt, sorts them by address, and uses the lowest address as the syscall identifier. - SysWhispers1: Selects the correct system call number based on OS version information.
- SysWhispers2: Similar to
FreshyCalls, but searches forZwfunctions in theExport Directoryand maps them toNtnames. - SysWhispers3: An advanced version supporting x86/WoW64, syscall instruction replacement with an EGG (for dynamic replacement), and direct jumps to syscalls or random syscalls.
- Hell's Gate: Parses
Use memfd_create-rs to execute binaries from memory
masterThememfd_create-rsproject provides a way to load ELF binaries into memory and execute them without writing them to the disk, utilizing thememfd_createtechnique (MITRE ATT&CK T1620). The main program downloads an ELF file and executes it directly from memory.Review manual_map-rs features and roadmap
masterThe current capabilities and planned features for
manual_map-rsare:Implemented Features:
- Manual Mapping in Remote process
- Manual Mapping x64 DLLs
- Rebasing image and resolving imports in the local process
- Download DLL remotely (HTTP supported)
Planned Features (ToDo):
- HTTPS support for remote downloads
- Manual Mapping in local process
- Manual Mapping in an executable file
- TLS callbacks
Use Ekko Sleep Obfuscation in Rust
masterEkko in Rust is a port of the Ekko sleep obfuscation technique to Rust. It utilizes theCreateTimerQueueTimerWin32 API function to implement sleep obfuscation, originally ported from the C implementation by Cracked5pider. This technique is used to evade detection by obfuscating the sleep state of a process.Navigate the MimiRust interactive shell
masterWhen running MimiRust in interactive mode, the prompt prefix indicates your current privilege level:
mimiRust $: Running without elevated privileges.mimiRust #: Running with elevated privileges.mimiRust @: Running with SYSTEM privileges.
To view available options in the shell, use:
?(to see top-level modules)horhelp(for help)
Modules available in the shell:
passwordspiviotingprivilege
Use module_stomping-rs for Module Stomping
masterThemodule_stomping-rstool performs Module Stomping (also known as Module Overloading or DLL Hollowing). It injects a Microsoft-signed DLL (e.g.,amsi.dll) into a target process using classic DLL injection, then reads theAddressOfEntryPointof that DLL and overwrites its content with shellcode. This allows shellcode to execute from within the memory space of a legitimate, signed module.