Rust vulnerability testing toolkit exploring memory safety boundaries — from safe-Rust panics to raw unsafe memory bugs.
This vulnerability tester is a CLI tool that deliberately triggers well-known classes of Rust vulnerabilities — both safe-Rust panics and unsafe memory bugs. It is designed to help security researchers and developers:
- Understand how Rust's safety guarantees work (and where they break down)
- Explore the boundary between
safeandunsafeRust - Practice crash analysis and vulnerability triage
- Study memory bug classes relevant to systems and protocol security
| Command | Description |
|---|---|
unwrap_expect |
Panics from .unwrap() and .expect() on None/Err values |
panic_macro |
Explicit panics via panic!, todo!, unreachable!, etc. |
arith |
Integer overflow and underflow across multiple modes |
utf8 |
Panics from slicing strings at invalid UTF-8 byte boundaries |
index_oob |
Index out-of-bounds access on a slice |
stack_overflow |
Recursive stack exhaustion |
oom |
Out-of-memory via unbounded heap allocation |
| Command | Description |
|---|---|
unsafe_oob |
Raw pointer read beyond allocated buffer |
unsafe_uaf |
Use-after-free via raw pointer dereference |
unsafe_double_free |
Double-free of heap-allocated memory |
unsafe_memory_leak |
Memory leak via Box::into_raw without reclaim |
unsafe_uninit_memory |
Reading from uninitialized memory |
unsafe_data_race |
Data race across threads |
vuln_tester/
├── Cargo.toml
├── Cargo.lock
├── README.md
└── src/
├── main.rs # CLI entry point (structopt dispatch)
├── common_vuln.rs # Safe-Rust panic scenarios
├── unsafe_code.rs # Unsafe memory bug scenarios
└── double_free.rs # Double-free specific testing
- Rust (stable toolchain)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shgit clone https://github.com/jabariwoods/Common-Rust-Vulnerabilities-Scanner.git
cd Common-Rust-Vulnerabilities-Scanner
cargo build --release
cargo build # debug build for full debu symbolscargo run -- <COMMAND> [OPTIONS]cargo run -- unwrap_expect <choice> Tests various .unwrap() and .expect() call sites that panic on None or Err.
cargo run -- panic_macro <choice> Triggers explicit panics using Rust's built-in panicking macros.
cargo run -- arith <choice> <a> <b> Tests overflow and underflow with two integer inputs across different operation modes.
cargo run -- arith 1 200 100cargo run -- utf8 "<string>"Slices a string at a hardcoded byte boundary — panics when the string contains multibyte characters.
# "банан" is Cyrillic; each character is 2 bytes
cargo run -- utf8 "банан"cargo run -- index_oob <offset> # crashes when offset > 22cargo run -- stack_overflow <value> # crashes when value == 42Triggers unbounded recursion leading to a stack overflow.
cargo run -- oomAllocates memory in an infinite loop until the OS kills the process.
cargo run -- unsafe_oob <input> Reads beyond the end of an allocated buffer using a raw pointer.
cargo run -- unsafe_uafFrees memory and then dereferences the dangling pointer.
cargo run -- unsafe_double_freeFrees the same heap allocation twice — undefined behavior in Rust's unsafe.
cargo run -- unsafe_memory_leakLeaks heap memory by converting a Box to a raw pointer without ever reclaiming it.
cargo run -- unsafe_uninit_memoryReads from memory that was never initialized.
cargo run -- unsafe_data_raceSpawns threads that concurrently read and write shared memory without synchronization.
Warning: Several commands are designed to crash the process or cause undefined behavior. Run in a controlled environment.
This tool is intentionally unsafe in places. The goal is education and security research — understanding vulnerability classes at the systems level is foundational to smart contract and protocol security auditing, where similar logic bugs (overflow, reentrancy, uninitialized state) manifest in a different execution environment.
MIT