-
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
IFrame can access mashlibs window causing XSS #372
Comments
Good summary of the issue, and also a good reminder why we moved to dpop rather than using cookies. As noted, you have to be logged in and opening an untrusted HTML file on your own pod for this to work. I don't think the dokieli or humanReadablePane panes support opening remote HTML files, but if I'm wrong and they do, then this is a much bigger issue. Btw, I happen to be using this feature to dynamically register panes :-) |
Worth noting this is already in the code: solid-panes/src/humanReadablePane.js Lines 122 to 135 in 282a8fe
|
I've written this exploit code with NSS in mind, so this one relies on cookies to load the test.html iframe successfully (EDIT: not sure about this, as it loads the iframe differently than I've expected). A similar exploit would also work without cookies, if test.html is in a publicly readable location (ie it has stronger preconditions).
You could make this exploit work with the publicly appendable
This is exactly what's happening already, but by escalating privileges given to WebIds or even unauthenticated agents. In the future, potentially also apps with client IDs.
Not necessarily. If they embed remote html files, classic security preventions for cross-origin apply. For instance, this exploit would not work
It would for sure be dangerous, but I'm not even sure if it's more of an issue than the current situation. Instead of opening a /inbox/ file the user would open a https://remote.com file. The impact is the same, the user interaction part seems also the same likely to happen (depending on the UI for the remote access I guess).
Ay, that's a good point and reminder why discussion is needed :D It would be possible to sandbox normal html files and load custom pane html files from a trusted (mashlib specific folder?) source. But that of course adds complexity and is time-consuming to implement. |
Good point. I absolutely agree that untrusted agents should not be permitted to write HTML/executable code to a pod. This not something that solidos can solve alone, so an issue needs to be raised with NSS and CSS. Sandboxing the IFrame would prevent an exploit that is currently likely to be possible: getting persistent access to a pod by getting someone to open their inbox while logged in + autoloading of a malicious index.html (SolidOS/solidos#196) + changing ACL permissions. |
Some additional comments on the above mention:
|
I partly agree. Either it should not be allowed, or afterwards sandboxed/sanitized/etc such that it does not execute. However, my point is that it doesn't really matter if you're authenticated or not. If a user is authenticated and has access to I could think of allowing the pod owner to create executable files. They probably don't gain anything from privilege escalation or other impacts. But authenticated agents with access to some resources should imo not be allowed to create executable files, at least not the way it is currently. (And on a side note, I think that's not really related to this issue, so we should discuss somewhere else?) |
The relevance is that the ability of a user to access the parent window can possibly be useful, and so mitigations other than locking down an IFrame should be considered/HTML should not necessarily be locked down in every case. Iframe!= XSS, IFrame= risk of XSS. In any case I don't have anything more to add at this stage. |
Yes I think this feature case is clear. I also think that tackling this iframe issue is not the priority for now, it's rather one thing to consider in the "(how) should pods serve html files" discussion, for both the security and feature side. Until this discussion is resolved, imo it doesn't make much sense to decide what to do with this iframe issue. So for now I'd wait until pod implementors give their point of view |
Summary
When a user opens a html file with mashlib, this file can access the window of mashlib and thus among other things the authenticated fetch at
UI.authn.session.fetch
.Reproducing
Steps to reproduce (on NSS):
test.html
at any location (in a real exploit the attacker with append/write permissions would create this)For CSS, the steps are similar, however I think the
test.html
file would need to be publicly readable to be loaded in the iframe. In NSS this is not necessary because it also uses cookies.Impact
Opening a malicious html file can result in the attacker gaining control over the whole pod.
Fix
Use an iframe with the sandbox attribute which may not include
allow-same-origin
. See for instance this article on sandboxing: https://web.dev/sandboxed-iframes/This would also be fixed, if pods don't serve or sandbox html files (see https://forum.solidproject.org/t/is-it-secure-for-pods-to-serve-html-files/6379/2)EDIT: after looking at the code, I don't think it matters if pods sandbox the html, as they are not directly included with<iframe src=".../test.html">
but fetched manually and then added as a blob.EDIT 2: it's more complicated than I thought, SolidOS has 3 different ways of creating iframes. See here for a small discussion)
The text was updated successfully, but these errors were encountered: