1
+ //! # uwd 🦀
2
+ //!
3
+ //! A Rust library for **call stack spoofing** on Windows.
4
+ //!
5
+ //! Inspired by [SilentMoonwalk](https://github.com/klezVirus/SilentMoonwalk),
6
+ //! this crate brings low-level spoofing capabilities into an idiomatic Rust interface,
7
+ //! with support for:
8
+ //!
9
+ //! - ✅ Call stack spoofing via **Desync** and **Synthetic** techniques
10
+ //! - ✅ Inline macros: [`spoof!`], [`spoof_synthetic!`], [`syscall!`], [`syscall_synthetic!`]
11
+ //! - ✅ Works with both **MSVC** and **GNU** toolchains (x64)
12
+ //! - ✅ `#[no_std]` support (with `alloc`)
13
+ //!
14
+ //! ## Examples
15
+ //!
16
+ //! ### Spoofing `WinExec`
17
+ //!
18
+ //! ```no_run
19
+ //! use dinvk::{GetModuleHandle, GetProcAddress};
20
+ //! use uwd::{spoof, spoof_synthetic};
21
+ //!
22
+ //! fn main() -> Result<(), Box<dyn std::error::Error>> {
23
+ //! let kernel32 = GetModuleHandle("kernel32.dll", None);
24
+ //! let win_exec = GetProcAddress(kernel32, "WinExec", None);
25
+ //!
26
+ //! let cmd = c"calc.exe";
27
+ //!
28
+ //! // Call Stack Spoofing (Desync)
29
+ //! spoof!(win_exec, cmd.as_ptr(), 1)?;
30
+ //!
31
+ //! // Call Stack Spoofing (Synthetic)
32
+ //! spoof_synthetic!(win_exec, cmd.as_ptr(), 1)?;
33
+ //!
34
+ //! Ok(())
35
+ //! }
36
+ //! ```
37
+ //!
38
+ //! ### Spoofing an Indirect Syscall (`NtAllocateVirtualMemory`)
39
+ //!
40
+ //! ```no_run
41
+ //! use std::{ffi::c_void, ptr::null_mut};
42
+ //! use dinvk::NT_SUCCESS;
43
+ //! use uwd::{syscall, syscall_synthetic, AsUwd};
44
+ //!
45
+ //! fn main() -> Result<(), Box<dyn std::error::Error>> {
46
+ //! // Desync technique
47
+ //! let mut addr = null_mut::<c_void>();
48
+ //! let mut size = (1 << 12) as usize;
49
+ //! let mut status = syscall!(
50
+ //! "NtAllocateVirtualMemory",
51
+ //! -1isize,
52
+ //! addr.as_uwd_mut(),
53
+ //! 0,
54
+ //! size.as_uwd_mut(),
55
+ //! 0x3000,
56
+ //! 0x04
57
+ //! )? as i32;
58
+ //!
59
+ //! if !NT_SUCCESS(status) {
60
+ //! eprintln!("NtAllocateVirtualMemory failed: {status:#X}");
61
+ //! return Ok(());
62
+ //! }
63
+ //!
64
+ //! println!("[+] Address allocated: {:?}", addr);
65
+ //!
66
+ //! // Synthetic technique
67
+ //! let mut addr = null_mut::<c_void>();
68
+ //! let mut size = (1 << 12) as usize;
69
+ //! status = syscall_synthetic!(
70
+ //! "NtAllocateVirtualMemory",
71
+ //! -1isize,
72
+ //! addr.as_uwd_mut(),
73
+ //! 0,
74
+ //! size.as_uwd_mut(),
75
+ //! 0x3000,
76
+ //! 0x04
77
+ //! )? as i32;
78
+ //!
79
+ //! if !NT_SUCCESS(status) {
80
+ //! eprintln!("NtAllocateVirtualMemory failed [2]: {status:#X}");
81
+ //! return Ok(());
82
+ //! }
83
+ //!
84
+ //! println!("[+] Address allocated: {:?}", addr);
85
+ //!
86
+ //! Ok(())
87
+ //! }
88
+ //! ```
89
+
1
90
#![ no_std]
2
- #![ doc = include_str ! ( "../README.md" ) ]
3
91
#![ allow(
4
92
clippy:: doc_overindented_list_items,
5
93
clippy:: collapsible_if
@@ -10,4 +98,4 @@ extern crate alloc;
10
98
mod data;
11
99
mod uwd;
12
100
13
- pub use uwd:: * ;
101
+ pub use uwd:: * ;
0 commit comments