Permission escalation because user-uploaded html files can use session cookie
@bourgeoa がすでに取り組んでいます。
2023年2月11日 から。
評価
この issue はまだ評価されていません。
説明
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)
- 主要言語
- JavaScript
- スター
- 1.8k
- フォーク
- 308
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
nodeSolidServer/node-solid-server のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
nodeSolidServer/node-solid-server#1848 · コメント 2 件 · リアクション 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
nodeSolidServer/node-solid-server#1841 · コメント 2 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
nodeSolidServer/node-solid-server#1147 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
nodeSolidServer/node-solid-server#1867 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 45/100
nodeSolidServer/node-solid-server#1853 ·
nodeSolidServer/node-solid-server の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Seeed-Studio/wiki-documents#5655 · コメント 2 件 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
capricorn86/happy-dom#2435 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
Edit: CW+ オープンchannels:edit check:passed
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
01 type: bug 30 needs: triage 99 tag: UX Accessibility
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100