News for hackers. Stuff that matters.
Re:Curl’s backdoor threat by WalterBright on Tuesday September 12, 2017 @07:01AM (#15226287)
Since one of the backdoor methods mentioned was introducing a memory safety bug (like a buffer overflow), one way to reduce the attack surface is to use a memory safe language.

The thing is, one can write memory safe code in C. The problem is the difficulty in verifying it is memory safe.

I've opined before that this is why, soon, people will demand that internet facing code be developed with a memory safe language.

Re:Curl’s backdoor threat by concede_pluto on Tuesday September 12, 2017 @07:46AM (#15226490)
>The thing is, one can write memory safe code in C.

One can generate safe C code. We have ample evidence that a human being can't sit down and write it.

Re:Curl’s backdoor threat by aneutron on Tuesday September 12, 2017 @08:01AM (#15226549)
Well, even seasoned devs admit that writing memory safe C is always a tough task. But sometimes when you have 512kB of memory, you are bound to make some memory acrobatics.
Re:Curl’s backdoor threat by gfredtech on Tuesday September 12, 2017 @07:37AM (#15226449)
Immediately you mentioned memory safety, Rust is the language that came to mind. Memory safety is indeed important, but I find it hard to believe that in the future, ~80% of mainstream system tools will be migrated from C/C++ to Rust. Is it possible or has there been any attempts to write standalone tools that are able to check before compile-time that a particular C/C++ program won't have buffer overflows/dangling pointers? I don't expect such a tool to catch everything, but it should at least be able to track most of such bugs.

EDIT: typos

Re:Curl’s backdoor threat by xamuel on Tuesday September 12, 2017 @12:05PM (#15228429)
Detecting 100% of buffer overflows with 0% false alarms, would require solving the Halting Problem.

For applications that demand both maximum speed as well as maximum security, the best solution is probably something like a C compiler that requires the code to be accompanied by formal proofs of defined behavior. Even this will necessarily sacrifice speed in a theoretical sense, because there are certain problems for which the fastest solution is safe but can't be proven safe within (PA/ZF/ZFC/insert any consistent foundation of mathematics you like).

Eventually we'll have people writing fast programs and proving their soundness using large cardinal axioms which might or might not actually be true. Then someday one of those large cardinal axioms will turn out to be inconsistent [1] and suddenly some "proven" code will be proven no more.

[1] https://en.wikipedia.org/wiki/Kunen%27s_inconsistency_theore...

Re:Curl’s backdoor threat by andrewflnr on Tuesday September 12, 2017 @03:21PM (#15230963)
Why would you need large cardinal axioms to prove a program correct?
Re:Curl’s backdoor threat by xamuel on Wednesday September 13, 2017 @12:48AM (#15235629)
I used large cardinal axioms as [the canonical] example of any axiom stronger than standard mathematical foundations.

A contrived example: there are certain large cardinal axioms that imply the consistency of ZFC. Thus ZFC cannot prove those axioms unless ZFC is inconsistent (Godel's incompleteness theorem). Consider the following problem: "If ZFC can prove 1=0 in n steps, output 1. Else, output 0." A naive solution would brute-force search all ZFC-proofs of length n. A faster solution would be: "Ignore n and immediately output 0." This is correct, because ZFC never proves 1=0. You could formally verify the correctness by using certain large cardinal axioms, but not using raw ZFC.

Re:Curl’s backdoor threat by WalterBright on Tuesday September 12, 2017 @04:12PM (#15231947)
D is also memory safe, and it has been modified to make it possible to gradually migrate a C program to D.

https://dlang.org/blog/2017/08/23/d-as-a-better-c/

Re:Curl’s backdoor threat by steveklabnik on Tuesday September 12, 2017 @09:17AM (#15227000)
https://github.com/Microsoft/GSL is an attempt at something like this.

The Core Guidelines have been in development for a long time now; and they do only catch a subset of issues. I'm all in favor of making languages safer overall though!

Re:Curl’s backdoor threat by Pete_D on Tuesday September 12, 2017 @02:31PM (#15230072)
Frama-C lets you prove all sorts of useful properties about C code, including memory correctness. (Actually writing the proofs is a lot of work though.)

https://frama-c.com/acsl.html

Re:Curl’s backdoor threat by AgentME on Tuesday September 12, 2017 @02:04PM (#15229695)
A system that guarantees you full memory safety in C/C++ would probably force you to use programming patterns that are much easier in Rust. At some point you'd essentially be writing Rust code in C/C++ with worse tooling and worse syntax-fit.
Re:Curl’s backdoor threat by andrewflnr on Tuesday September 12, 2017 @03:26PM (#15231070)
Not necessarily. Rust's ownership system is really quite conservative, to the point of not really letting you write doubly linked lists (without unsafe or using indices or something). A memory safety system for C/C++ that lets you prove cyclic pointer structures safe, or even helps you safely implement GC, is probably possible and would be quite cool. We'd probably jump at the chance to use something similar for unsafe Rust, too.