Backdoor discovered in Ruby "strong password" library, takes your "strong passwords" and uploads them into a pastebin

Hi, do you believe me when I say we need ocap security yet

@cwebber how would an OCAP scheme solve the problem of a compromised third-party library loading arbitrary code from an attacker-controlled pastebin?

serious question

@VyrCossont @cwebber I think the point is that code is internally limited so different libraries can't access data or services they're not supposed to?

So in this case, the library can't exfiltrate data because it can't network.

@astraluma @cwebber one could also say the same about other sandboxing mechanisms for third-party code, so i was wondering what the particular OCAP advantage, if any, would be here

@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 :)

· · Web · 1 · 3 · 3

@VyrCossont @astraluma Here's an example of what I mean by just-in-time-authority. Here are two worlds:

- 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 @astraluma no, that part makes perfect sense, especially given the current "full network access or nothing" choice that many app store sandboxes still have

so you might build a capability-based Mastodon server with an HTTPS capability manager that has its own capabilities:
• make an HTTPS connection to a domain on the safelist
• request safelisting a new domain…
@cwebber @astraluma

the part of your server that handles auth should never be able to request new domains on its own, so you'd give it a diluted capability with only the first one

and it'd never give either to the password library…
@astraluma @cwebber this really doesn't really do much for the transitive trust problem for third-party code

maybe your runtime and package manager is extended to specify additional restrictions on capability propagation between dependencies and transitive dependencies

honestly, it's about time
@astraluma @cwebber but this level of capability-based design would require a fairly massive restructuring of any application that wanted to use it, as well as a language, runtime, and standard libraries that (a) supported capabilities and (b) was totally free of trapdoors into lower-level operations.

which is the real problem. there may be research languages that can do this, but is anyone shipping code in them today? or even close?

@VyrCossont @astraluma We can constrain as much as we can (for mastodon, the whole program), but for new programs, we can get this level of security

@cwebber @astraluma what language/platform would you recommend for new development?

@VyrCossont @astraluma I'm hopefully bringing ocap secure modules to Racket soon, and the Agoric folks are bringing it to Javascript, but it's hard for me to say there's a language-level thing I can recommend *yet*... but making it clear how urgent it is can help us prioritize it, and it's possible

@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.

@cwebber @VyrCossont @astraluma Just as NULL-free coding requires changes to code in exchange for more reliable software, so too would adoption of OCAP-style API designs. It's painful, but it'll be very much worth it.

@vertigo @astraluma @cwebber agreed, but, like, let's say i'm writing a new fediverse server today

y'all are telling me to make that thing OCAPpy

where do i start

@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.

@vertigo @astraluma @cwebber yeah so that's not going to happen. period. i don't make apple pie starting with the universe, i don't have the budget…
@vertigo @astraluma @cwebber with current tech and a language targeting native code, you could do something like shatter your app into hundreds of processes to isolate dependencies and important internal components, communicating thru IPC, each running in a possibly-ephemeral sandbox with permissions set by the parent process

think actor system + SELinux

it'd be an absolute nightmare to write and debug, and probably run like shit

@VyrCossont @cwebber @vertigo Sounds like local SOA? It could be doable with at least high-level components.

But yeah, if you wanted to do this for every actor in your code, that would be thousands (millions?) of processes and would perform like crap.

@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.

@vertigo @VyrCossont @cwebber Vyr is talking about shattering the application into many individual processes and applying linux kernel security features to each one.

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.)

@astraluma @cwebber @vertigo right, i was proposing this mostly rhetorically; you could probably come close to what i suggested with Docker as a (relatively) friendly framework, but you totally wouldn't want to…

@VyrCossont @cwebber @vertigo Using namespaces instead of selinux doesn't really help the core problem that context switching suuuuucks.

@astraluma @vertigo @cwebber oh, for sure. also in a full-tinfoil scenario like this, i'd wanna use both.
@astraluma @cwebber @vertigo what we're really looking for is a VM-based language with the ability to restrict permissions on a per-module basis

1990s/2000s VM languages tried…

> So, keep in mind the following techniques to ensure your code is secure: Do not use Code Access Security (CAS).

— Microsoft (going on to suggest that the only .NET VM security boundary you can trust is virtualization. have you heard the good word of Hyper-V?)
@astraluma @cwebber @vertigo JVM languages have SecurityManager, which is sort of MAC, it's not a bad start, but given a thousand years of JVM security issues, i'm guessing either it's leaky in easily exploitable ways or it's a bear to configure or both, so building a capability system on that would hurt

same deal with RestrictedPython

Erlang i don't know enough about, would love to hear from somebody that does know its security model

@VyrCossont @cwebber @vertigo TBH, I'm not sure I'd want to use the python language?

ocap and oop I'm sure mix fine (replace handles with objects with methods), but if manipulating and proxying and limiting caps is such a crucial part of the language, maybe it should have syntax for it?

Show more
@astraluma @cwebber @vertigo ok, end of speculation

tl;dr: OCAP seems like a useful design philosophy, but it also seems like there's no practical way to use it

@vertigo @VyrCossont @cwebber You could start with the language runtime, assuming the language doesn't have c ffi and has ocaps built into every API from the ground up.

Sign in to participate in the conversation

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!