-
Notifications
You must be signed in to change notification settings - Fork 44
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
Add security consideration for serving user-created files #598
Add security consideration for serving user-created files #598
Conversation
This PR is on the agenda for the 17 January CG Call |
I've had a short talk with @csarven last year discussing this. I am still in favor of this PR (and would probably leave it as it is) and for sure this security issue needs to be addressed in some way or another. However, there are some legitimate concerns, as it would (or at least could) affect webpages hosted on Solid pods. Here are some notes I made back then, maybe they are helpful. I don't think I will attend the meeting this week, so if you have questions, you can ask me earlier.
|
A more immediately readable rendition (wrapped in In general, what this PR implies: Html files stored on pods may or may not get rendered like normal applications by the browser. This is, because pods may (and should) restrict those for security reasons. Details will likely depend on the pod provider, but users/developers cannot rely on html being served as normal applications on every pod. They would have to choose a specific pod that allows it, or move the webpage hosting to a different service. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me first say that I appreciate the careful consideration here a lot. I also think we should discuss and work through it further before introducing something like this into the specification, even as a consideration. It seems to introduce other complications and makes some assumptions about the overall design that's not necessarily true or desired.
(Let's use terminology like allow-listing instead of white-listing. Otto, I'd appreciate it you can update your comment along those lines.)
First, the term "pod provider" doesn't align with existing notions. Relevant notions in use are: identity provider, server, storage owner, and URI owner.
According to the Web architecture, the URI owner allocates and delegates that intended behaviour to the server. That's orthogonal to reserved-allocations by the specification (like for instance the container, root container) which is assumed to be agreed by the URI owner the moment they use a product (server) that conforms to the specification. That said, the suggestion in this PR seems to introduce some discrepancy because it gives more authority to the server (or perhaps the storage owner?) than the URI owner with such constraints.
The allow/blocklisting suggestion introduces a gap in the flow and specification as it doesn't specify how a URI owner can instruct the server to allow specific resources to include or exclude the CSP header (or other, which is also part of a broader topic discussed elsewhere.) And so achieving that functionality would be implementation specific / unique to each vendor until something specifies how. This could be addressed by introducing information in the original HTTP request - think along the lines of an "interaction model". If that's not already specified somewhere (in the context of CSP headers) that we can refer to, we may need to specify it. That aside, I would suggest to reach a better understanding in this space before suggesting servers to block off certain things. That said, any server already has the option to include certain header irrespective to the proposed consideration here.
There is a wide range of content and user interactions that use markup languages as the host language. Those kinds of expressions are integral to the resource, and blocking them off at the gate dismisses a major category of use cases that's already out there on the Web. I don't think this should be simply hand-waved or expect what people currently do to make drastic changes when they try to onboard to Solid. If anything, Solid should be acknowledging their existence and allow a smooth transition from their existing servers and publishing practises to Solid. A similar argument holds for Solid applications being able to read-write a plain ol' "homepage".
One other assumption here is how applications could be introduced to the Solid storage in the first place. Being able to "spawn" instances of an application using the Solid Protocol is an amazing feature. Telling the world that they should use non-Solid servers to host their applications also seems awkward and counter, and that's irrespective to the applications that may currently be using non-Solid servers to host their applications.
Good point @csarven, maybe worth rewording it a bit to make that clear. |
This was not consensus from the meeting. We agreed to have more discussion/review on the PR, not to merge and reiterate. |
If we can't agree on the current text, we should still add an inline issue linking the original issue from the specification. |
FIrst of, I agree that it makes sense to wait with this PR until there is understanding of the implications and consensus about it. Also, the inline remote issues reference sounds good to me.
I'd prefer to stay with whitelisting, as this is the terminology used in security for what I wanted to express (so anyone interested into it can simply google it and find an explanation similar to my intentions on Wikipedia and co). No strong opinion on this though.
Yes, server (or the entity that manages the server) is what I've meant with pod provider. This is also the wording I've used in the security consideration of this PR.
I honestly cannot follow this paragraph and don't understand the intended meaning. Can you rephrase it and/or add additional links/examples?
Maybe I am misunderstanding. (Under the assumption, that we're not talking about storage owners whitelisting applications, which seems unreasonable to me): From my point of view, the whitelisting of applications would be similar to how some servers currently serve Mashlib as a default application if
👍
Also, I think that serving runnable applications is currently a grey area in the specification. Adding the CSP header does not modify which files are sent back to the client. It only modifies how a specific type of clients (browsers, a major type of clients to be fair) renders them. This is currently not specified to my understanding (which lacks understanding of some parts of the spec), neither as a requirement or a prohibition.
I agree, there are applications that will stop working when served with the CSP sandbox header. Simply adding the header without notifying the storage owners or proposing alternatives would lead to frustration.
For servers that target the general audience, where any agent can become a storage owner and/or a wide range of Solid apps is used to interact with the storages, I personally don't see a way of making this feature happen in a secure way. For smaller servers (eg the personal own server), maybe it would be secure to allow serving user-created applications. However, even there, if you eg use the current CSS recipe with mashlib, an evil agent/application with access to your personal server may be able to make requests in the name of you to other servers. So the smaller server could impact other servers through your WebID (given some circumstances I can try to explain in case someone is interested). |
I would appreciate it if you could further elaborate on this point. |
I'll explain two attack scenarios, there could be more as it's a complex topic. The attacker can be an agent with a WebID or an application. They need append/write access to your server to be able to store the malicious html file, eg because you allowed them to write a blog post, or they even have their own storage in a different path on the same domain. Impact of both scenarios: The attacker can access anything that the victims account has access to, pretending to be the victim.
Prerequesites:
Attack:
Prerequesites:
Attack:
|
Thank you @Otto-AA
Does it only apply to the default CSS deployment where the OIDC Provider and the Resource Server are on the same origin? For example, I run two separate CSS instances on different subdomains, one for my OP and the second for my RS.
I want to check my understanding with you. |
Yes, the 2nd attack only works if the OIDC Provider (and its login page where you save the credentials) and the Resource Server are on the same origin (That's what I meant with the "The victim uses the IDP of the (small) CSS server" precondition).
Yes, it uses the silent login (though I don't think this is based on cookies; it doesn't matter here, though). However, it never redirects to the malicious html document, this is not necessary for this attack. There are two tabs involved:
The SolidOS page automatically does a silent login, involving some redirects and finally getting back to the original SolidOS url. When the login is finished, the malicious html file can use the reference to the SolidOS tab to access the SolidOS |
@Otto-AA we are setting up a dedicated document for security practices, I have extracted scenarios you described here into an initial PR Would you be interested in collaborating on that draft? |
Fixes #514
This is a draft on how the security consideration could look like.
Note that there was not yet an agreement on a solution in the issue. However, as everyone agreed that it is an issue, I thought I'd propose this. As the implementers decide on the actual security measure, I also don't think we need to discuss this at length, and hopefully can add it soon.