-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some ideas to make mitosis secure #13
Comments
I haven't really thought much about this, I do feel that you should probably not suid processes without cleaning env vars. @oli-cosmian may have opinions |
I don't have the time to properly read up on the suggested proposal and all its ramifications. I did read the linked rustc PR though. If the feature is accepted and implemented, it seems like it would be possible to make mitosis use that instead of the current scheme. The feature would have to be stable though before mitosis could use it. On the main point of this issue (mitosis being unsound, and very bad with
You can always screw with mitosis by running inside a chroot (thus hiding |
Hey @Manishearth, I have some thoughts on how to make the serialization and deserialization of closures more secure. I'm sure it's not a realistic problem for the current users/uses of
mitosis
, but it is currently vulnerable to arbitrary code execution due to the way closures are deserialized. A hypothetical example: a binary usingmitosis
with its SUID bit set and owned by root can be used for privilege escalation by non-root users1.I've been tackling a related problem – how to send closures between processes over the network – and have taken a similar but slightly different approach2. I have an idea for how to achieve soundness, and I'd be keen to hear your thoughts.
I see you are casting non-capturing closures to function pointers, made relative to a known base. I took this approach at first, but I could not see an attractive route to making this sound so I switched to using something that
rustc
has more control over: trait objects.Essentially my idea for soundness is an addition to Rust that enables programs to get all vtables for a particular trait. I have a working PR for that here rust-lang/rust#66113. Given that addition, on serialization of a closure upcast to a trait object you serialize the concrete type_id then the data3. On deserialization you look up the type_id to find the vtable, and if found then call the vtable method to deserialize the data. (See the PR for more details.) This is4 a way to achieve secure & sound deserialization of trait objects. There is some more research including prior art in a languishing RFC I've worked on here.
I'd love my projects and
mitosis
to be able to deserialize closures securely so I'm keen to hear if you have any thoughts as to how best to go about achieving this.mitosis
-using binary withMITOSIS_CONTENT_PROCESS_ID
set to the channel token, and then sending along the channel the arbitrary address to execute.serde_closure
– macros that wrap closures to make them (including captured variables) safely serializable and deserializable.serde_traitobject
– supertraits that enable the serialization and deserialization of trait objects. It is currently, likemitosis
, not sound or secure – though it does some validation to rule out non-malicious errors (see here) before dereferencing the received pointer.constellation
– uses the above to spawn closures across a cluster (standalone or kubernetes).serde_closure
.The text was updated successfully, but these errors were encountered: