Proof-of-concept attack: Upload and execute attacker controlled js from any domain. #1859
Labels
No Label
0.2.0
0.3.0
0.4.0
0.5.0
0.5.1
0.6.0
0.6.1
0.7.0
0.8.0
0.9.0
1.0.0
1.1.0
1.10.0
1.10.1
1.10.2
1.10a2
1.11.0
1.12.0
1.12.1
1.13.0
1.14.0
1.15.0
1.15.1
1.2.0
1.3.0
1.4.1
1.5.0
1.6.0
1.6.1
1.7.0
1.7.1
1.7β
1.8.0
1.8.1
1.8.2
1.8.3
1.8β
1.9.0
1.9.0-s3branch
1.9.0a1
1.9.0a2
1.9.0b1
1.9.1
1.9.2
1.9.2a1
LeastAuthority.com automation
blocker
cannot reproduce
cloud-branch
code
code-dirnodes
code-encoding
code-frontend
code-frontend-cli
code-frontend-ftp-sftp
code-frontend-magic-folder
code-frontend-web
code-mutable
code-network
code-nodeadmin
code-peerselection
code-storage
contrib
critical
defect
dev-infrastructure
documentation
duplicate
enhancement
fixed
invalid
major
minor
n/a
normal
operational
packaging
somebody else's problem
supercritical
task
trivial
unknown
was already fixed
website
wontfix
worksforme
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Reference: tahoe-lafs/trac-2024-07-25#1859
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Proof of Concept Attack
The following proof of concept shows how an html file loaded from any domain into (some) browsers with javascript enabled can inject an attacker controlled script into a grid, and then cause the user to execute that script in the domain of the grid:
Mitigations:
There are several moving parts at work here. The
when_done
parameter with uri substitution was very convenient.I think an upload capability would be the most consistent and thorough solution. Removing bits and pieces which may otherwise be useful, like
when_done
, feels like a piecemeal defense.Requiring CSRF tokens may be more comprehensive, but also doesn't sit well with the rest of the capability model. (A CSRF token would be a bit like a "make a this kind of http request" temporary capability.)
Related Tickets:
Browser Notes
I tested this with google chrome 18.0.1025.142 (not chromium) and ice weasel 3.5.16, both on debian squeeze (6.0.4). The attack worked in the latter but not the former.
In the former case, chrome said something like ~"refusing to evaluate javascript which was seen in upload data" in the javascript console. That feature surprises me and I would expect it is almost impossible to detect and prevent XSS completely; although maybe they can almost stamp out "reflected XSS" under which this demonstration attack falls.
Reflected XSS is when an attack script is served in the response of the same HTTP transaction that included the attack vector in the request. A "stored XSS" is one in which the attack vector lives in some state and is returned in a different response. Because this attack stores a malicious script in a grid, it's apparent that stored XSS attacks are also likely, and these may thwart chrome. Other means to thwart might be various forms of obfuscation. (David-Sarah asked about gzipping the payload, which I have not tested.)
I think it's easy to defeat Chrome's restriction here, by bouncing the when_done request off the attacker's server (which can be at any domain).
Impact:
I'm a bit embarrassed that I didn't include an impact summary for users: I believe using only this technique, a victim would be vulnerable to malicious javascript which:
Detection, Mitigation, and Recovery Strategies:
In all cases, there are two broad mitigations: Do not use a browser which can connect to a tahoe gateway, or disable javascript on that browser.
Note that the first strategy may actually be tricky: Even if you never access a gateway from your browser, if they are both running on the same host, this attack may be possible.
Storage Attack:
The scenario of an attacker storing data with this technique is very similar to an attacker knowing the introducer and uploading it themselves. It is already the case that any participant in a grid may upload "too much" content, so the primary difference is that the attacker may not be someone who has received the introducer.furl.
Detection would require all participants to attest to their storage usage then to subtract the difference. This assumes garbage collection is in place. If the participants don't trust each other they could publish all of their verify caps, but this exposes some privacy details (the size of files/directories and their shape).
For the first case, this is very similar to a shared grid in which one participant uploads a lot of content. Detection would require noticing more data is being uploaded than is expected.
The attacker gains the ability to upload which they could also have by knowing the introducer furl, so this scenario is not too different from a loosely managed friend net.
Whether or not the grid is a loosely banded friend net or a centrally managed grid, recovery involves garbage collection. Detection re
In the case that the grid is "tightly" controlled, so that all participants are known and their storage needs are known
Accessing Attacker-Controlled Data:
Once a malicious script has stored data it can retrieve that data. The primary impact is using the victim's bandwidth. I'm not sure of any mitigation or recovery strategies.
Phishing:
A mitigation for phishing is to familiarize yourself with the URL scheme for all of the standard pages. If the URL path begins with
/uri
,/file
,/cap
, or/named
and it looks like one of the other url pages, it is potentially a phishing attack.Other Annoyances / General:
In general, detecting malicious javascript may be possible by using your browser's javascript console or debugger. Using a network diagnostic tool which shows all http requests (also typically available in a browser's javascript or web-developer console), could reveal malicious requests, although it may take some effort to distinguish legitimate and illegitimate requests.
Users are probably not vulnerable to:
This is related to: