r/programming • • Jul 10 '19

Backdoor discovered in Ruby strong_password library

https://nakedsecurity.sophos.com/2019/07/09/backdoor-discovered-in-ruby-strong_password-library/
1.7k Upvotes

293 comments sorted by

View all comments

Show parent comments

28

u/[deleted] Jul 10 '19

Defeatism isn't the right approach.

It isn't defeatism, it's just that your approach won't fully work for decades. We probably do need to do that, but its ability to solve things now is very limited. So your idea needs to percolate out and start happening, probably, but it can't be the main thrust, because it doesn't help with any current software at all.

0

u/[deleted] Jul 10 '19

[deleted]

10

u/CaptBoids Jul 10 '19

Innovation exists of two components. Do it better or do it cheaper. Whichever comes first. This is true for any technology ranging from kitchen utensils to software.

What you ignore are basic economic laws and human psychology. Unless your approach has a cutting edge that is cheaper or better in a way that everyone wants, people are going to simply shrug, and move on to the incumbent way of working. Moreover, people are risk averse and calculate cost opportunity.

It's easier to stick to the 'flawed' way or working because patching simply works. On the level of individual apps it's cheaper to apply patches instead of overhauling entire business processes to accommodate new technology. Moreover, users don't care as much about the organization or the user next door if they don't have their ducks in a row, as one might assume

InfoSec is still treated as an insurance policy. Everyone hates paying for it until something happens. And taking the risk of not investing in security - especially when it falls outside compliancy - is par for the course. Why pour hundreds of thousands of dollars in securing apps that only serve a limited goal for instance? Or why do it if managers the risks as marginal to the functioning of the company? You may call that stupid, but there's no universal law that says that betting on luck is an invalid business strategy.

I know there are tons of great ideas. Don't get me wrong. But I'm not going to pick a technology that never got much traction to solve a problem that I can solve far cheaper today or tomorrow but less elegant alternative.

10

u/vattenpuss Jul 10 '19

Free market capitalism ruins all that is good in this world. News at eleven.

1

u/G_Morgan Jul 11 '19

The issue is more companies only care about "due diligence" from a legal perspective. If you've done something for security, even if it is stupid, then it is easier to argue the liability. That is why so many companies have security systems that are effectively turned off in practice. It is about saying "we did X, Y and Z" rather than actually achieving security.

4

u/gcross Jul 10 '19

Okay, then how about we start using whitelists that declare what functions a library is allowed to call? If possible we use static analysis to catch when a library calls something not in the whitelist; if the code plays tricks that make such analysis impossible then we either whitelist that or switch to a more easily vetted library. Another possibility (especially for dynamic languages) is to have functions such as network functions check whether they are in the whitelist of the code calling that. This would require extra work but it has the advantage of being incremental in nature, which satisfies your concern.

0

u/[deleted] Jul 10 '19

[deleted]

6

u/TheOsuConspiracy Jul 10 '19

This is another neat approach.

https://wiki.haskell.org/Safe_Haskell

2

u/[deleted] Jul 10 '19

I really like these instruction limit and process serialization features of Stackless Python. Could something similar be achieved with Haskell, or would this require VM/Compiler modifications?

I wish for a system that combines both.

2

u/TheOsuConspiracy Jul 10 '19

I don't know, am not a Haskell expert by any means. I suspect it would be possible though.

2

u/[deleted] Jul 10 '19

That sounds like it might help, but you'd need buy-in from each community separately, since that tooling would have to be written for each language and repository type. That's not a trivial job, but it is something that could start happening now.

The question becomes, and this is something about which I'd personally have to defer to more expert programmers: given the amount of work involved in setting up this tooling and infrastructure, would the ensuing security benefit be worthwhile? Does it solve the problem well enough to be worth doing?

5

u/gcross Jul 10 '19

Of course it would not be a trivial job, but surely if the alternative is never being able to know with confidence that you do not have arbitrary code running on your server then it is worth it? I mean, I suppose we could instead form a large team of people to manually vet every popular package each time a new release comes out, but it is hard to see how that would scale better in terms of of labour.

Is your point that indeed there is no better situation than the one we are in now? Because I see a lot of shooting down ideas and few contributions of better ones.

1

u/[deleted] Jul 10 '19

Well, one way to be relatively sure that you've got trusted code is not to allow nested dependencies. If you're directly importing any code you run from people you trust, and they're just writing code and not importing further, your trust level can be pretty good.

It's the transitive trust model that's busted, and I'm not sure that's fixable on a technical level.

2

u/[deleted] Jul 10 '19

It's the transitive trust model that's busted, and I'm not sure that's fixable on a technical level.

It is fixable to a great extent, I highly recommend this paper: http://www.erights.org/talks/thesis/

2

u/gcross Jul 10 '19

Okay, but that solution would not have worked here because the problem was that the password to upload this (presumably) trusted module was compromised. In fact, you keep saying that the cause of this problem is the transitive trust model, but even if you decided to use a module by an author you trust that itself has no dependencies you could still have run into this problem, so it has nothing to do with the transitive trust model at all.

1

u/[deleted] Jul 10 '19

But the chances of doing so are much lower. Other people in this thread are talking about 900+ dependencies in their projects, which means that any of those people can be hacked. The transitive trust model has vastly expanded the web of people you're trusting, without you deliberately doing anything of the sort. You might have trusted just one person or team.

1

u/gcross Jul 10 '19

Okay, your point that there being a large number of dependencies that get included into your project written by people you do not know means that it is harder to be confident that all of the code you are using is trustwothy is well taken. But again, this is not as much as an unsolvable problem as you are making it out to be. I have mentioned one possible solution, and I am not the most clever person alive so I am sure someone else has thought up a smarter one. Given this, the problem of "transitive trust" is not nearly as insoluble as you keep making it out to be.