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 injection_payload.dll into a 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 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
This example performs the same injection as above, but will call the add function 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 syringe = for_process;
// inject the payload into the target process
let injected_payload = syringe.inject.unwrap;
let result = syringe..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. As the parameters are memcpy'd there can be problems if the injector and payload have different target architectures.
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.