When Panic Becomes Dangerous in Rust

What is panic ?

fn main() {
panic!("crash and burn");
}
$ cargo run
Running `target/debug/panic`
thread 'main' panicked at 'crash and burn', src/main.rs:2:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

When panic becomes a security issue?

Where is panic even more dangerous?

Real-world Example: Attacking the Cosmos SDK

When is it safe to panic?

Allows all objects to destroy themselves safely

--

--

Mo has a Ph.D. in Cyber Security and is the founder of ByteScan.net, a blockchain audit firm. Mo specializes in Solidity, Rust, and Golang.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mo Ashouri

Mo has a Ph.D. in Cyber Security and is the founder of ByteScan.net, a blockchain audit firm. Mo specializes in Solidity, Rust, and Golang.