News for hackers. Stuff that matters.
Re:Nvidia Security Team: “What if we just stopped using C?” by delusional on Monday November 07, 2022 @11:02AM (#33507582)
Believing that all software security problems would be solved if we got rid of C is a bigger disease than C itself. I work in a fairly large (for my country) financial institution and the problems we deal with on a day to day basis are so far removed from buffer overflows that it's not even funny.

We still have software running in excel macros that control web browsers via COM. C is nothing compared to the attack surface of that.

Re:Nvidia Security Team: “What if we just stopped using C?” by mejutoco on Monday November 07, 2022 @11:22AM (#33507873)
OP is not claiming that it would reduce _all_ software security problems though, so this is a straw man (intentional or not).

Even the analogy holds up in this regard: using other materials instead of asbestos does not remove all the construction problems.

I think C has other things going for it (simplicity of the compiler), just wanted to point that out.

Re:Nvidia Security Team: “What if we just stopped using C?” by zamalek on Monday November 07, 2022 @11:35AM (#33508098)
> Believing that all software security problems would be solved if we got rid of C is a bigger disease than C itself.

Getting rid of a class of errors (correctness) allows you to focus more on other errors (logical). It could be argued that it could slightly reduce the likelihood of the latter.

Re:Nvidia Security Team: “What if we just stopped using C?” by P5fRxh5kUvp2th on Monday November 07, 2022 @11:49AM (#33508353)
Our industry went through this with the move to Java (and later .Net).

"It will solve memory leaks!"

...

"whoops, you can still leak memory in garbage collected languages, my bad everyone!".

Re:Nvidia Security Team: “What if we just stopped using C?” by adgjlsfhk1 on Monday November 07, 2022 @12:40PM (#33509192)
ditching C doesn't solve memory leaks but it does solve use after free. A memory leak is a performance problem that isn't generally exploitable. A use after free is almost always a security vulnerability.
Re:Nvidia Security Team: “What if we just stopped using C?” by P5fRxh5kUvp2th on Monday November 07, 2022 @02:55PM (#33511439)
quick, someone tell everyone locking up resources without releasing them isn't exploitable for bad actors.
Re:Nvidia Security Team: “What if we just stopped using C?” by worthless-trash on Monday November 07, 2022 @06:37PM (#33514098)
Memory leak is better than privesc in most cases of active exploitation.
Re:Nvidia Security Team: “What if we just stopped using C?” by ndriscoll on Monday November 07, 2022 @10:14PM (#33515518)
You can use resources after releasing them in pretty much any language. That's maybe not as dangerous as reinterpreting arbitrary memory, but then you can also use object pools for everything in C, which is what some very high performance code I used to work on did.
Re:Nvidia Security Team: “What if we just stopped using C?” by bcrosby95 on Monday November 07, 2022 @12:01PM (#33508571)
Both a paper cut and a gunshot wound bleed. It doesn't make them equal.
Re:Nvidia Security Team: “What if we just stopped using C?” by wiseowise on Monday November 07, 2022 @12:58PM (#33509480)
In C you leak memory because of all the land mines in the language. In Java/.Net you leak memory because you have flaw in your logic.
Re:Nvidia Security Team: “What if we just stopped using C?” by paulmd on Monday November 07, 2022 @02:38PM (#33511179)
Circular references and other things that tend to leak memory on GC languages aren't a logic flaw in the sense of your business logic being wrong, though.
Re:Nvidia Security Team: “What if we just stopped using C?” by scawf on Monday November 07, 2022 @03:52PM (#33512264)
Circular reference does not leak memory if your using a proper GC
Re:Nvidia Security Team: “What if we just stopped using C?” by donkeybeer on Monday November 07, 2022 @03:11PM (#33511691)
Memory errors are always logic errors in C. Freeing something that was already freed or accessing a buffer out of bounds and so on are pure logic errors.
Re:Nvidia Security Team: “What if we just stopped using C?” by pjmlp on Tuesday November 08, 2022 @03:34AM (#33517137)
Plenty of logic errors in the last 50 years, CVE appeciates it.
Re:Nvidia Security Team: “What if we just stopped using C?” by donkeybeer on Tuesday November 08, 2022 @04:54AM (#33517598)
But that person was trying to say memory errors are some kind of special "magical" error, which is simply wrong. Memory errors are merely logical errors. There is nothing "special" or "mysterious" about them.
Re:Nvidia Security Team: “What if we just stopped using C?” by pjmlp on Tuesday November 08, 2022 @05:57AM (#33517924)
Given the common meme as nasal dragons for UB, there is certainly some magic creatures associated with them.
Re:Nvidia Security Team: “What if we just stopped using C?” by hardware2win on Monday November 07, 2022 @01:11PM (#33509681)
I dont remember single mem leak in my half decade .net career

which speaks how rare they are

Re:Nvidia Security Team: “What if we just stopped using C?” by P5fRxh5kUvp2th on Monday November 07, 2022 @02:58PM (#33511490)
.net 1.0 was 20 years ago, you've been working in it for 5 years, roughly 25% of its lifetime.
Re:Nvidia Security Team: “What if we just stopped using C?” by hardware2win on Monday November 07, 2022 @03:39PM (#33512073)
We're evaluating techs by their state decade(s) ago here or what?
Re:Nvidia Security Team: “What if we just stopped using C?” by P5fRxh5kUvp2th on Monday November 07, 2022 @03:44PM (#33512149)
judgment is not the only reason for conversation, I strongly suggest you read back over the conversation from the beginning and endeavor to understand the context with which responses are made.

I also suggest you say 5 years instead of "half-a-decade", most of us see through that and it's off-putting.

Re:Nvidia Security Team: “What if we just stopped using C?” by zamalek on Monday November 07, 2022 @04:26PM (#33512738)
I have worked with .Net, in a hobby capacity, since beta. I have worked with it professionally since 2007.

I have seen two instances of rooted memory:

- WPF. The implicit GC root path introduced by events. We were easily able to track this down due to the information that the GC holds in memory[1] (fixing it was not so easy).

- A leak in managed C++ (non-pure, i.e. native code). We had to use the normal tools to track this down, not a 5 minute diagnosis.

At the end of the day GC'd languages can have (and usually do) richer tooling surrounding memory usage. They are better in this regard even during a failure state.

[1]: https://learn.microsoft.com/en-us/dotnet/core/diagnostics/so...

Re:Nvidia Security Team: “What if we just stopped using C?” by P5fRxh5kUvp2th on Monday November 07, 2022 @07:19PM (#33514451)
Lets loop back to the original point.

Getting rid of C won't get rid of security problems anymore than moving to java and .net got rid of needing to think about memory leaks.

Those that think otherwise are ignorant of history, or choosing to ignore it.

And it gets worse when you consider resource exhaustion, not just memory. There are entire mechanisms in .net and java whose sole purpose in life is to try and deal with resource exhaustion because the GC only deals with 1 aspect of that resource exhaustion (memory leaks).

---

For those of us who watched that transition, it's obvious it won't work out the way people are claiming.

Re:Nvidia Security Team: “What if we just stopped using C?” by zamalek on Monday November 07, 2022 @02:02PM (#33510576)
From my comment, emphasis added:

> it could slightly reduce

Re:Nvidia Security Team: “What if we just stopped using C?” by raxxorraxor on Tuesday November 08, 2022 @03:10AM (#33516988)
I had to move part of the Code to C for different reason (imaging device) and used that code in a .net application. But allocating unmanaged memory on .nets heap led to memory fragmentation and while overall there was enough memory available, you ran into allocation errors since unmanaged memory needed to be allocated in one successive block. Usually doesn't happen, but if you have large objects like high resolution images in memory, you can quickly run into problems. And to my knowledge there was no way to check if there was enough successive memory available.

Had to wait on a patch for .net... not a problem anymore today, although I don't know the details how they solved the problem.

Re:Nvidia Security Team: “What if we just stopped using C?” by lelanthran on Tuesday November 08, 2022 @03:47AM (#33517234)
> Getting rid of a class of errors (correctness) allows you to focus more on other errors (logical).

I think you mean "memory safety", not "correctness".

Correctness is a much harder target to hit and requires a good deal of time.

Re:Nvidia Security Team: “What if we just stopped using C?” by docandrew on Monday November 07, 2022 @11:09AM (#33507677)
Ok, but why are the Excel macros so risky? It’s often because the underlying software or OS was written in C/C++.
Re:Nvidia Security Team: “What if we just stopped using C?” by delusional on Monday November 07, 2022 @11:17AM (#33507803)
What? No it isn't. It's because the users think they're opening a document to look at some data and suddenly it's an executable transferring money via their bank account.

And that's all working as designed. Someone built it like that. There's no bug anywhere in that chain, just as extremely rickety system with no affordances for human intervention. No separation of what is trusted and what is not.

Re:Nvidia Security Team: “What if we just stopped using C?” by Jtsummers on Monday November 07, 2022 @11:30AM (#33508010)
Excel macros are risky because they offer a kind of privilege escalation. Most Excel built-in functions (that is, what you write into the cells) have limited reach. They impact that cell and (by reference) other cells, but not the underlying filesystem and other things. Even looking at the database ones, I'm not seeing a single function that writes to the DB but plenty that read from it, that's "safe" in that it would be very hard to abuse these kinds of things to screw with other systems or the host system. But macros can run arbitrary code and access whatever the user can access in a way most Excel functions cannot and can trigger arbitrary effects. The equivalent of `rm -r ~/` is not possible in straight Excel, but is feasible with a macro. C and C++ have nothing to do with that, it's the underlying privilege model that permits it.

There's a good case to be made for using better languages than C and C++ for large classes of software. Don't weaken it by making absurd claims.

Re:Nvidia Security Team: “What if we just stopped using C?” by docandrew on Monday November 07, 2022 @11:38AM (#33508149)
Broken security model/sandboxing aside (which is inexcusable), the use of C/C++ expands the attack surface - there are some excel exploits though that take advantage of C vulns like buffer overflows: https://www.exploit-db.com/exploits/18087
Re:Nvidia Security Team: “What if we just stopped using C?” by P5fRxh5kUvp2th on Monday November 07, 2022 @11:51AM (#33508391)
> There's a good case to be made for using better languages than C and C++ for large classes of software. Don't weaken it by making absurd claims.

And this idea can be applied to so many things.

Seriously, very often things have enough downsides that you don't need to exaggerate things that are not downsides. You're actually weakening your side by doing so because if people cannot trust even that bit of honesty, why would they trust anything you say?

be trustworthy is the first rule in convincing others.

Re:Nvidia Security Team: “What if we just stopped using C?” by snicker7 on Monday November 07, 2022 @11:17AM (#33507786)
You can be socially engineered to open a mallacious excel.
Re:Nvidia Security Team: “What if we just stopped using C?” by wizofaus on Monday November 07, 2022 @01:46PM (#33510268)
Did you see the claim "70% of all security bugs are related to memory safety"? Which isn't to say 70% of successful exploitation of said bugs resulted in genuine harm, but low-level vulnerabilities in widely used system-level software (network stacks etc.) can potentially have devastating effects in the way an excel macro is unlikely to.
Re:Nvidia Security Team: “What if we just stopped using C?” by delusional on Monday November 07, 2022 @04:56PM (#33513116)
What I'm trying to get at here is that security is not just "bugs". Nowhere in the excel macro hell that is my job are there any bugs. Using a macro to transfer money in and out of peoples accounts in bulk is bad design, It's insecure, and i have at times argued that it's unethical, but it is also not a bug, It's exactly how the system was designed to work. Edge was designed to embed an Internet Explorer OLE frame, and that frame was designed to have an IE7 compatibility mode. No part of that would count in the "70% of bugs" list.

Moreover, almost no bugs are discovered in the actual reasonable software we have. That's not because we are the best engineers, or because we write it with the utmost care and attention to detail. It's because we're a total of 5 people (mostly a couple of years out of uni) looking at it. C, and other systems programming languages are greatly overrepresented in the corpus of software that is actually being combed through for bugs. Java and Cobol are heavily underrepresented.

I want to make this clear again. I work in banking. If 2008 showed us anything it's that banking underpins most of our modern society so these quality issues are not unimportant, they can be devastating.

Re:Nvidia Security Team: “What if we just stopped using C?” by GeekyBear on Monday November 07, 2022 @02:59PM (#33511500)
> Believing that all software security problems would be solved if we got rid of C is a bigger disease than C itself.

According to studies done at Google and Microsoft, about 70% of their serious security issues are a result of memory safety errors.

>Around 70 percent of all the vulnerabilities in Microsoft products addressed through a security update each year are memory safety issues; a Microsoft engineer revealed last week at a security conference.

https://www.zdnet.com/article/microsoft-70-percent-of-all-se...

and

>Nearly 70% of the high severity security bugs in Chrome's code are memory unsafety problems, Google's engineers have revealed.

https://tech.hindustantimes.com/tech/news/70-of-security-bug...

Re:Nvidia Security Team: “What if we just stopped using C?” by lelanthran on Tuesday November 08, 2022 @03:15AM (#33517022)
As has been pointed out repeatedly whenever this statistic is brought up in discussion, that figure is not indicative of much.

And in discussions like this, it's verging on the dishonest - leading with a large number makes readers think that a large difference to bug count will result.

> Around 70 percent of all the vulnerabilities in Microsoft products addressed through a security update each year are memory safety issues; a Microsoft engineer revealed last week at a security conference.

What's the total bug count?

A codebase with 10000 bugs logged against it might have maybe 10[1] that are CVEs, of which, according to that statistic, only 7 would be fixed by moving to a safer language (either GC or Rust or similar).

That's just not enough motivation for switching when the payoff for preventing "70% of CVEs" is so small it may never even happen.

[1] I've worked on C codebases that were developed over a decade, and 1000:1 of all-bugs:memory-safety-bugs is a very conservative ratio. IME, it's been closer to 10000:1.

Re:Nvidia Security Team: “What if we just stopped using C?” by GeekyBear on Tuesday November 08, 2022 @04:28AM (#33517457)
> that figure is not indicative of much

Microsoft does not appear to agree.

>Mark Russinovich, the chief technology officer of Microsoft Azure, says developers should avoid using C or C++ programming languages in new projects and instead use Rust because of security and reliability concerns.

https://www.zdnet.com/article/programming-languages-its-time...

Re:Nvidia Security Team: “What if we just stopped using C?” by stubish on Monday November 07, 2022 @09:27PM (#33515256)
Nobody believes that all software security problems will be solved if we get rid of C. Nobody. Absolutely nobody. Really.

What people do believe is it would remove whole classes of security problems that affect everybody. Even if you have software running in excel macros. Maybe in your environment that is a minority of your problems. That is probably not a good thing, and we feel for you, and respect preferring to tackle that problem first. But it would be a good idea to not entrench C further while you are doing that. Once you shrink your attack surface, it would be great if the code being invoked doesn't have exploitable memory overflows to make all your hard work pointless.