News for hackers. Stuff that matters.
Re:The Insecurity Industry by 3pt14159 on Monday July 26, 2021 @08:25PM (#27967204)
I'm not going to comment on Snowden's view of what liberal western states do when it comes to surveillance. I have my own opinion, but he's been right about stuff I'd disagreed with him in the past before so I'm gun shy about confronting his ideas again.

On the topic of unsafe language though, he's absolutely right. We don't have to put up with this. We could pass a law and ban new code in unsafe languages from national security threatening devices like phones or cyberphysical devices like self-driving cars and we would be the better for it in under a decade. We could even have taxes to give breathing room during a transitionary period to encourage it before outright banning it, but we don't. We don't because so often it is less of a hassle for the government to trust the private sector that it is to take some real position on the regulatory issues that matter. This will probably always be the case until the government is able to evaluate talent and pay salaries in accordance with that talent as the private sector is.

Re:The Insecurity Industry by Hermitian909 on Tuesday July 27, 2021 @12:21AM (#27968562)
As a professional software engineer I'm not sure the idea of "safe" or "unsafe" programming languages is a coherent idea, or if it is then all languages are unsafe in my eyes.

Yes C/C++ have more footguns than Java but there's no "hard line" in the safety differences and there are real and important things that need doing that it's not always clear can be reasonably done in another language.

If you haven't, I'd encourage you to read the paper "Some Were Meant For C"[0] on why C still doesn't have a real replacement (though it could in the future).

[0] https://www.cl.cam.ac.uk/~srk31/research/papers/kell17some-p...

Re:The Insecurity Industry by nine_k on Tuesday July 27, 2021 @01:38AM (#27968998)
Certainly there's no boundary that clearly delineates "safe" and "unsafe" languages.

But certain languages (like C and C++, for instance) have built-in footguns. They were built in for various important reasons, but right now many of these reasons are not as pressing anymore. We can take something like Ada, Rust, OCaml instead, or at least use the extensive tooling that allows to statically check programs written in (a rather wide subset of) C and detect great many classical pitfalls.

So I'd say that it's not about safe languages, but mostly about safe methods of development for critical software, methods that remove large classes of defects that are commonly exploitable.

This, of course, can be only one layer of protection; the OS and the hardware design should also do their part. Advanced devices, like desktop and phone CPUs, have some very good hardware features for protection, like MMUs, w^x bits for RAM pages, secure enclaves, etc. Simpler devices (like IoT SoCs) often don't, and they can be potentially cracked into more easily.

Re:The Insecurity Industry by Karrot_Kream on Tuesday July 27, 2021 @03:06AM (#27969486)
Then punish defects. Give programmers the freedom to define their semantic space, but make sure to punish profit-seeking entities for insecure behavior. It's not that simple of course (it's easier for FB to pay a fine than a startup, for example), but we need to enforce the cost of defects at the organization level. I mean, there's also a world where FB apologizes about how they "forgot" to remove `unsafe` from a part of Rust code.
Re:The Insecurity Industry by pjmlp on Tuesday July 27, 2021 @04:22AM (#27969956)
Definitly, liability needs to happen, sledgle with lawsuits hammer any company that doesn't take security seriously.
Re:The Insecurity Industry by throwaway210222 on Tuesday July 27, 2021 @05:19AM (#27970339)
Sledge with lawsuits and company that knowingly buys uncertified software.

Like the FAA does.

Never, ever going to happen in enterprise and consumer software.

Re:The Insecurity Industry by pjmlp on Tuesday July 27, 2021 @05:57AM (#27970582)
It already happens when that enterprise and consumer software is deployed in high integrity computing scenarios.
Re:The Insecurity Industry by Kalium on Tuesday July 27, 2021 @08:01AM (#27971405)
At the risk of being confrontational, show me a language without built-in footguns and we can talk. I've seen people fail to check their inputs in every language I've ever touched. I've seen people cobble together their own horrifically insecure SQL query builders. And so on.

Meanwhile, I have to argue with developers on a regular basis to convince them that they actually need to patch the libraries in their systems. Yes, even if they don't see an obvious exploit path. Yes, even if it's more work than drop-in-and-ship.

Getting them to use static analysis is a nightmare. Entirely too many developers view each finding as an attack on their style they can negotiate away.

As you so wisely and correctly say, we're at a point in time where we mostly have the tools to employ safer software development lifecycle methodologies. It is telling, then, how often we don't.

Re:The Insecurity Industry by swiley on Tuesday July 27, 2021 @06:07AM (#27970651)
They certainly started off that way but modern static analysis can catch a lot. Plus these other languages (yes, including Rust) are all still at least partly implemented in C/C++ so you cant outright ban it.
Re:The Insecurity Industry by roca on Tuesday July 27, 2021 @01:39AM (#27969001)
That paper has many problems. For example:

> There is no particular need to rewrite existing C code, provided the same benefit can be obtained more cheaply by alternative implementations of C

To be clear, those "alternative implementations" do not exist, and no-one actually working on C compilers or tools to make C code safer has been able to produce one, or even come up with a credible plan for producing one.

Re:The Insecurity Industry by h_anna_h on Tuesday July 27, 2021 @02:46AM (#27969373)
This is false. There are multiple safe C implementations. compcert and https://staff.aist.go.jp/y.oiwa/FailSafeC/index-en.html are two such.
Re:The Insecurity Industry by roca on Tuesday July 27, 2021 @03:12AM (#27969521)
Compcert is a verified compiler. It guarantees that the generated code does what the source code requires. It doesn't turn unsafe C programs into safe ones.

"Fail-Safe C" is a research project that has been dead for ten years. Note:

> Some benchmark results show that the execution time are around 3 to 5 times of the original, natively-compiled programs, in avarage

That overhead is actually a lot higher than similar projects I also consider failures, such as CCured.

To be clear, when we talk about "an alternative implementation of C", it needs to give similar performance and other properties (e.g. function and data interop) to other C compilers. You can't impose a 3-5x slowdown and say "look, C is safe".

Re:The Insecurity Industry by pjmlp on Tuesday July 27, 2021 @04:25AM (#27969970)
Actually that is what Oracle did with SPARC ADI, Google/ARM are pushing for with MTE, Apple is trying to do with PAC, Microsoft with Phonon.

When everything else fails, kill the bug with hardware memory tagging spray.

Re:The Insecurity Industry by h_anna_h on Tuesday July 27, 2021 @12:33PM (#27974385)
The CompCert C reference interpreter aborts execution on undefined behavior.

> To be clear, when we talk about "an alternative implementation of C", it needs to give similar performance and other properties (e.g. function and data interop) to other C compilers. You can't impose a 3-5x slowdown and say "look, C is safe".

Pretty much every language (except rust) which claims to be "C but safe" has the same issue, except you have to rewrite your program in it.

Re:The Insecurity Industry by the_why_of_y on Tuesday July 27, 2021 @05:38PM (#27977980)
> The CompCert C reference interpreter aborts execution on undefined behavior.

A C interpreter is not exactly the sort of thing that the embedded software industry has been waiting to deploy in production.

Re:The Insecurity Industry by trasz on Tuesday July 27, 2021 @03:28AM (#27969617)
Re:The Insecurity Industry by roca on Tuesday July 27, 2021 @04:28AM (#27969990)
CHERI is far more than just an "alternative implementation of C". It includes a completely different hardware platform and replacing all your hardware can hardly be considered "cheap".
Re:The Insecurity Industry by trasz on Tuesday July 27, 2021 @05:12AM (#27970301)
It's many orders of magnitude cheaper than replacing all your software.
Re:The Insecurity Industry by staticassertion on Tuesday July 27, 2021 @06:24AM (#27970743)
You can't just adopt that hardware and get memory safety. The hardware is providing support for a capabilities model, which you then have to adopt at a software level both within your OS, compiler, and application code. This also would break C and C++ ABIs, so it's very unlikely to get adopted for a number of cases.

Further, CHERI is not enough to achieve temporal memory safety, it only provides the primitive that one could use to implement an efficient, correct tracing GC.

Perhaps most importantly, one can not use CHERI today. It is just not an option. Memory safe languages exist, and have existed for quite some time.

Pointer tagging and other approaches like CHERI are very promising. Keeping in mind of course that they double the size of pointers and have a global runtime performance cost. Less ambitious but otherwise similar mitigations are already being adopted.

Re:The Insecurity Industry by trasz on Tuesday July 27, 2021 @07:25AM (#27971109)
Indeed, you need the whole stack. However, the (non-temporal) memory safety alone is still quite easy to get - the compiler will take care of it, as a programmer you just need to make sure your code doesn't get in the way by eg manually stashing pointers into non-pointer types. It's been demonstrated on large, real-world code bases, such as FreeBSD and PostgreSQL.

(Disclaimer: been there, done that, part of the CHERI team)

Re:The Insecurity Industry by staticassertion on Tuesday July 27, 2021 @11:00AM (#27973260)
Yep, much of the wins look to be a matter of just recompiling, which is great. I'm a big fan of these pointer tagging techniques in general. I just want to be clear that pointing at CHERI and going "See? We already have memory safe C and C++" is glossing over some important details.

Best of luck with the research, I'm quite bullish on the work.

Re:The Insecurity Industry by neolog on Tuesday July 27, 2021 @05:33AM (#27970419)
The author of that paper has written a safe C implementation.

https://github.com/stephenrkell/libcrunch

Re:The Insecurity Industry by roca on Tuesday July 27, 2021 @08:45AM (#27971744)
I applaud him for giving it a go, but it's far from complete ... no use-after-free protection at all yet, for example.
Re:The Insecurity Industry by franga2000 on Tuesday July 27, 2021 @03:10AM (#27969513)
The line is far less blurry than you suggest. The stats from the article say 70% of vulnerabilities come from [insert list of a few memory-wrangling mistakes here]. I'd consider any language that enables the top 70% of vulnerabilities to happen to be unsafe.

Maybe a safety ranking is in order? How many CVEs from [year], weighed by severity, are impossible to happen in [language]. Obviously this idea has serious problems, but you see my point: C would get a straight up zero, as it should! (well, not completely zero, as many vulns come from dependencies and C's complete lack of a package and dependency system is actually an advantage here)

Re:The Insecurity Industry by lionkor on Tuesday July 27, 2021 @03:58AM (#27969804)
An statistical approach like that has the flaw any the most used language would always appear to be at the top of the "most unsafe".

Instead, people should be schooled to write better code. Thats it. Don't let some random new employee with no certifications write safety-critical code. Don't hire people who are under qualified. Its really that easy.

I have no idea, honestly, how you would introduce a use-after-free bug with C++'s smart pointers. Its the lack of schooling, the lack of certification, and the lack of a safety-focused selection of applicants, not a language that you can write bad code in if you ignore all warnings and advice.

Even rust has unsafe{}, but I dont see anyone complain when thats used to introduce safety issues, because "youre not supposed to do that, even though technically you could".

You can have all the safety mechanisms in a language, but you need control, too, and anyone who is completely unqualified will use that to break something.

Re:The Insecurity Industry by michaelt on Tuesday July 27, 2021 @04:43AM (#27970100)
> Don't hire people who are under qualified. Its really that easy.

I understand what you're saying, but I'm not sure I agree.

For example, look at Google Chrome. They've got mountains of cash. They've got loads of people working for them, and loads of job applicants if they want more. They've got a strong business case to work on security. They've got in-house pen testers, and a bug bounty program. They've got code reviews. They can afford any static analyser on the market. They've got sandboxing. They've got open source so many eyes can spot bugs easily. They can dictate terms on requirements - if Chrome vetos a new web standard and it's as good as dead, and if Google decides plugins have got to go, they go.

And they've got 177 CVEs so far in 2021 [1] - including such greatest hits as use-after-free, buffer overflows and out-of-bounds access.

You and I think we're writing secure C++ - but if the best-resourced team in the world can't write secure C++, isn't it more likely we're just fooling ourselves?

[1] https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=chrome

Re:The Insecurity Industry by sat0ri on Tuesday July 27, 2021 @05:59AM (#27970599)
So many CVEs are due to their bug bounty program, hackers are incentivized to sell vulnerabilities to Google rather than exploiting them. CVEs are publicly disclosed after they are fixed, of course.
Re:The Insecurity Industry by cartoonworld on Tuesday July 27, 2021 @07:01AM (#27970975)
The CVEs are due to the bug reporting, the bugs are not.

The point is that memory safety bugs are the gift that keeps on giving.

You can throw as much money into the problem as you want, and the inherent complexity of memory management means you are still gonna ship bugs of all severity.

Re:The Insecurity Industry by staticassertion on Tuesday July 27, 2021 @11:24AM (#27973554)
You could have made that argument a few years ago, before we started to see in-the-wild exploitation of these vulnerabilities.
Re:The Insecurity Industry by lionkor on Tuesday July 27, 2021 @05:34AM (#27970430)
You make a good point. There is a lot of evidence that it's not as easy as I make it seem.

I might be wrong about this, too, but I think a lot of smaller companies have the really bad practices. Google shines as one of the major "suppliers" of C++ tooling, and their code quality is undeniably very high (considering the complexity of some of their codebases), but a lot of popular libraries are written by small teams, often not even under contract, and you end up with a lot of PR'ed stuff, which is great, but it needs to be thoroughly reviewed.

A good example of "unqualified" PR's was that recent one with the malicious PR into the linux kernel by some university. It was caught, but it does make you wonder how many vulnerabilities make it through because of simply trusting "random unqualified people" too much.

Re:The Insecurity Industry by GoblinSlayer on Tuesday July 27, 2021 @08:09AM (#27971462)
>You can have all the safety mechanisms in a language, but you need control, too, and anyone who is completely unqualified will use that to break something.

That's needless extremism, moderate programmers benefit from safety mechanisms, and you can't hire a lot of perfect programmers.

Re:The Insecurity Industry by staticassertion on Tuesday July 27, 2021 @02:09AM (#27969179)
> As a professional software engineer I'm not sure the idea of "safe" or "unsafe" programming languages is a coherent idea, or if it is then all languages are unsafe in my eyes.

I agree, though that's not intractable. There's security compliance like ISO27001, which can't say "you're secure", but can say "you've got a threat model and you take measures to address it". It's then something you document and provide evidence for as part of your compliance obligations.

If we applied the same thing to a programming language I think it could be very clear to see the differences between languages.

That's not at all to say that I think ISO27001 is a good model for security, just that we already have systems that handle very nuanced ideas, so a formal definition, or proof, etc, is not really as necessary as it may seem.

Re:The Insecurity Industry by mark_l_watson on Tuesday July 27, 2021 @09:26AM (#27972112)
I agree with this article’s criticism of managed languages (Java, C#) for systems programming, but the author does not convince me that Swift and Rust would not be much, much better to build safe(r) systems and infrastructure software.
Re:The Insecurity Industry by GoblinSlayer on Tuesday July 27, 2021 @04:17AM (#27969914)
Even in confines of C there are coding conventions with lower bullrun compatibility and there are some projects that use them: putty and s2n use them with C, grpc library uses it with C++. Fat pointers are in talks since 80s and are cheaply implementable, meanwhile Fuchsia, an allegedly new codebase, is written in old good 70s vanilla C as if PDP-7 is still hot.

As for the article, the dream to get all UBs right without a systematic approach is idealism.

Re:The Insecurity Industry by pjmlp on Tuesday July 27, 2021 @08:24AM (#27971561)
I advise you to update your Fuchsia knowledge, it is written in a mix of C++, Rust and Dart nowadays.
Re:The Insecurity Industry by platinumrad on Tuesday July 27, 2021 @01:46AM (#27969039)
You have an awfully rosy view of how regulation of programming languages would play out. What will happen (and this is already de facto the case in many "safety-critical" industries) is that Rust is banned and everyone is forced to write straightjacketed C89 and C++03. There's already a congressman on the record complaining about a "native Nigerian" committing code to Rust.
Re:The Insecurity Industry by littlestymaar on Tuesday July 27, 2021 @02:17AM (#27969224)
> There's already a congressman on the record complaining about a "native Nigerian" committing code to Rust.

Wow. It comes from the Libra hearing I guess? By any chance, do you have an link to the exact quote?

Edit: as hsod answered below (I don't really get why this answer was flagged) the congressman isn't really “complaining” and it's not about a Nigerian committing to Rust, but to Libra itself.

Re:The Insecurity Industry by hsod on Tuesday July 27, 2021 @02:46AM (#27969374)
It’s around 30 seconds of this clip https://www.c-span.org/video/?c4808083/user-clip-rust-langua...

“I went ahead and did a GitHub search on who’s actually leading the development on the Libra core side and it looks like, I think it’s gonna be international because it looks like a native Nigerian that’s actually building the actual Libra core in front of the code development of Libra core” - congressman Denver Riggleman (R-VA)

He lost his seat in 2020

Re:The Insecurity Industry by roflc0ptic on Tuesday July 27, 2021 @08:45AM (#27971739)
It's an unsettling combination of literacy and illiteracy there.
Re:The Insecurity Industry by flatline on Monday July 26, 2021 @11:43PM (#27968378)
I had never thought of passing legislation against unsafe languages. It sounds like the type of thorny legislative issue that leaves you with a half broken system, like all the cookie notices that currently abound. Nice in spirit, impossible in practice. Regulation could be more sensible but it’s all in the enforcement. There’s nothing preventing organizations from adopting safer coding languages and practices right now, a little incentive may help a bit but I think only so far.
Re:The Insecurity Industry by yashap on Tuesday July 27, 2021 @01:32AM (#27968974)
Would you refuse to use Postgres, the Linux kernel or SQLite because they’re all written in C?

Certainly C and C++ have more footguns than many other languages, but highly insecure as well as highly secure software gets written in all languages. I think coming up with better/easier avenues for digital-security-breach related lawsuits and fines is a better idea than banning specific languages.

Re:The Insecurity Industry by nine_k on Tuesday July 27, 2021 @01:43AM (#27969023)
Funny that you ask: Linux kernel rather actively embraces experimental code written in Rust.

And yes, for a really critical system I might consider taking something much simpler and potentially slower but formally proven correct, like seL4.

Google is working on Fuchsia as a new phone / chromebook OS, and it's very much focused on bulletproof security.

Re:The Insecurity Industry by Ieghaehia9 on Tuesday July 27, 2021 @04:31AM (#27970022)
> And yes, for a really critical system I might consider taking something much simpler and potentially slower but formally proven correct, like seL4.

One of seL4's points is that security can still be fast, no?

From https://docs.sel4.systems/projects/sel4/frequently-asked-que...

>To the best of our knowledge, seL4 is the world’s fastest microkernel on the supported processors, in terms of the usual ping-pong metric: the cost of a cross-address-space message-passing (IPC) operation.

Re:The Insecurity Industry by nine_k on Tuesday July 27, 2021 @07:52AM (#27971330)
Yes.

But within the Linux kernel, you might not need that cross-process IPC at all, so if you're into squeezing every last microsecond of latency, you likely want your entire app running as a monolith in kernel mode.

But if you want security more than top speed, seL4 + a few daemons you write for other OS needs must be fine.

Re:The Insecurity Industry by conradev on Tuesday July 27, 2021 @01:58AM (#27969099)
While Fuschsia's microkernel architecture has a lot of security benefits, the microkernel (Zircon) is still written in C++
Re:The Insecurity Industry by littlestymaar on Tuesday July 27, 2021 @02:22AM (#27969242)
Related:

> Our kernel, Zircon, [is not in Rust](https://twitter.com/cpuGoogle/status/1397265884251525122). Not yet anyway. But it is in [a nice, lean subset of C++](https://fuchsia.dev/fuchsia-src/development/languages/c-cpp/...) which I consider a vast improvement over C.

https://blog.cr0.org/2021/06/a-few-thoughts-on-fuchsia-secur...

Re:The Insecurity Industry by pjmlp on Tuesday July 27, 2021 @04:30AM (#27970011)
For the time being yes.

They are now starting to rewrite OS components in Rust, and I wouldn't be surprised if that happens to Zircon as well, it stared as a C anyway, and thus already suffered one rewrite.

Re:The Insecurity Industry by nine_k on Tuesday July 27, 2021 @07:59AM (#27971388)
s/suffered/enjoyed/

A rewrite usually improves a lot of small things that were found in the previous version. It's like a new major version, even if it does not add new major features.

It's an expensive undertaking, though.

Re:The Insecurity Industry by pjmlp on Tuesday July 27, 2021 @08:10AM (#27971480)
Thanks, if you watch the Fuchsia tour session, they hint at some of the rewriting taking place.

https://www.youtube.com/watch?v=gIT1ISCioDY

Re:The Insecurity Industry by otabdeveloper4 on Tuesday July 27, 2021 @03:28AM (#27969620)
> Linux kernel rather actively embraces experimental code written in Rust

False. Which broken telephone did this come from? The Linux kernel has 0% Rust code in it and has no plans to change that.

Re:The Insecurity Industry by GauntletWizard on Tuesday July 27, 2021 @04:18AM (#27969917)
https://lore.kernel.org/lkml/20210704202756.29107-1-ojeda@ke... - A patch to include experimental rust support, with support from Linus; I believe it's in the latest mainline HEAD.
Re:The Insecurity Industry by otabdeveloper4 on Tuesday July 27, 2021 @05:44AM (#27970496)
Read my post again. There is 0% Rust code in the Linux kernel at the moment, and no plans to change that.

(And no, "including experimental Rust support" isn't a plan to change that.)

You don't need Rust to compile the kernel. What's changed now is that you could theoretically write a kernel module in Rust. (But you can, e.g., write a kernel module in C++ too, I've done it before.)

Re:The Insecurity Industry by yashap on Tuesday July 27, 2021 @10:26AM (#27972822)
As another commenter noted, there’s no Rust code currently in the Linux kernel. There may be some soon, but not much - it’ll be a dominantly C codebase for a very, very long time, maybe forever.

As for seL4, doesn’t that just support my point that highly secure software can be written in any language, even C? seL4 is primarily implemented in C. There “executable spec” is written in Haskell, but the actual kernel that people use is written primarily in C and a little Assembly.

Re:The Insecurity Industry by MichaelMoser123 on Tuesday July 27, 2021 @01:48AM (#27969045)
Where is your legislation supposed to draw the line? In Rust you need to have occasional unsafe code - you can't even have a double linked list or bidirectional graph without unsafe code. Would you also outlaw jni calls in java?
Re:The Insecurity Industry by staticassertion on Tuesday July 27, 2021 @02:24AM (#27969259)
The way this would likely end up being handled is the same as any other compliance.

You define the threat model for your application and then justify why you're safe. In this case we'd be adding an explicit point to ensure that there are controls for attackers who can exploit memory safety issues.

You could end up with controls like:

1. We sandbox our code, so even though it's C we feel that we're safe

2. We use a memory safe language to reduce the risk of memory safety issues

3. We sanitizer inputs before providing them to the program

etc etc

What ends up being accepted as legitimate would be up to the auditors/ generally a matter of consensus.

Re:The Insecurity Industry by MichaelMoser123 on Tuesday July 27, 2021 @09:16AM (#27972024)
would that imply that the state would have to review the design and implementation of every system under their jurisdiction? I think that would be a bit heavy for everyone involved.
Re:The Insecurity Industry by staticassertion on Tuesday July 27, 2021 @10:56AM (#27973215)
This is already the case.
Re:The Insecurity Industry by FractalHQ on Tuesday July 27, 2021 @02:26AM (#27969271)
Can’t unsafe Rust (when properly isolated) exist within a larger codebase that, as a whole, can still be considered safe?
Re:The Insecurity Industry by lionkor on Tuesday July 27, 2021 @04:02AM (#27969827)
The same way you can write safe modern C++ and only use unsafe features of the language when its necessary and isolated, but thats also considered unsafe, so Rust should be, too
Re:The Insecurity Industry by pjmlp on Tuesday July 27, 2021 @04:27AM (#27969988)
My experience with trying that in Visual C++, alongside the C++ Core Guidelines and "borrow checker" static analysers, is that there is what we wish to happen, and how the code actually looks like in reality.
Re:The Insecurity Industry by lionkor on Tuesday July 27, 2021 @05:27AM (#27970388)
I find that, if you enable all warnings, most as errors, and use clang-tidy and cppcheck, you end up with an incredibly powerful safe language. Now, combine that with some good patterns and avoidance of NIH syndrome, and you can get very far while keeping the huge amount of control and libraries that C++ gives.

Edit: And, of course, a lot of forced static typing and avoiding global scoped stuff. So, for example, you'd make a

    struct Meter {
        float value { 0.0f };
    };
    Meter wall_length;
instead of `float wall_length; // meters`.
Re:The Insecurity Industry by pjmlp on Tuesday July 27, 2021 @05:56AM (#27970573)
Even if we constrain ourselves to clang-tidy and cppcheck, and the platforms where they are supported, you can only assert that to your own code, and eventually third party libraries in source code.

Then even if you find issues in those third party code libraries, there is the issue of if you are allowed to change them yourself, or how those fixes get provided by the library vendor, warranties and so on.

Re:The Insecurity Industry by zbyforgotpass on Tuesday July 27, 2021 @02:51AM (#27969399)
Instead of banning unsafe languages how about allowing for tort liability for software? There is a big difference in law between software and other engineering like building bridges. It used to be that software failures were not as severe as a collapsing bridge - but we are close to the point where it reverses.
Re:The Insecurity Industry by Seirdy on Tuesday July 27, 2021 @03:36AM (#27969675)
Would you consider assembly to be unsafe? High-level software written with low-level languages like this includes:

- Decoders and encoders for video, images, and audio - graphics libraries - Many parts of fast cryptographic libraries

This is typically for performance-related reasons.

Re:The Insecurity Industry by SV_BubbleTime on Monday July 26, 2021 @11:38PM (#27968353)
If there is one thing politicians are surely better at it than programmers is making decisions about what programming languages should be used! /s

Yes on theme, but no on ”there aught to be a law” that bans C/C++ because of an evolving goal of memory safety.

When Rust++ comes out surely there will be people complaining that Rust isn’t safe, and so on.

Best case is you make the consequence punishable (as was described in the article).

Re:The Insecurity Industry by rapsey on Tuesday July 27, 2021 @04:06AM (#27969850)
> If there is one thing politicians are surely better at it than programmers is making decisions about what programming languages should be used! /s

Programmers aren't that good at it either.

Re:The Insecurity Industry by mikepurvis on Tuesday July 27, 2021 @12:15AM (#27968542)
Other industries handle this kind of thing with a layer of indirection: instead of laws from the state, the state imbues a professional body with certification power, and the body sets standards by consensus or whatever other process among their members. So if you're an architect, or lawyer, or tradesperson, or whatever, you have to do things in the manner prescribed or you lose your license.

I know this kind of thing is a lightening rod for a lot of software folks, but it does have the nice property that it's proactive; you don't have to wait around for the obviously-unsafe practice to blow up in someone's face before you can do something about it.

And no one wants to have to get licensed to write some crud app in NodeJS. But maybe these kinds of high-stakes modules related to encryption, security, and so on could be a place to start with it; if you're going to work in these areas, and offer your work to the public (for money or otherwise), then you either need to be licensed by the professional body, or clearly advertise in the header of each file that the work has not be overseen by a licensed professional.

That's the kind of arrangement that could do things like specify languages, methods, interfaces, and so on.

Re:The Insecurity Industry by dylan604 on Tuesday July 27, 2021 @12:53AM (#27968781)
Anytime gov't gets involved though, you have to consider how the lobbiest will get involved. So a proponent with deep pockets that is thouroghly entreched with a language about to be "banned" decides to hire a lobbiest to convince these "well educated in all things" gov't reps. Yet proponents of "safe" languages have no cash to spend. Which language is going to get banned then?
Re:The Insecurity Industry by NavinF on Tuesday July 27, 2021 @02:05AM (#27969153)
Yep, and what happens when the committee (perhaps correctly) chooses a proprietary language as the safest language? Anyone making essential software would end up writing code like this: https://i.imgur.com/8S6JbDS.png (labview; Haven't used it in 10 years, but I'm pretty sure it is 100% memory safe)

Don't worry, the pricing will be FRAND (fair, reasonable, and non-discriminatory). You just won't be able to see the compiler and runtime sources or follow stack traces into stdlib code. For security reasons. Defense in depth, y'all.

Re:The Insecurity Industry by mikepurvis on Tuesday July 27, 2021 @10:11AM (#27972672)
But the point of this is that it isn't the "government involved." As with other professional pursuits, the government says "we don't have the desire, expertise, or agility needed to make these decisions in-house, so we designate this organization to be our regulator of it."

For example, here's the Professional Engineers Act in Ontario: https://www.ontario.ca/laws/regulation/900941

None of it has anything to do with which tools or methods are used for the practice of engineering— it's all defining jurisdiction and constitutional meta-details about how the leadership is to be selected, term lengths, etc.

So no one can achieve regulatory capture about what kind of concrete is to be used in bridges in Ontario by lobbying the Ontario government; you'd have to lobby the PEO. Maybe your argument is that they're effectively equivalent, but they're really not— the PEO is a pretty different kind of organization from just another government office.

Re:The Insecurity Industry by dylan604 on Tuesday July 27, 2021 @10:14AM (#27972713)
>"we don't have the desire, expertise, or agility needed to make these decisions in-house, so we designate this organization to be our regulator of it."

Yes, because this has stopped them doing dumb things before. The gov't will still be in charge of selecting the people in the regulator. The lobbiest will still have influence. There's just no way around it.

Re:The Insecurity Industry by mikepurvis on Tuesday July 27, 2021 @10:23AM (#27972795)
Can you please supply examples from law, medicine, trades, engineering, etc where you feel that lobbying of the government has led to the kind of outcomes you're envisioning?
Re:The Insecurity Industry by dylan604 on Tuesday July 27, 2021 @11:14AM (#27973432)
Texas' ERCOT. It's a government appointed regulation body, not a branch of gov't.

Are you really doubting that this is something that "might" happen?

Edit: FAA allowing Boeing to self-certify 737MAX. FDA allowing/not allowing trials of drugs, or allowing a drug meant for one thing to be tried for something else totall untested (ex: AZT).

Re:The Insecurity Industry by mikepurvis on Tuesday July 27, 2021 @11:28AM (#27973606)
I'm not doubting that it might happen and may even actually happen in some cases. I'm asserting that society and government is built on compromises and a principle of taking the path of least harm. We shouldn't avoid a 90% solution because we can imagine possible flaws in it, particularly if we have close analogues already deployed in the real world and those flaws don't largely seem to manifest.

I don't know that bodies like FAA and ERCOT are really comparable to professional associations; the market conditions make them especially vulnerable to corruption because they both "oversee" such a small number of large players, so you end up with a revolving door. In any case, these are also odd examples to bring up, because in both cases their failure was not about market capture, it was about failure to protect the public. So it seems your argument is amounting to "the regulation provided by the FAA isn't perfect, so it shouldn't exist, just like regulation for security-critical software shouldn't exist."

I specifically asked for examples from "law, medicine, trades, engineering", because those are cases that I feel are much more aligned to what it would be with a professional body overseeing practices for secure software development— they're cases where you have a large number of mostly small-time practitioners, and where the professional oversight mechanism is working in terms of enforcing safe and consistent practices, while also evolving those over time in response to changing conditions.

Re:The Insecurity Industry by dylan604 on Tuesday July 27, 2021 @11:55AM (#27973912)
>the regulation provided by the FAA isn't perfect, so it shouldn't exist

This is far from what I'm suggesting. I'm just saying that if it is a gov't regulated anything, those regulations will incur wacky decision making due to the influence of outside money. Nobody likes to be regulated against, and if they are in the position to do so, they will use any mechanism available to them to keep the status quo.

I'm also suggesting that any gov't regulation body is not always the panacea people may be dreaming it will be. Anytime a regulation body is proposed, I don't have rose colored glasses. I'd rather be pleasantly surprised that something turns out to be a good thing than having high expectations crushed.

Re:The Insecurity Industry by mikepurvis on Tuesday July 27, 2021 @12:52PM (#27974622)
But despite your cynicism about "any gov't regulation body", you would agree that professional associations have by and large been a success in protecting the public in areas like construction trades, engineering, law, and medicine?
Re:The Insecurity Industry by dylan604 on Tuesday July 27, 2021 @01:40PM (#27975244)
Not necessarily. Recently, Miami condo collapes. In the not too distant past London building fire. I'm sure if we were to go looking, we could find more examples. Are these edge cases?

I have less experience with other trades, but you did call out construction separately. My family comes from construction backgrounds at various levels. The 80s in the US saw a boom in the 20 story building construction, and then saw a total collapse (no pun intended) in the construction industry. There are lots and lots of building contracts won by lowest bidder, and the only way to do that is cutting corners somewhere. Usually in quality of material, or reducing the "over-engineered" portions to the point of risking saftey, etc.

It's also widely known in construction that the permitting offices can be gamed. Talk to the right people with the write phrases. NYC is infamous in that people playing by the rules get absolutely nowhere. You have to start spending cash and using influence to get things done. It's all just pointless to being corrupt.

Re:The Insecurity Industry by mikepurvis on Tuesday July 27, 2021 @02:16PM (#27975650)
Interesting. I would see the occasional failure as actually a further indication that the system is working— that it's maintaining a balance wherein most practice is within the bounds of what is safe, but it's not NASA-level lockdown where there's massive waste due to unnecessary redundancy and safety factors.
Re:The Insecurity Industry by platinumrad on Tuesday July 27, 2021 @01:49AM (#27969046)
Green Hills with its decades of DoD contracts versus the left wing browser company. Gee I wonder who would win?
Re:The Insecurity Industry by matheusmoreira on Tuesday July 27, 2021 @08:55AM (#27971824)
Safer languages like Rust are awesome but cannot solve all of these problems.

Code reflects the programmer's understanding of the world. If this understanding is flawed, the logic will also be flawed.

Re:The Insecurity Industry by RandomLensman on Tuesday July 27, 2021 @03:13AM (#27969528)
Even if we could clearly differentiate between "safe" and "unsafe" languages, what use cases and devices go on the list?

Would phones really be that high up given that in environments with high security standards usually people are not allowed to carry them? What about home appliances? Could a state actor hack a bunch of stoves and burn the houses down?

I can easily see some huge bureaucracy being put in place without much benefits ("Federal Programing Language Commission"?).

Most high security environments have a physical component, why not learn from there? Phones could just have a physical switch to cut off microphones and antennae for example, much easier to do than trying to police millions of lines of codes to be secure.

Re:The Insecurity Industry by 7373737373 on Tuesday July 27, 2021 @03:33AM (#27969656)
"Why KeyKOS is fascinating" - https://github.com/void4/notes/issues/41
Re:The Insecurity Industry by rapjr9 on Tuesday July 27, 2021 @01:49AM (#27969049)
C and C++ are really versatile, why are there no safe libraries for them (or are there?). If you want to make buffer overflows impossible then add a library that does so and use it. If you want safer memory handling use a library. Or extend C and C++ with standard libraries that are safer to use. Java is implemented in C so anything Java can do, C can do. Many languages are actually implemented in C.

What is this fascination with creating a new language every time we want to add some features? Is it the fame of creating and naming your own computer language? From a security perspective creating a new language reduces security because it will never have been as thoroughly vetted as the old languages.

Re:The Insecurity Industry by roca on Tuesday July 27, 2021 @01:52AM (#27969071)
Because safety requires that the language prevent you from doing things and libraries don't have much ability to do that.

Example: C++ shared_ptr gives you reference counting which helps prevent use-after-free errors. However, shared_ptr can't stop you getting a raw pointer or reference to the underlying object, which can then be used to trigger a use-after-free bug.

Re:The Insecurity Industry by staticassertion on Tuesday July 27, 2021 @01:57AM (#27969095)
Saying that Java is safe therefor you can write safe C is not actually sensible. The JVM is a virtual machine that runs user's programs, and those programs are in a memory safe language. That doesn't mean the JVM is memory safe... at all.

It's like saying "llvm is in C++, and llvm is used to compile Rust, therefor C++ is as safe as Rust". It's just not a tractable argument.

As for the rest of your post, sure, you can create a new revision of C/C++ that's memory safe - feel free to do so. It'll basically be a new language, but that's fine and has nothing to do with the parent's point, which is that we should incentivize memory safety - they didn't say it had to be a new language.

As for why people don't take that approach, it's because: it'll be a massive breaking change, so it's really no different from a completely new language. If you're going to create a completely new language you may as well take the time to fix a bunch of other issues while you're there.

edit: The above applies to libraries too. There are libraries that enforce stronger security in C++ (I want to say... IronC++? Something like that), and it basically ends up being, give or take, the cognitive overhead of a new language, but with the added bonus of no one actually using it.

> From a security perspective creating a new language reduces security because it will never have been as thoroughly vetted as the old languages.

This is unsubstantiated, and I highly doubt it is the case.

Re:The Insecurity Industry by h_anna_h on Tuesday July 27, 2021 @03:00AM (#27969442)
You can actually make a safe C implementation without creating a whole new language, see my other post https://news.ycombinator.com/item?id=27969373
Re:The Insecurity Industry by wydfre on Tuesday July 27, 2021 @05:21AM (#27970349)
What he is referencing is what I call “artificial complexity”, a way for making solving problems ludicrously wasteful in man-hours. This is primarily accomplished via limiting remixes of known technology - think for example of how easy it is to add types to Lisp and yet it took decades to be attempted publicly.

It is the job of human intelligence to cause ‘discontention’ - discontent and contention. I like to think of how it as how you can make powerful gears almost seize if you understand their weaknesses properly.

Re:The Insecurity Industry by fouric on Tuesday July 27, 2021 @11:02AM (#27973281)
> We could pass a law and ban new code in unsafe languages

I can tell you exactly how this will end up: like PCI DSS.

Re:The Insecurity Industry by throwaway210222 on Tuesday July 27, 2021 @05:15AM (#27970311)
> We could pass a law and ban new code in unsafe languages from national security threatening devices

Countries already do this. But they also put exemption clauses in the policies.

Ban exemptions (in all policies) first if you want to make progress.

But you won't like it.

Re:The Insecurity Industry by raxxorrax on Tuesday July 27, 2021 @10:54AM (#27973187)
This is unnecessary regulation and not a good idea. Would that also apply to runtimes, interpreters and compilers?

Liability should be created where when you expose third party data. That would disincentivise data collection massively.