4 ms·
I'm actually curious now – is it possible to deliberately introduce an RCE vulnerability into Rust code with `#![forbid(unsafe_code)]`? Has anyone done it?
by conradev 10y ago
I'm actually curious now – is it possible to deliberately introduce an RCE vulnerability into Rust code with `#![forbid(unsafe_code)]`? Has anyone done it?
- deleted 10y ago[deleted]
- pcwalton 10y agoSure, that's easy: just write a Rust program that spawns a root shell connected to port 1337. This isn't a flippant response: I suspect most RCEs in Rust software are likely to be high-level vulnerabilities like that.
- whyever 10y agoYou can also use /proc to violate memory safety in safe rust.
- tedunangst 10y agohttp://marc.info/?l=full-disclosure&m=141272606521280&w=2 http://marc.info/?l=full-disclosure&m=141272606521280&w=2
- duaneb 10y agoIf you have access to /proc, it's not much of an rce threat.
- tinco 10y agoWell this particular project this comment thread is about does not actually implement any cryptographic operations, those are all done by libsodium[1] a project written in C. Imagine now it is possible to construct an argument to those libsodium functions that satisfies the constraints of the Rust wrappers, but still manages to crash libsodium and execute some part of the argument, which is not unheard of since libsodium is written in C and it operates on blobs of data. Now the only mistake the implementor of thrussh has to make is to allow for that input to be passed into the rust libsodium wrapper through the protocol implementation. [1] https://github.com/jedisct1/libsodium https://github.com/jedisct1/libsodium