-
-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
URL redirect bug #264
Comments
Thanks for posting! I actually didn't see the SN post but saw this ticket here. This is definitely an issue and we should warn users before redirecting them to external sites like many other sites do. For example, clicking on this link shows a prompt before redirecting: https://www.google.com/url?q=https://www.bufferzonesecurity.com : More info about open redirects here: https://bufferzonesecurity.com/open-redirection-what-is-this-phishing-technique-and-how-do-i-defend-against-it/ Therefore, an attacker could just create a very similar site that looks like SN to grab credentials from users who don't check the URL again. So I agree, this is indeed severe. Fortunately, the fix should be easy by just validating the callback URL. Will create a PR in a few minutes. |
Taking a more closer look, I realized that grabbing of credentials wasn't possible. No login or signup method uses passwords on SN. For example, using Lightning for authentication, a different pubkey would have been created since the domain name is included during key derivation. Using Github and Twitter, a third-party authenticates the user. With E-Mail, a link is sent to the address for signup and login. So afaik, there was no possibility to grab user credentials and steal funds using this exploit. Users can't enter a password on a phishing site if they have none. @huumn, @ShellInjector, @orthzar, do you come to the same conclusion? But of course still thanks for creating this ticket! I think this was still a severe issue which may be used for other malicious stuff. We should definitely warn users when they leave SN when it's unexpected. |
Sure! there was no possibility to perform such advanced attacks , but if someone manage to escalate the issue to Cross site scripting or so . maybe there will be a scenario stealing Cookies or Interesting headers . |
Alright fix deployed. Thank you everyone. I'll send you all some sats today. |
This issue is submitted as per this SN post.
Problem
First of all, this bug is severe, because it could be used to phish user credentials -- and SN accounts involve money.
Some SN pages currently redirect signed-in users to any URL. For instance, these two links will redirect you to Google:
https://stacker.news/signup?callbackUrl=https%3A%2F%2Fwww.google.com%2F
https://stacker.news/login?callbackUrl=https%3A%2F%2Fwww.google.com%2F
It would be trivial to send SN users emails, which contain links that seem legit, but which actually redirect them to a fake SN login page. The credentials harvested through such a page would be used to steal user funds. The only thing the attacker would need is SN user email addresses, which have been accidentally leaked once before.
The bug exists in
pages/signup.js
andpages/login.js
. Both have a functiongetServerSideProps
, which seems to not check the content ofcallbackUrl
. The bug only affects users who are signed in, because the session variable has to be non-null ingetServerSideProps
for the redirect to work.callbackURL
is also mentioned inpages/settings.js
,pages/invites/[id].js
, and some files in the components folder. I have not looked at or tested those files.Solutions
This bug could be solved by either eliminating the redirection functionality; or by checking the domain in callbackUrl (e.g. by only allowing redirects to stacker.news). I don't know which solution would be correct, because I don't know what purpose this redirection serves.
Sorry, I don't have any code to offer. I have no experience writing Javascript and there isn't enough time for me to learn.
The text was updated successfully, but these errors were encountered: