Open bellaj opened 8 years ago
I'm sorry, but I'm not seeing how this could be used maliciously. Could you please describe what kind of attack you are imagining?
It seems to me that if someone can direct you to https://apps.sandstorm.io/?host=http://malicious_website.com then they can just as easily direct you straight to http://malicious_website.com.
Visiting that URL (https://apps.sandstorm.io?host=http://malicious_website.com) and inspecting links to install an app, gives you something like http://malicious_website.com/install/a33e26d3b0fa40c658e2235dab438f1a?url=https://app-index.sandstorm.io/packages/a33e26d3b0fa40c658e2235dab438f1a
as the link. I expect that this is what @bellaj was referencing.
So if I use https://apps.sandstorm.io/?host=http://httpbin.org/get?query=
then I get https://httpbin.org/get?query=/install/a33e26d3b0fa40c658e2235dab438f1a?url=https://app-index.sandstorm.io/packages/a33e26d3b0fa40c658e2235dab438f1a
which when clicked provides me with
{
"args": {
"query": "/install/a33e26d3b0fa40c658e2235dab438f1a?url=https://app-index.sandstorm.io/packages/a33e26d3b0fa40c658e2235dab438f1a"
},
"headers": {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Language": "en-US,en;q=0.5",
"Dnt": "1",
"Host": "httpbin.org",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:43.0) Gecko/20100101 Firefox/43.0"
},
"origin": "72.160.202.127",
"url": "https://httpbin.org/get?query=%2Finstall%2Fa33e26d3b0fa40c658e2235dab438f1a%3Furl=https:%2F%2Fapp-index.sandstorm.io%2Fpackages%2Fa33e26d3b0fa40c658e2235dab438f1a"
}
@sigmavirus24 Right. But how is that exploitable?
To be clear, there are no secrets in that pastebin. The long hex string is the package ID of the app you chose.
the simple scenario, it could be used in a phishing tentative with a client side attack, the malicious website could be hidden .. i will send you a POC when i get some free time
@bellaj OK, so this is a potential phishing attack, not CSRF.
The attack goes like this:
Is that correct?
While I agree that such an attack is possible, there are several mitigating factors:
Basically, I do not think this would be a very effective attack.
Normally I would nevertheless fix the issue, but in this case I'm not sure what we can do about it. The ?host=
parameter is necessary to allow people to install apps to their own servers. The app market has no way of telling the difference between the user's actual server and an attacker's server.
If someone has a better idea for how to implement our UI, or can identify a more severe possible attack, please do tell.
Perhaps a better solution would be a trust on first use? In other words, prior to redirecting to http://malicious_website.com/install/a33e26d3b0fa40c658e2235dab438f1a?url=https://app-index.sandstorm.io/packages/a33e26d3b0fa40c658e2235dab438f1a
the page could say something like:
Installing {{ app }} to {{ scheme://hostname }}
Do you wish to continue? [ Yes ] [ Return to apps.sandstorm.io ]
[ ] Always trust in the future
Please remember that you should not be prompted for anything when installing an application to your own server.
This gives users awareness they're being redirected and that they haven't installed something to that server previously. (Obviously this would need to be coupled with a dashboard to allow users to remove hostnames from their trust list.)
Eventually, I wouldn't mind my list of Sandstorm servers being tied to my logging into the market (optional, of course). Clicking a link with a different host than expected would, I presume, provide a warning.
Alternatively, I suppose when you browse to the app store with a new server for the first time, it could pop up a dialog saying:
foo.example.com
Is this your Sandstorm server? [yes] [no]
Once you choose "yes" once, we'd trust it going forward (on that browser; no login needed). We could skip this dialog for Oasis and other known-good hosts.
However, I'm not sure this interstitial would provide much real protection. People would quickly get in the habit of clicking "yes".
@kentonv I've seen plenty of users where such interstitials definitely cause them to stop, wait, and ask. Even seemingly innocuous ones. Also bear in mind, most users will never see said interstitial, and the rest will likely see it rarely (or maybe once). Therefore I doubt people will "get in the habit" of clicking yes.
you could add in the url a hash to check if the host parameter has changed.
i think the host parameter could lead attacker to perform a csrf attack, not just a simple phishing. I will work on this next weekend to check it.
@bellaj OK, I look forward to seeing what you come up with!
Note that this could be a CSRF problem if we ever POSTed to the host provided, but we don't, we only redirect the user's browser there.
you could add in the url a hash to check if the host parameter has changed.
Sorry, I don't understand this proposal. Why couldn't the hash be forged? Keep in mind that anyone is legitimately allowed to install a Sandstorm server on any hostname they wish.
A wrinkle re: the claim that sandstorm doesn't currently prompt for secrets: email login. Here's an attack that could give the attacker access to a user's account:
It's still clunky in a lot of ways, but much more serious that previously suggested I think.
@zenhack Hmm, I think what you describe is actually a more general problem with email login that isn't particularly specific to app market redirects. I might, for example, give you a link to a rocket.chat grain on my personal sandstorm server which I've maliciously modified such that it MITMs the email login flow. Rocket.chat requires login, so you'll likely go ahead and do so, and if you don't carefully look at the email you might not notice that it's from a different host. :/
Yeah, I think you're right. That's much more serious. One simple way to deal with this is to only have the link, and take out the option to type in an authentication code.
@zenhack Indeed, although it's sad because in practice I almost always use the code, and the code is actually highly preferable in some cases, e.g. when I'm logging in on desktop but receiving email on my phone...
Agree, not sure what to do about it though. Could try shortening the URL, but getting rid of the email address itself makes me nervous, and without that even if we made _emailLogin negligibly short it would probably still be burdensome to type the whole URL.
Hi,
i have just discovered your project sandstorm, I think it is very interesting however while i tested it i noticed that the online demo apps.sandstorm.io has a CSRF vuln.
if you visit this url https://apps.sandstorm.io/?host=http://malicious_website.com
and you installed any app you will be redirected to the malicious website !!!