joaoviictorti/uwd

GitHub: joaoviictorti/uwd

uwd 是一个 Rust 编写的 Windows 调用栈伪造库,通过自动化 gadget 解析和简洁的宏接口帮助开发者在执行函数或系统调用时隐藏真实调用来源。

Stars: 218 | Forks: 25

# uwd ![Rust](https://img.shields.io/badge/made%20with-Rust-red) ![crate](https://img.shields.io/crates/v/uwd.svg) ![docs](https://docs.rs/uwd/badge.svg) ![License](https://img.shields.io/badge/license-MIT%2FApache--2.0-brightgreen) [![Actions 状态](https://static.pigsec.cn/wp-content/uploads/repos/cas/05/052bc9eaea1744e860f382f618f1146be38e27dfd499bb29c253bcd1827fad60.svg)](https://github.com/joaoviictorti/uwd/actions) 用于在 Windows 上进行调用栈欺骗的 Rust 库,允许你使用伪造的调用栈执行任意函数,从而在栈展开期间躲避分析、日志记录或检测。 受 [SilentMoonwalk](https://github.com/klezVirus/SilentMoonwalk) 启发,这个 crate 将低级欺骗功能引入了干净、符合 Rust 习惯的接口中,全面支持 `#[no_std]`、`MSVC` 和 `GNU` 工具链,以及自动化的 gadget 解析。 ## 功能 - ✅ 通过 `Synthetic` 和 `Desync` 进行调用栈欺骗。 - ✅ 兼容 `MSVC` 和 `GNU` 工具链 (**x64**)。 - ✅ 内联宏:`spoof!` / `syscall!`。 - ✅ 支持 `#[no_std]` 环境(需带有 `alloc`)。 要启用 Desync 模式,请在你的项目中激活 `desync` 功能,启用该功能后,宏将自动使用 Desync 行为。 ## 快速入门 通过更新你的 `Cargo.toml` 将 `uwd` 添加到你的项目中: ``` cargo add uwd ``` ## 用法 `uwd` 允许你在 Rust 中调用标准 Windows API 或执行间接 syscall 时欺骗调用栈。该库处理了假栈帧、gadget 链和寄存器准备的全部设置工作,使执行看起来像是来自合法的来源。 你可以欺骗: * 普通函数(如 `VirtualAlloc`、`WinExec` 等) * 带有自动 SSN 和 stub 解析的原生 syscall(如 `NtAllocateVirtualMemory`) ### 欺骗 WinExec 此示例展示了如何使用欺骗的调用栈生成 `calc.exe`。我们调用了两次 `WinExec`,一次使用 Desync 技术,另一次使用 Synthetic 技术。 ``` use dinvk::module::{get_module_address, get_proc_address}; use uwd::spoof; // Resolves addresses of the WinAPI functions to be used let kernel32 = get_module_address("kernel32.dll", None); let win_exec = get_proc_address(kernel32, "WinExec", None); // Execute command with `WinExec` let cmd = c"calc.exe"; let mut result = spoof!(win_exec, cmd.as_ptr(), 1)?; if result.is_null() { eprintln!("WinExec Failed"); return Ok(()); } ``` ### 欺骗间接 Syscall 此示例使用欺骗的调用栈对 `NtAllocateVirtualMemory` 执行间接系统调用。 ``` use std::{ffi::c_void, ptr::null_mut}; use dinvk::winapis::NT_SUCCESS; use uwd::{syscall, AsPointer}; // Running indirect syscall with Call Stack Spoofing let mut addr = null_mut::(); let mut size = (1 << 12) as usize; let mut status = syscall!("NtAllocateVirtualMemory", -1isize, addr.as_ptr_mut(), 0, size.as_ptr_mut(), 0x3000, 0x04)? as i32; if !NT_SUCCESS(status) { eprintln!("[-] NtAllocateVirtualMemory Failed With Status: {status:#X}"); return Ok(()) } println!("[+] Address allocated: {:?}", addr); ``` ## 参考 我想对启发我创建 `uwd` 并为其部分功能做出贡献的这些项目表达感激之情: - [SilentMoonwalk](https://github.com/klezVirus/SilentMoonwalk) 特别感谢: - [Kudaes](https://x.com/_Kudaes_) - [Klez](https://x.com/KlezVirus) - [Waldo-IRC](https://x.com/waldoirc) - [Trickster0](https://x.com/trickster012) - [namazso](https://x.com/namazso) ## 许可证 uwd 根据以下任一许可证进行授权: - Apache License, Version 2.0, ([LICENSE-APACHE](https://github.com/joaoviictorti/uwd/tree/main/LICENSE-APACHE) 或 ) - MIT license ([LICENSE-MIT](https://github.com/joaoviictorti/uwd/tree/main/LICENSE-MIT) 或 ) 由你自行选择。 除非你明确声明,否则根据 Apache-2.0 许可证的定义,你故意提交以包含在 uwd 中的任何贡献,均应按上述方式进行双重许可,无需任何附加的条款或条件。
标签:Chrome扩展, DNS 反向解析, Rust, 可视化界面, 安全意识培训, 底层开发, 私有化部署, 网络流量审计, 调用栈伪造, 通知系统, 防御规避