News for hackers. Stuff that matters.
Re:Open-Sourcing ClusterFuzz by pcwalton on Thursday February 07, 2019 @01:48PM (#19107375)
Virtually nobody in security agrees with you. Memory-safe languages do effectively mitigate some of the most critical security issues.

C++ static analysis is helpful, but it is not memory safe. Modern C++ doesn't really help. In fact, in my opinion, modern C++ tends to be less memory safe than "classic" C++, because it adds all sorts of new fun ways to get use-after-free.

Re:Open-Sourcing ClusterFuzz by daeken on Thursday February 07, 2019 @02:26PM (#19107703)
People drastically underestimate the prevalence and impact of UAF attacks. They're extremely common in complex applications and often lead to everything from information leaks to code execution. That's why almost every browser exploit (of the last ~10 years at least) uses at least one UAF in their chain.
Re:Open-Sourcing ClusterFuzz by saagarjha on Thursday February 07, 2019 @04:30PM (#19108777)
> That's why almost every browser exploit (of the last ~10 years at least) uses at least one UAF in their chain.

That's usually because the "low-hanging fruit" is mostly gone due to protections like stack canaries, CFI checks, address randomization, and sandboxing, which makes things like buffer overflows or jumping to shellcode more difficult.

Re:Open-Sourcing ClusterFuzz by pjmlp on Thursday February 07, 2019 @04:45PM (#19108892)
Yet the Linux Kernel Self Preservation project is still in a getting there kind of state.
Re:Open-Sourcing ClusterFuzz by saagarjha on Friday February 08, 2019 @01:18AM (#19111981)
Sorry, what?
Re:Open-Sourcing ClusterFuzz by pjmlp on Friday February 08, 2019 @01:48AM (#19112079)
That low hanging fruit is not gone on the Linux kernel, for more info check Linux Kernel Summit 2018 and Linux New Zealand Conference 2019.
Re:Open-Sourcing ClusterFuzz by jupp0r on Thursday February 07, 2019 @04:25PM (#19108742)
> Modern C++ doesn't really help. In fact, in my opinion, modern C++ tends to be less memory safe than "classic" C++, because it adds all sorts of new fun ways to get use-after-free.

I think modern C++ is much safer than legacy C++, not by disallowing the USE after free, but by giving you the tools to make sure that the FREE happens at an appropriate time. A lot of this is not necessarily a feature of the language itself, but of idioms the community seems to agree to ie CppCoreGuidelines. I'm thinking of

- never use the delete operator manually, prefer std::unique_ptr

- prefer single ownership over shared ownership

- prefer immutable over mutable state

- ...

I agree with you that compared to Rust, this places a lot of burden on code reviewers and is in no way perfect, but I wouldn't say it's going in the wrong direction, making the language less safe.

Re:Open-Sourcing ClusterFuzz by pcwalton on Thursday February 07, 2019 @09:40PM (#19111018)
When people use the delete operator manually and mess up, do they usually delete objects too early or too late? In my experience, they usually delete objects too late or not at all (though I admit to not having hard data here). Accordingly, most of the benefits people cite regarding RAII classes such as unique_ptr are that they reduce memory leaks. I would agree that they do. But memory leaks aren't nearly as severe as use-after-free.

Additionally, it's not really shared ownership that causes problems; it's the fact that references (and pointers) make it possible to violate ownership semantics. References are used all the time in C++, and you can't use any libraries without them. It doesn't matter if data has a single owner if that owner is deleted and you still hold references to the data. In fact, shared ownership via shared_ptr is safer than unique_ptr, from a UAF point of view.

Re:Open-Sourcing ClusterFuzz by jupp0r on Friday February 08, 2019 @12:11PM (#19116335)
> Additionally, it's not really shared ownership that causes problems; it's the fact that references (and pointers) make it possible to violate ownership semantics.

Shared ownership makes it much harder to reason about lifetimes, increasing the chance of mistakes.

> shared ownership via shared_ptr is safer than unique_ptr, from a UAF point of view.

Only if the dereferencing code holds the shared_ptr. It's also common to pass non-owning pointers to objects held by shared_ptr.

> When people use the delete operator manually and mess up, do they usually delete objects too early or too late?

As you pointed out, problems arise if objects are deleted too early or twice. Double free is common in C and can be exploited as well...

Re:Open-Sourcing ClusterFuzz by feanaro on Friday February 08, 2019 @02:04AM (#19112129)
> I agree with you that compared to Rust, this places a lot of burden on code reviewers and is in no way perfect, but I wouldn't say it's going in the wrong direction, making the language less safe.

Well if it isn't getting any safer than the time-disproven technique of relying on human behaviour and there are automatically safer alternatives, then it is less safe than those alternatives.

Re:Open-Sourcing ClusterFuzz by jupp0r on Friday February 08, 2019 @11:57AM (#19116163)
Sure, but the argument was that newer C++ standards make the language less safe.
Re:Open-Sourcing ClusterFuzz by pjmlp on Thursday February 07, 2019 @04:44PM (#19108878)
That is the thing though, I never did code reviews in C++ projects and have been often in the past (in my C and C++ days) the dude playing the D.Quixote role about static analysers.

Modern C++ is safer, but only if you can ensure everyone on the team never reaches for C style tricks, nor the libraries that you link against.