dll-syringe
A windows dll injection library written in Rust.
Supported scenarios
| Injector Process | Target Process | Supported? |
|---|---|---|
| 32-bit | 32-bit | Yes |
| 32-bit | 64-bit | No |
| 64-bit | 32-bit | Yes (requires feature into_x86_from_x64) |
| 64-bit | 64-bit | Yes |
Usage
Inject & Eject
The example below will inject and then eject the module at the path injection_payload.dll into the process called "ExampleProcess".
use ;
// find target process by name
let target_process = find_first_by_name.unwrap;
// create a new syringe for the target process
let mut syringe = for_process;
// inject the payload into the target process
let injected_payload = syringe.inject.unwrap;
// do something else
// eject the payload from the target (optional)
syringe.eject.unwrap;
Calling Remote Procedures
The example below will perform the same injection as above, but will call the add function defined exported from the injected module.
The definition of the exported add function looks like this.
pub extern "system"
The code of the injector/caller will look like this.
use ;
// find target process by name
let target_process = find_first_by_name.unwrap;
// create a new syringe for the target process
let mut syringe = for_process;
// inject the payload into the target process
let injected_payload = syringe.inject.unwrap;
let result: f64 = syringe.get_procedure.unwrap.unwrap.call.unwrap;
println!; // prints 6
// eject the payload from the target (optional)
syringe.eject.unwrap;
Note that currently only functions with a signature of extern "system" fn(args: *mut A, result: *mut B) -> () are supported. When the payload and the procedure are compiled for a different target architecture the passed types have to have the same size.
The definition of the exported function above can be simplified using dll-syringe-payload-utils:
remote_procedure!
License
Licensed under MIT license (LICENSE or http://opensource.org/licenses/MIT)
Attribution
Inspired by Reloaded.Injector from Sewer.