Permission escalation because user-uploaded html files can use session cookie
@bourgeoa ya está trabajando en esto.
Desde el 11/2/2023.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Edit: I've replaced localStorage from the initial comment with cookies, my initial idea that localStorage is the problem was wrong.
Edit 2: Updated whole issue to say it is not mashlib related, but only requires any app login
Description
When logging in, solidcommunity stores a session cookie (nssidp.sid) that can be used for authentication. For html files running on *.solidcommunity.net this cookie will be attached to the request. If a malicious user creates a html file on victim.solidcommunity.net and the victim is logged, opening this html file gives the attacker full access to the pod.
Exploit
Preconditions:
- Alice has used any app to login with NSS, thus the nssidp.sid session cookie is stored.
- Alice gave Evil append access to a folder or file on Alice's pod
A simple exploit could look like this:
- Evil saves exploit.html on Alice's pod (see below for example content)
- Alice opens exploit.html, for instance by clicking on a link or being redirect by an app
- requests made by exploit.html automatically attach the session cookies, and thus have read/write/create permissions of the whole pod (the same permissions as the logged in person)
- exploit.html can make arbitrary requests on Alice's pod
exploit.html could be similar to following (abusing read access to private resources):
<script>
fetch('/private/secret.txt')
.then(res => res.text())
.then(text => alert(text))
</script>
Impact
The result is, that an app or webId can escalate their permissions to the level of the logged in user. Thus, giving anyone append permissions to one file gives them control over the whole pod.
The required user interactions are either:
- logged in with any app and using an app that has append permissions on a file
- logged in with any app and giving a user append permissions on 1+ files and clicking on a phishing link
Note that I would have expected the exploit would work even if the html file is hosted on another pod (evil.solidcommunity.net). However, it seems it sends the session cookie but results in 403 when accessing the private resources. For me this 403 is unexpected, but I guess the server checks the sender domain with regards to the session cookie.
Migitation
The problem arises, because NSS sets a session cookie on solidcommunity.net and serves user-generated html files on solidcommunity.net. This cookie is attached to requests to solidcommunity.net and subdomains.
The solutions I see currently are:
- remove the cookie
- sandbox served html files
- not serve html files
All of these are breaking changes.
Remarks
Related to: https://forum.solidproject.org/t/is-it-secure-for-pods-to-serve-html-files/6379/6 (about sandboxing / not serving html files)
- Lenguaje dominante
- JavaScript
- Estrellas
- 1.8k
- Forks
- 308
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de nodeSolidServer/node-solid-server
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
nodeSolidServer/node-solid-server#1848 · 2 comentarios · 1 reacción ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
nodeSolidServer/node-solid-server#1841 · 2 comentarios ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
nodeSolidServer/node-solid-server#1147 ·
-
remove bootstrap dependency Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
nodeSolidServer/node-solid-server#1867 ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 45/100
nodeSolidServer/node-solid-server#1853 ·
Todos los issues de nodeSolidServer/node-solid-server
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Seeed-Studio/wiki-documents#5655 · 2 comentarios ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
capricorn86/happy-dom#2435 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
-
Edit: CW+ Abiertochannels:edit check:passed
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
01 type: bug 30 needs: triage 99 tag: UX Accessibility
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100