This is where it is critical to differenciate C and C++.
https://jaxenter.com/security-vulnerabilities-languages-1570...
> Total reported open source vulnerabilities per language:
> C (46.9%)
> PHP (16.7%)
> Java (11.4%)
> JavaScript (10.2%)
> Python (5.45%)
> C++ (5.23%)
> Ruby (4.25%)
So Sure, RIGHT NOW the runtime might be safe from scrutiny, but is it because its SAFE or just not as such a high profile, just yet?
On the other hand I DO agree that 'junior' programming will always be a problem, regardless of the matter, and pretty much, regardless of the language.
The runtime (whichever one that is) is safe because its behavior is defined by design for all inputs. Yes there could be a bug, but the design is that all inputs should be defined, and doing something for any given input isn't rocket science. Out of bounds array indexes either panic/throw or return empty lists. That can lead to crashes and logic errors, sure, or maybe DOS attacks, but it cannot lead to undefined behavior or remote code execution. That's a world of difference.
C and C++ by design expose heaps of undefined behavior to the caller. The tools for detecting UB are imperfect and don't work if the relevant inputs never show up in test cases. Even when veteran C coders develop the techniques and habits that let them write correct C, mistakes tend to show up at the integration points between libraries written by different people with different techniques and habits (https://youtu.be/HgtRAbE1nBM?t=2344).
Actually, the situation for C is even worse than that makes it appear. C, both the language itself and the infrastructure ecosystem around it, actively fight you when you try to build and use tools to proactively find problems. The only tooling that tends to be effective in practice is built on dynamic analysis, which means that you can only be in confident in the safety of your code as you can be in your testing regime--and there are very few, if any, codebases that have a strong enough testing regime.
We, as an industry, have almost 50 years of coding in C. And that experience has told us that the effort it takes to build safe C code is beyond the discipline of most, if not all, development teams.
How often are there bugs in language runtimes that cause vulnerabilities in programs that are exploitable by users putting in different data into an otherwise secure program? (I'm not talking about the case where the runtime has a sandbox that breaks when the user loads bad code into it; this is a use-case C/C++ don't even try to address so that would be comparing different things. I'm talking about cases where someone is running a program that communicates over the network and the program's own code is written correctly, but a problem in the runtime makes it so the program is vulnerable to remote code execution.) The main example I can think of like that was Shellshock, which was horrible, but I would never have held up Bash as an example of a safe language. Bash has always been on my short list next to C and C++ of languages to avoid because of how easy and common it is to make mistakes that are practically unnoticeable in review.
>On the other hand I DO agree that 'junior' programming will always be a problem, regardless of the matter, and pretty much, regardless of the language.
Junior developers can write a buggy mess in any language. C/C++ are practically the only popular languages where a junior developer can accidentally write a backdoor in average-looking code that doesn't use any APIs.
I can tolerate some bugs in my software sometimes, but exploitable bugs are an entirely different thing to me.
EDIT: I thought about it a bit more and realized it cuts both ways. If you have an RCE in a standard library a lot of programs get an RCE for free while it's not patched. So yeah, a bit of a mixed bag.
Hi Klez, I determined this to be the only way to get in touch regarding a previous discussion we had on Blendle [0] as I can no longer reply on that thread.
This was back in 2017 so they may have fixed their issues.
Alexander Klöpping <[email protected]> emailed me, I'll grant it was a generic welcome email, asking for feedback. I took the opportunity to email back informing him of the problems with using my email address [1]. I don't recall the problem now, but it seems they accepted my email address but then later rejected it during the sign-up process (as I clearly received an email correctly...).
I no longer have their response, but from memory, it was a different customer service person, and they rejected the idea that they had any problem AND/OR explicitly said they weren't going to make any changes. Oh, and they sent that response to the email that I explicitly said wouldn't work (it automatically gets sent to the trash to be deleted which is also why I don't have it any more).
Their rejection of fixing their service is what made me decide to put Blendle in the trash category.
[0]: https://news.ycombinator.com/item?id=20138213
[1]: My email, sent from [email protected]
Dear Alexander Klöpping,
When I first heard about Blendle I was excited at the concept of being able to read high-quality journalism from multiple different sources through one - ad-free - platform and one reasonably-priced payment system, and so I signed up for the beta. I successfully started the process of joining Blendle by unlocking and selecting some preferences. However, I have been unable to proceed past entering my email address, [email protected]. I should make it clear that the email address [email protected] cannot be used.
Could you please assist me and help me get started with Blendle?
Best,
[redacted]
Maybe that's because most software is written in C/C++?
The arguments that C/C++ are just as safe as other languages and that's it's just a matter of opinion or experience are unfounded. It's like saying a minefield is just as safe as anywhere else to walk because you can randomly suddenly die anywhere else too because of stuff like strokes or heart attacks. You just gotta have good landmine senses and it's your own fault if you can't avoid them.
Yes still. Look to your laptop right now and count the software running in C/C++ vs anything else. They still dominate by far.
And the current fashion of writing everything in Javascript + Electron/NodeJS, just made the C/C++ backend more important than ever. NodeJS is in C/C++, V8 is in C++, Chromium is in C++, Firefox is in C++/Rust and every library behind are in C.
As per Google talk at Linux Kernel Summit 2018, 68% of Linux kernel exploits are caused by C's lack of safety against memory corruption, in spite of all the tools and processes they have in place.
Hence, the Kernel Self Protection Project sponsored by Google.
https://kernsec.org/wiki/index.php/Kernel_Self_Protection_Pr...
How often do programs in non-C/C++ languages get remote code execution vulnerabilities? I'm sure the CVE numbers will overwhelmingly show that most RCE-capable vulnerabilities are in C/C++.
Sure, it occasionally happens in other languages, but practically only when someone does something like misuse one of a specific set of APIs that allow code loading. In C/C++, any code that slightly fucks up writing to an array or passes a pointer to previously-freed memory around can cause a RCE vulnerability that lets an attacker literally run code on your system and take it over. Inspecting a C/C++ codebase made by a junior person for vulnerabilities is a total nightmare. Inspecting a codebase in any other language for RCE vulnerabilities generally means you grep for a couple APIs and look at how they get used.