News for hackers. Stuff that matters.
Re:Hacker News CSRF Vulnerability by vardump on Thursday February 25, 2016 @04:22PM (#11177893)
When it comes to security vulnerabilities, please remember when reasoning about their impact there's a good chance you'll miss something critical. Arrogance and vulnerabilities are a bad mix.

Even innocent looking "low impact" issues can be used as stepping stones to something much worse.

Creative exploitation can make two or more low impact vulnerabilities into a very serious compromise. Some of those vulnerabilities might be in a completely different system.

Re:Hacker News CSRF Vulnerability by droopybuns on Thursday February 25, 2016 @05:45PM (#11178452)
This should be required reading for anyone submitting vulnerabilities to bug bounties.
Re:Hacker News CSRF Vulnerability by david_shaw on Thursday February 25, 2016 @05:48PM (#11178466)
> This should be required reading for anyone submitting vulnerabilities to bug bounties.

In my experience, people submitting vulnerabilities to bug bounties tend to incorrectly estimate in the other direction, since they have financial incentive to do so.

You replied to a comment indicating that even minor bugs can be serious -- which they can -- but many researchers will find actually minor bugs (nginx version disclosure, existing account enumeration on signup page, etc) and claim they're critical.

There's a balance there, and it can be tough to find. In any event, my stance is that if there's a security bug, you should damn well fix it :)

Re:Hacker News CSRF Vulnerability by vardump on Thursday February 25, 2016 @06:12PM (#11178611)
> In my experience, people submitting vulnerabilities to bug bounties tend to incorrectly estimate in the other direction, since they have financial incentive to do so.

A good point. There's definitely motivation to exaggerate the impact.

However, could there be a flip side to this as well?

People not reporting vulnerabilities they consider minor, thinking they'll get no financial gain. No money or fame, so why bother?

Some of those unreported issues could be very critical when connected with something else minor or perhaps even something that's not a bug at all.

Perhaps some of bug bounty funds should be retained for awarding any reported issues that turned out to be a (part of) critical vulnerability in the future?

Retroactively awarding issues that became more critical later on should encourage reporting of maximum number of bugs. Even those the discoverer considered insignificant.

As a result, everyone involved would be better of. More bugs would get reported and their discoverers properly compensated.

> ... minor bugs (nginx version disclosure, existing account enumeration on signup page, etc) and claim they're critical.

Wouldn't you agree it's preferable they're reported regardless, no matter how minor they may be? For example unintended version disclosure could very well make targeted attack a successful one. Account enumeration disclosure could conceivably be used to attack the account holder in some other way, including social engineering attacks.

Re:Hacker News CSRF Vulnerability by droopybuns on Thursday February 25, 2016 @06:34PM (#11178739)
The high value statement that got my attention was this: "Arrogance and vulnerabilities are a bad mix."

This applies to all parties- the ones who are vulnerable and the ones who are discovering.

I totally agree with your statement about reporters inflating the impact of minor bugs. In fact, it is the spirit of arrogance which they exhibit that attracted me to OP's comment!

Re:Hacker News CSRF Vulnerability by lucb1e on Thursday February 25, 2016 @03:56PM (#11177717)
Although I can totally see how this is a vulnerability, the implications are quite limited. Basically you can log people out for fun, and you can log them in to an account of yours, which I think would be noticed quite soon.
Re:Hacker News CSRF Vulnerability by etjossem on Thursday February 25, 2016 @03:59PM (#11177743)
The implications depend on your app. If the user doesn't notice being logged into a new account, they may go on to create data in the attacker's account that they expect to be private (e.g. YouTube watch history).

On e-commerce sites, they might add a credit card - thereby allowing the attacker to use it.

Fortunately, HN doesn't have these risks, but it's a good illustration of how CSRF works in the real world.

Re:Hacker News CSRF Vulnerability by ghayes on Thursday February 25, 2016 @04:11PM (#11177828)
Plus if you made the account name "new" or "top posts" or something, it could take weeks for me to notice that it didn't say my username at the top right.
Re:Hacker News CSRF Vulnerability by lucb1e on Thursday February 25, 2016 @04:05PM (#11177793)
Good points indeed. I never thought of adding anti-CSRF measures to login forms, only while logged in, so I'll start doing that :)
Re:Hacker News CSRF Vulnerability by r1ch on Thursday February 25, 2016 @04:24PM (#11177915)
Another good reason for login CSRF tokens is to prevent a malicious page from submitting lots of invalid logins and getting an account / IP locked or rate limited.
Re:Hacker News CSRF Vulnerability by 0x0 on Thursday February 25, 2016 @04:53PM (#11178130)
Another reason for customizing "topcolor" in your HN profile :)
Re:Hacker News CSRF Vulnerability by zer01 on Thursday February 25, 2016 @04:02PM (#11177763)
Both Michal Zalewski[1] and Chris Evans[2] have commented on this, and I tend to agree with them. The actual implications for a CSRF like this are very minimal.

[1] https://lcamtuf.blogspot.com/2010/10/http-cookies-or-how-not... [2] http://scarybeastsecurity.blogspot.com/2010/01/logout-xsrf-s...

Re:Hacker News CSRF Vulnerability by tptacek on Thursday February 25, 2016 @04:20PM (#11177883)
The implications for HN are minimal, but this is a login CSRF, not a logout CSRF. Like session fixation, login fixation is a serious flaw.

Believe it or not, there have been apps with serious flaws stemming from logout fixation --- but those flaws were notable because they weaponized logout CSRF. :)

Re:Hacker News CSRF Vulnerability by rudolf0 on Thursday February 25, 2016 @04:46PM (#11178085)
What exactly is "logout fixation"? Session/login fixation makes sense, but I can't really imagine what logout fixation would look like. Google was of no help, either. Do you mean a logout function which doesn't properly log you out, or logout CSRF?
Re:Hacker News CSRF Vulnerability by tptacek on Thursday February 25, 2016 @04:56PM (#11178152)
Sorry, that's a typo. I meant "logout CSRF".
Re:Hacker News CSRF Vulnerability by rudolf0 on Thursday February 25, 2016 @05:03PM (#11178212)
Gotcha.
Re:Hacker News CSRF Vulnerability by zer01 on Thursday February 25, 2016 @04:22PM (#11177896)
I agree that depending on the context session fixation and login CSRFs can have actual security impact, but those cases are far and few between, so calling them a "serious flaw" feels a bit hyperbolic to me.
Re:Hacker News CSRF Vulnerability by etjossem on Thursday February 25, 2016 @04:04PM (#11177777)
Gmail account contacts were stolen in a CSRF attack (combined with another vulnerability). This type of attack is often overlooked, but it's very real.

http://archive.oreilly.com/pub/post/gmail_exploit_contact_li...

Re:Hacker News CSRF Vulnerability by zer01 on Thursday February 25, 2016 @04:11PM (#11177825)
As far as I can tell that particular vulnerability isn't a CSRF at all, it's an insecure JSONP endpoint[1]. The original author is mistaken.

[1] http://homakov.blogspot.com/2013/02/are-you-sure-you-use-jso...

Re:Hacker News CSRF Vulnerability by ryanlol on Thursday February 25, 2016 @04:14PM (#11177845)
CSRF attacks are very real, but the impact is generally taken into account before calling things a "vulnerability".

e.g you can have a SQL injection that's not a vulnerability because the input passes through a substr($_GET["id"],1,1).

Re:Hacker News CSRF Vulnerability by bcg1 on Thursday February 25, 2016 @06:13PM (#11178614)
I disagree with those saying that the impact of this type of attack is minimal.

Depending on the application it could significant implications. Imagine for instance if this was possible in an application, and after switching to the attacker's account the victim was tricked into doing an OAuth to some third party service.

Re:Hacker News CSRF Vulnerability by slavik81 on Thursday February 25, 2016 @05:22PM (#11178308)
Interesting. Is this why login is usually on its own page, rather than right on the main page? CSRF seems to limit your ability to cache any pages that contain forms.
Re:Hacker News CSRF Vulnerability by malka on Thursday February 25, 2016 @06:37PM (#11178750)
you could have an API that returns a CSRF token.
Re:Hacker News CSRF Vulnerability by stygiansonic on Thursday February 25, 2016 @04:05PM (#11177783)
Whether or not the implications of this particular CSRF vulnerability were serious, the developers should be commended on implementing a fix quickly.
Re:Hacker News CSRF Vulnerability by cmdrfred on Thursday February 25, 2016 @05:10PM (#11178239)
Nice find it goes to show you that nearly everything has some sort of vulnerability. Adding anti-forgery tokens to my login page now...
Re:Hacker News CSRF Vulnerability by ymse on Thursday February 25, 2016 @09:06PM (#11179397)
Would this still work with 3rd party cookies disabled?

In the years I've used uMatrix[0] I can't remember a single case where sending a cookie with a 3rd party request was needed. Why do browsers do this still?

0: https://github.com/gorhill/uMatrix

Re:Hacker News CSRF Vulnerability by hatsunearu on Thursday February 25, 2016 @06:30PM (#11178709)
I'm not too well versed on netsec; how do you fix something like this?
Re:Hacker News CSRF Vulnerability by etjossem on Thursday February 25, 2016 @06:35PM (#11178742)
To mitigate CSRF on a form, send the user a randomly generated, long, unique token every time the form is rendered. Put it in a hidden input.

Your server must expect the POST to answer back with a valid csrf token. Otherwise, the request results in an error and doesn't go through. Attacker pages won't know anything about the csrf token, so they can't forge the form.

Re:Hacker News CSRF Vulnerability by kogir on Thursday February 25, 2016 @07:09PM (#11178922)
That's actually not always enough. For example, to fix this login CSRF on HN, you need a per-visitor secret an attacker can't read (like a cookie) plus a form value based on that secret. Note it can't be tied to the user account, because the visitor hasn't logged in yet.

A random CSRF token on a login form is easily defeated - the attacker just requests a valid one and uses it when submitting the CSRF form.

Re:Hacker News CSRF Vulnerability by etjossem on Thursday February 25, 2016 @08:26PM (#11179253)
Correct. By "a valid token" I mean one that corresponds to the user session it was dispensed to.
Re:Hacker News CSRF Vulnerability by jonny_eh on Thursday February 25, 2016 @07:30PM (#11179028)
> the attacker just requests a valid one

How?

Re:Hacker News CSRF Vulnerability by kogir on Thursday February 25, 2016 @07:42PM (#11179082)
wget, curl, whatever. If I'm the attacker, I ask for a new one from my server each time and put the result in the form I serve your browser.
Re:Hacker News CSRF Vulnerability by r1ch on Thursday February 25, 2016 @08:11PM (#11179209)
The CSRF token should be tied to the user session, so you'd need to perform session fixation for that to work.
Re:Hacker News CSRF Vulnerability by ubernostrum on Thursday February 25, 2016 @09:10PM (#11179407)
Tying to the session is a common practice but not necessary. You can do non-session-tied CSRF tokens so long as you don't expose your cookie.
Re:Hacker News CSRF Vulnerability by kogir on Thursday February 25, 2016 @08:52PM (#11179353)
That works if you have sessions. HN doesn't.
Re:Hacker News CSRF Vulnerability by Osiris on Thursday February 25, 2016 @04:23PM (#11177912)
So what was the fix? I don't see a CSRF token in the login page, so I'm curious what their patch was.
Re:Hacker News CSRF Vulnerability by philmander on Thursday February 25, 2016 @04:42PM (#11178061)
The logout link is rendered with the token in its query string
Re:Hacker News CSRF Vulnerability by VoidWhisperer on Thursday February 25, 2016 @05:19PM (#11178292)
Wouldn't this still allow logging in without consent if they aren't logged in?
Re:Hacker News CSRF Vulnerability by dang on Thursday February 25, 2016 @07:47PM (#11179106)
It does. We haven't rolled out the fix that Nick described (https://news.ycombinator.com/item?id=11178922) because it will probably break a bunch of the third party apps and scrapers that give people alternative interfaces to HN. Those have value and I'd rather not make their lives more difficult unless/until it's necessary.
Re:Hacker News CSRF Vulnerability by qjighap on Friday February 26, 2016 @07:36AM (#11181051)
Finally, some clarification on which hacker news it is. I care less about the hacker news with the "the"
Re:Hacker News CSRF Vulnerability by Osiris on Thursday February 25, 2016 @06:03PM (#11178559)
I have implemented CSRF for the public API I work on and all PUT/POST requests require the CSRF token, not GET requests. In this case, the login form uses a POST request and thus must require a CSRF token to avoid an attack on users that aren't logged in.
Re:Hacker News CSRF Vulnerability by kogir on Thursday February 25, 2016 @07:51PM (#11179125)
What stops an attacker from requesting the CSRF token?
Re:Hacker News CSRF Vulnerability by r1ch on Thursday February 25, 2016 @08:10PM (#11179204)
Same-origin policy.
Re:Hacker News CSRF Vulnerability by kogir on Thursday February 25, 2016 @08:52PM (#11179350)
That only applies to browsers. I can request it from my server just fine. See https://news.ycombinator.com/item?id=11178922
Re:Hacker News CSRF Vulnerability by _asdf_asdf on Thursday February 25, 2016 @04:43PM (#11178065)
Ah, CSRF, the irritatingly low-hanging fruit that every would-be security researcher pre-emptively attacks for attention.
Re:Hacker News CSRF Vulnerability by ronnier on Thursday February 25, 2016 @04:47PM (#11178094)
I don't understand the negative response towards CSRF exploits. They are real and they are dangerous.
Re:Hacker News CSRF Vulnerability by ryanlol on Saturday February 27, 2016 @06:34AM (#11186832)
The negative response tends to be against the super low impact ones, such as this.

I have to agree with the GP, blogging about an issue like this just seems tacky.

The reactions would undoubtedly be different if it was a practically exploitable CSRF, like something that allows you to change users email addresses.

Re:Hacker News CSRF Vulnerability by krapp on Thursday February 25, 2016 @05:05PM (#11178215)
If this had been reported in any other web application, everyone here would be calling the developers morons.
Re:Hacker News CSRF Vulnerability by ChristianBundy on Thursday February 25, 2016 @07:12PM (#11178934)
If it's such a low-hanging fruit why don't you prove it?
Re:Hacker News CSRF Vulnerability by totony on Thursday February 25, 2016 @09:12PM (#11179415)
How would you go about proving that?
Re:Hacker News CSRF Vulnerability by ubernostrum on Thursday February 25, 2016 @09:12PM (#11179414)
It's more that if literally any other site on the internet were found to have any type of CSRF vulnerability, people here would be going on and on and on about how this is web dev 101, only a complete idiot wouldn't know about/secure against CSRF attacks, etc.

Whereas here, when it's HN with a CSRF issue, "eh, it would break some third-party clients if we patched this".

Re:Hacker News CSRF Vulnerability by dang on Thursday February 25, 2016 @10:49PM (#11179693)
Tell me more about this world in which HN's users shield its developers from criticism.

We fixed the reported vulnerability and have a fix for the remaining issue ready if it's needed. There's no "eh" here; it's a question of what the right tradeoff is.

Re:Hacker News CSRF Vulnerability by ubernostrum on Thursday February 25, 2016 @11:06PM (#11179737)
Well, I don't see people insulting you the way they would if it were another site...

And I don't see people calling out the "breaks third-party clients" justification for not rolling out the full fix.

Re:Hacker News CSRF Vulnerability by dang on Thursday February 25, 2016 @11:11PM (#11179750)
Since you're a "people here", your comments disprove themselves.

A phrase like "calling out" assumes that it's obvious what we should do. It's not obvious; the parts that were obvious are done. Our goal is to do what's best for the community, not to avoid getting criticized on the internet.

Re:Hacker News CSRF Vulnerability by ubernostrum on Thursday February 25, 2016 @11:40PM (#11179830)
Since you're a "people here", your comments disprove themselves.

If I were going to respond to you the way I feel HN would generally respond to a CSRF hole in a major non-HN site/service, I'd say something like "Well, that line shows you're as good at formal logic as you are at preventing/patching CSRF holes".

You know the same as I do that HN's getting light treatment from its users in this thread, compared to how security issues in other things typically get received. It's OK to admit that.