Settings

Theme

Safe Rust Code That Segfaults

kxxt.dev

3 points by kxxt 4 years ago · 1 comment

Reader

kxxtOP 4 years ago

Recently I participated in Geekgame 2nd, which is a pretty good CTF competition for CTF newbies like me.

One problem in that competition is to submit a safe rust program that will segfault. The problem forces you to begin your rust code by #![forbid(unsafe_code)], which can’t be worked around by #![allow(unsafe_code)].

Of course, there is an attribute `allow_internal_unsafe` which allows you to use unsafe code inside a macro.

But after this PR(https://github.com/rust-lang/rust/pull/57467) was merged, you can no longer use this attribute when unsafe code is forbidden.

So how can you cause a segfault in safe rust under the assumption that you can not bypass #![forbid(unsafe_code)].

...

Read the complete blog by clicking the link in the title.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection