A structured collection of Rust notes for offensive security — covering language fundamentals through red team tooling and malware development patterns.
This repository accompanies the Rust for Offensive Security blog series. It is intended for security researchers, red teamers, and developers who want a practical, ground-up understanding of Rust in the context of offensive tooling and systems programming.
The full write-ups, explanations, and code walkthroughs are published on the blog:
- Why Rust for red teaming and exploit development
- Memory safety advantages over C/C++
- AV/EDR evasion properties of Rust binaries
- Threat actors using Rust in real-world campaigns
- Installing Rust, VS Code, and the
rust-analyzerextension - Writing and running your first Rust program
Tooling & Project Structure
- Cargo — build system and package manager
Cargo.toml— project configuration and dependenciesCargo.lock— reproducible builds and supply-chain awareness- Crates — Rust libraries and how to add them
Language Basics
- The
mainfunction and macros (println!,print!) - Escape sequences and output formatting
- Single-line and multi-line comments
- Variables and mutability (
let,mut) - Scalar data types — integers (
i32,u8, etc.), floats (f64),char,bool - String types —
&strvs ownedString - Constants (
const) - Arithmetic, comparison, logical, and assignment operators
Control Flow
if,else if,elseifas an expressionmatch— pattern matching and return valuesloop,while,forloopsbreak,continue, and returning values from loops
Functions & Scope
- Defining and calling functions
- Parameters and return values
- Omitting the
returnkeyword - Variable scope and block-level lifetimes
- Shadowing
Memory Model
- Ownership — the three rules
- Move semantics and copy types
- Cloning with
.clone() - Borrowing and references (
&,&mut) - Mutable reference rules
Data Structures
- Arrays — fixed-size, indexed access, iteration
- Vectors — dynamic lists,
push,pop,insert,remove - Tuples — mixed-type grouping, destructuring, returning multiple values
- HashMaps — key-value storage,
insert,get,remove, iteration - Structs — custom types, field access, mutation
- Enums — variants, matching, enums with data
Offensive & Systems Programming (progressively added)
- Low-level memory manipulation
- Red team tooling patterns
- Malware-oriented Rust techniques
- AV/EDR evasion concepts
This project exists for anyone who wants to:
- Learn Rust from a security-first perspective
- Build reliable red team tools with fewer runtime surprises
- Understand why Rust is replacing C/C++ in modern offensive operations
- Strengthen systems programming fundamentals
Contributions are welcome — whether it's fixing a typo, adding a topic, or sharing a better code example. Open a PR or raise an issue.
Licensed under the MIT License.
Made by ShaheerYasir