Backdoor discovered in Ruby "strong password" library, takes your "strong passwords" and uploads them into a pastebin https://nakedsecurity.sophos.com/2019/07/09/backdoor-discovered-in-ruby-strong_password-library/
Hi, do you believe me when I say we need ocap security yet
@cwebber You definitely make me think I should read up on ocap.
@liw Here's a good start: http://mumble.net/~jar/pubs/secureos/secureos.html
Imagine if instead of (solitaire) running with your full authority, you passed in the authority you need, eg (solitaire get-input write-to-screen read-write-score-file)
Instead of solitaire being able to exfiltrate your private keys and cryptolocker your data, now solitaire doesn't even have network and general file access (only to the one file), you simply didn't pass access to it.
Lambda is your new security model now.
@cwebber Thanks, saved to my already long list of important things to read. At least that's not a 600-page textbook on software architecture.
@opal "object capabilities". It doesn't really have much to do with "objects" in that it doesn't require object oriented programming, and originally they were just called "capabilities", but "capabilities" got overloaded as a term (eg, what the Linux kernel calls capabilities are nothing like object capabilities). ocap is shorthand, refers to a specific paradigm: your security model isn't who you are, but what references you hold onto.
@cwebber I always try to read changelogs, and hate it when they don't include one or stamp "bug fixes" on it and call it a day.
@Chuculate and changelogs won't help you if someone's trying to sneak in a vulnerability :)
@cwebber > An eagle-eyed developer has discovered a backdoor
If only compilers could spot the code doing something not stated in its contract...
@dpwiz A contract of what the inputs are vs what the outputs are won't save you though. You can deliver on those things and in-between do the attack.
Being able to perfectly observe that an application isn't doing tricky things just by static analysis is halting-problem level difficulty. Ocap security fills in the rest.
@cwebber output and effects. But then, there's unsafe this and unsafe that...
@cwebber I think this problem could have been solved with a purely functional programming language. Although the compiler would need an option to disable any unsafe* functions (like the ones in haskell).
Side-effects are really dangerous, this proves it.
@jorge_jbs Even purely functional programs *do* get access to side effects though, because you need to do do anything useful. They do it through a monad.
The question is: who gets access to that monad?
You're right that functional programming can help, but it isn't that the language is functional itself that does it, it's that it supports higher-order functions and the ability to pass around references.
@cwebber If the library's interface doesn't return any monad (for example, isPasswordStrong has type String -> Bool) then there is no need to give access to any monad, everything is pure.
This library seems like a good fit for a pure library. If it needed some types of side-effects (but not all) you could return the FileAccess monad, or something similar.
All the code has access to all the monads. Executing them is another story.
@jorge_jbs You may be right that this is protecting the right behavior/safety. The way you described it, you can only perform side effects if you've explicitly been handed the reference, does sound like exactly the reference-based-ocap-security stuff I'm talking about. That approach isn't limited to purely functional languages, but you've correctly identified a purely functional way to do it.
@cwebber I don't know how ocap works, but yeah, it looks we're saying the same thing but implemented in different ways.
@jorge_jbs I suspect you would enjoy reading http://mumble.net/~jar/pubs/secureos/secureos.html :)
@jorge_jbs @scolobb @cwebber
I could imagine pure functions leaking information about passwords via timing channels, CPU heat, fan rates, EMF levels related to frequency of RAM accesses, etc. Functional code eliminates state from the perspective of the programmer but in some respects only hides state that still exists from the perspective of physics.
@enkiv2 @scolobb @cwebber Well, you could make a functional language that abstracts over all the implementation details, so you couldn't rely on them. For example, the implementation could add noise so that it really is pure. But, in practice that sounds to be terribly slow xD. But, also in practice, you wouldn't leak side-effects that way.
@cwebber spooky. went and checked all the rails applications at work. fortunately, we don't use this library.
@cwebber I believe you, I just have no idea what a transition plan looks like
@VyrCossont @astraluma Ocaps can be seen as a sandboxing mechanism, but rather a paradigm where everything is sandboxed and yet it isn't hell because it resembles the way we pass around arguments in our programs. One advantage that ocaps have over contemporary sandboxes is that they can acquire just-in-time authority also. But that sounds like nonsense without further explaination, which I will have to do at a future time.
I should probably blog explaining this stuff a bit more clearly :)
- One where we list what documents you can access up-front. Now you can't access anything you shouldn't be able to, but you can't access *new* documents.
- One where you start with a set of documents you can access, but as the world moves and changes, we can also pass you access to new documents
Imagine the fediverse built with the former. You could never gain new friends!
@VyrCossont @astraluma This is why the just-in-time acquirement of authority in ocaps is really key: in the fixed-set-of-authority model, it's so annoying and rigid that eventually you'd pass in way more authority than you need, rather than being able to acquire the authority you need when you need it.
@cwebber @VyrCossont @astraluma Some might see this as a disadvantage, but the advantage of OCAP comes explicitly *from* the API rework that will be required to adopt it. Since ocaps are (as a first-order approximation and most programmers' perspective) typed opaque values used as pointers or handles typically passed by value to dependencies that use them, it makes explicit a lot of security-related state which is currently implicit in trusted code bases that really ought not be trusted.
@VyrCossont @cwebber @astraluma Good questions; I'd like to know that myself. From my limited understanding, unfortunately, I think it has to start with the host OS's most basic APIs. Without kernel support, there'll always be a confused deputy waiting to accidentally obey orders from malicious code.
@VyrCossont @cwebber @astraluma It might not be the fastest thing around, but run like shit might not be accurate either. This is the basic runtime model for Erlang, and it seems to work quite well in the telecommunications niche it was designed for, which also makes it reasonable for Internet applications as well.
Erlang works because you don't need to do OS-level context switches or de/serialization of data.
Context switching processes is expensive, and so is de/serialization. (The latter is mitigatable with shared memory, but that comes with its own pile of trouble.)
@VyrCossont But what if Ruby *libraries* weren't able to access authority they weren't granted? What if instead of every Ruby library being able to reach out and grab whatever authority it wants, you pass in the authority *to* the module the same way we pass in arguments to a function?
@cwebber To be fair, blindly pulling in software that isn't audited or even curated is dumb no matter what.
We've created a situation where this is a necessity, so a little responsibility and empathy is in order. The principle that "many eyes make bugs shallow" doesn't apply to the threat model that's evolved. People have reasons for making bad decisions. We distance ourselves and fix blame, but we do the same things and we caused this. So that's not fair
Fair is a value served by justice, which means doing the thing in our power to change outcomes
The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!