46 points · by based2 · 6y ago · 17 comments
Sounds like famous last words. How can something be provably invulnerable to RCE? Wouldn't you just be able to prove that it's invulnerable to known RCE's?
There was a proof of SSL or TLS (can’t remember which) as a protocol was secure, but later was exploited. This was because the exploit was something the spec didn’t cover
Also, a bug in the compiler could introduce such a bug.
To my knowledge, the major Ada compilers have a very good reputation for correctness, but none are formally verified, and there's no such compiler on the horizon.
> There was a proof of SSL or TLS (can’t remember which) as a protocol was secure, but later was exploited. This was because the exploit was something the spec didn’t cover
Typically we'd expect the only vulnerabilities in such an implementation would be side-channel attacks, such as timing attacks. Do you have any more details on this? I couldn't find anything with a quick google.
My understanding is that both Needham–Schroeder and SSL had formal verification prior to the breaks, but the breaks relied on properties outside of what was proven (which was thought to be complete at the time).
> Also, a bug in the compiler could introduce such a bug.
> To my knowledge, the major Ada compilers have a very good reputation for correctness, but none are formally verified, and there's no such compiler on the horizon.
No, a bug in the compiler does not introduce such a bug.
A bug in the compiler is a bug in the implementation and does not equate to a bug in the formal spec. It is rather like a fault in a machine or a building arising from a dodgy supplier using below spec materials, or a fault in the manufacturing or assembly process.
A program could also be implemented in a safe language where the defined semantics rule out RCE. Of course this would then depend on how much trust and/or verification is put into the language implementation and specification corectness.
It doesn't seem like such a language would be very useful, unless you mean a language developed specifically for a particular application.
A language can be made safe against invalid memory accesses and undefined behavior but if it prevents RCE then it must also prevent implementing remote procedure calls, meaning it's not general purpose.
First let me be clear that this comment only relates to the parent's statement "A program could also be implemented in a safe language where the defined semantics rule out RCE." It is this claim I take issue with, not anything about the original post, which I haven't looked at in detail. Spark allows contracts and pre- and post- conditions to be defined on procedures which together may amount to encoding a spec for the application into the source code. It may then be possible to prove the implementation correct relative to this spec. But that's very different from saying that the defined semantics of the language alone (ie. without the spec which must be provided to the verifier one way or another) prevents RCE.
Now to substantiate my claim that the semantics of a general purpose language cannot alone "rule out RCE".
1) A general purpose language may be used to implement a program which provides an RPC (remote procedure call) mechanism, whether open to all or restricted to a set of authorized users.
2) A program written in a general purpose language may implement an interpreter for its own, or some other language, such as Scheme.
3) In the absence of a formal spec nothing prevents the programmer from implementing an RPC call which takes a string received from the network, with no authorization/authentication checks, and runs that string through the program's scheme interpreter. This constitutes RCE by any definition I'm aware of.
Try writing some moderately complex progra. in C, then a formally verified version in SPARK and fuzz them. That is usually quite confidence-inspiring :)