diff --git a/Cargo.toml b/Cargo.toml index ff8bb2f..f59d4fc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,3 +29,6 @@ step-on-lego = ["oorandom"] [[bench]] name = "transmute" harness = false + +[[example]] +name = "segfault" diff --git a/README.md b/README.md index 7b1c588..ab72298 100644 --- a/README.md +++ b/README.md @@ -24,15 +24,7 @@ - **🦀 Built in 100% memory-safe Rust** ## Example -```rs -// With cve-rs, you can crash prod in a 🔥 blazingly fast manner! -pub fn segfault() { - let null: &mut u8 = cve_rs::null_mut::(); - *null = 42; -} -``` - -![Segfault demo](/assets/segfault-demo.png) +![Segfault demo](/vhs/cassete.gif) Rust is an amazing language. You can program a lot of useful things while ensuring that your program will stay safe. Unfortunately, safe Rust is quite limiting. For example, you cannot introduce code that could corrupt the program's memory. Now, with **cve-rs**, you can corrupt your program's memory without corrupting your program's memory. @@ -97,4 +89,4 @@ This project is licensed under the [GLWTSPL](/LICENSE). ![Good Luck](https://github.com/me-shaon/GLWTPL/raw/master/good-luck.gif) -...and godspeed. \ No newline at end of file +...and godspeed. diff --git a/examples/segfault.rs b/examples/segfault.rs new file mode 100644 index 0000000..1d81958 --- /dev/null +++ b/examples/segfault.rs @@ -0,0 +1,5 @@ +// With cve-rs, you can crash prod in a 🔥 blazingly fast manner! +fn main() { + let null: &mut u8 = cve_rs::null_mut::(); + *null = 42; +} diff --git a/src/transmute.rs b/src/transmute.rs index 2d12261..bf98cb3 100644 --- a/src/transmute.rs +++ b/src/transmute.rs @@ -33,6 +33,7 @@ pub fn transmute(obj: A) -> B { // Note that `data` is shared between `DummyEnum::A` and `DummyEnum::B`. // This should hopefully be more reliable than spamming the stack with a value and hoping the memory // is placed correctly by the compiler. + #[allow(dead_code)] enum DummyEnum { A(Option>), B(Option>), diff --git a/vhs/cassete.gif b/vhs/cassete.gif new file mode 100644 index 0000000..e00650a Binary files /dev/null and b/vhs/cassete.gif differ diff --git a/vhs/cassete.tape b/vhs/cassete.tape new file mode 100644 index 0000000..da45fb2 --- /dev/null +++ b/vhs/cassete.tape @@ -0,0 +1,19 @@ +Set Theme "Catppuccin Mocha" +Set FontFamily "JetBrainsMono Nerd Font" +Set Margin 20 +Set MarginFill "#B4BEFE" +Set BorderRadius 10 +Set Shell bash +Set TypingSpeed 0 +Hide +Type "source vhs/config.bash" +Enter +Show +Set TypingSpeed 0.1 +Type "bat examples/segfault.rs" +Enter +Sleep 5s +Type "cargo run --example segfault" +Sleep 5s +Enter +Sleep 3s diff --git a/vhs/config.bash b/vhs/config.bash new file mode 100644 index 0000000..c1db387 --- /dev/null +++ b/vhs/config.bash @@ -0,0 +1,3 @@ +clear +echo "Blazingly 🔥 fast 🚀 memory vulnerabilities, written in 100% safe Rust. 🦀" +export LANGUAGE="en"