News for hackers. Stuff that matters.
Re:Steam hit by major security breach by tptacek on Monday July 27, 2015 @12:00AM (#9953245)
Take a few minutes and re-evaluate your password reset scheme. They are treacherously difficult to get right. Every pentest we did, we made a beeline for the password reset functionality; it was often a cheap, quick gameover bug.
Re:Steam hit by major security breach by MattHeard on Monday July 27, 2015 @12:32AM (#9953356)
I spent a week consulting for a small education software start-up and was horrified when I saw that their password reset process was the following:

1. An anonymous person sends a message via Google Chat to the support Gmail address.

2. A staff member would ask the anonymous person for the username of the account for which to reset the password.

3. The anonymous person would present the username.

4. The staff member would reset the password and create a temporary password and would then give that anonymous person the password. The staff member would then explain how to change the password once the anonymous person had logged in with the temporary password.

I spent too long trying to explain to the staff and the CEO why it was a problem that any person could gain access to any account...

Re:Steam hit by major security breach by keithpeter on Monday July 27, 2015 @10:11AM (#9955278)
I'm a teacher in the UK. Educational systems range from the ridiculous like the one you mention to the ones who take it very seriously.

One employer some time ago would only do password reset if you turned up in person with photo ID. That organisation had quite a lot of students spread over a number of sites so it was labour intensive - the library staff used to be able to reset passwords and they had access to the student and staff badge photos. IT staff at a University I taught at for a year would only reset password if you went on a conference call with a manager level staff member who could confirm recognising your voice.

For a general access Web site available nationally and not tied to an institution I imagine you would have to fall back to the usual email reset code with challenge question type systems.

Re:Steam hit by major security breach by gauravagarwalr on Monday July 27, 2015 @06:14AM (#9954313)
If what you are saying is true; did they store the passwords in plain text as well?
Re:Steam hit by major security breach by ForHackernews on Monday July 27, 2015 @01:11AM (#9953452)
It wasn't a YCombinator startup, was it?
Re:Steam hit by major security breach by tripzilch on Monday July 27, 2015 @01:06PM (#9956490)
I doubt he's allowed to share that information (whether it is, or isn't), and you shouldn't tempt him to, either.
Re:Steam hit by major security breach by MattHeard on Wednesday July 29, 2015 @10:17PM (#9972880)
No, it was not.
Re:Steam hit by major security breach by _asummers on Monday July 27, 2015 @12:20AM (#9953323)
What are some examples of ways you've seen people screw them up?
Re:Steam hit by major security breach by tptacek on Monday July 27, 2015 @12:32AM (#9953354)
* Not being very careful with the lifecycle of a token.

* Encrypting tokens and expecting users to feed back the same encrypted token, and failing to authenticate.

* Simple parse errors and SQL injection on the tokens themselves.

* Exploitable generation (for instance, non-cryptographic RNGs) for the tokens themselves.

* Having multi-page flows starting from the receipt and validation of a reset token, and then having standard web flaws somewhere in that flow (for instance: userid is validated only at the start of the flow).

* Mishandling of cases where users have multiple outstanding reset requests.

* Accepting the email address to send token to from web user, validating the address, and then using the user input directly as the email address to send the token to; as in: systems that will send token to [email protected];[email protected].

One bug everyone has in their password resets: they don't cancel outstanding tokens when users change their passwords, so that long after a user has reset their password, their email boxes still contain password-equivalent tokens. That's not a high-severity bug, but it's a meaningful one.

Re:Steam hit by major security breach by ghuntley on Monday July 27, 2015 @12:36AM (#9953366)

    * Accepting the email address to send token to from web user, 
      validating the address, and then using the user input directly
      as the email address to send the token to; as in: systems that
      will send token to [email protected];[email protected].
Ouch, that's really devious and extremely clever.
Re:Steam hit by major security breach by noir_lord on Monday July 27, 2015 @02:33AM (#9953686)
I think that might work on one of the apps I maintain.

Sigh adds to wunderlist

Re:Steam hit by major security breach by __david__ on Monday July 27, 2015 @03:55AM (#9953931)
I'm missing something here... How does "[email protected];[email protected]" validate as "[email protected]"? Is this a regexp vs strcmp() issue or is there something more subtle at play?
Re:Steam hit by major security breach by pfg on Monday July 27, 2015 @04:05AM (#9953962)
One scenario I can imagine is a regex which doesn't properly handle multi-line inputs (quite common issue in ruby[1]). Together with a mail header injection vulnerability, this input could be dangerous:

  [email protected]\nCc:[email protected]
[1]: http://guides.rubyonrails.org/security.html#regular-expressi...
Re:Steam hit by major security breach by mikeash on Monday July 27, 2015 @11:51AM (#9955873)
Total speculation, but maybe they're trying to be clever and accept things like "John Doe <[email protected]>" as being equivalent to "[email protected]" and end up using a full e-mail parsing library for the matching which is more capable than they realize?
Re:Steam hit by major security breach by AUmrysh on Monday July 27, 2015 @03:37PM (#9957491)
It may send it to multiple addresses. I know in outlook and in .NET libraries, the semicolon is the delimiter for multiple email addresses.
Re:Steam hit by major security breach by mpeg on Monday July 27, 2015 @04:17AM (#9953998)
Might have been validated in step1, but the email goes out to the email in a hidden field in step2, etc.
Re:Steam hit by major security breach by _asummers on Monday July 27, 2015 @12:42AM (#9953383)
> * Accepting the email address to send token to from web user, validating the address, and then using the user input directly as the email address to send the token to; as in: systems that will send token to [email protected];[email protected]

If you do a "is this even a valid email?" check and a "exists user by email" check with that input (assuming no SQLi, of course), would this even be possible? I'm failing to see what the vulnerable code would look like in that scenario.

> One bug everyone has in their password resets: they don't cancel outstanding tokens when users change their passwords, so that long after a user has reset their password, their email boxes still contain password-equivalent tokens. That's not a high-severity bug, but it's a meaningful one.

This is solved by simply deleting the tokens after reset, correct?

Re:Steam hit by major security breach by TheDong on Monday July 27, 2015 @02:25AM (#9953667)
If you're saving a token in the database to delete, you're doing it wrong anyways.

The right way to do that is to HMAC a string... see this blog post https://neosmart.net/blog/2015/using-hmac-signatures-to-avoi...

You can get expiration and many other nice things without having to worry about a whole class of other issues.

To make a password reset all previous reset tokens, simply include an autincrementing number for "passwordVersion" and stick that sucker in the HMAC as well.

Re:Steam hit by major security breach by ZoFreX on Monday July 27, 2015 @09:54AM (#9955179)
> If you're saving a token in the database to delete, you're doing it wrong anyways.

I think the strength of your statement here is not warranted – in the context of security, there's no flaw from doing that. Likewise, saying "HMAC" is "the right way"... well, I wouldn't agree with that.

If you do HMAC, you only have time-based expiry. Thomas was talking about tokens sitting in email inboxes that are still valid and are effective passwords... you can't make your HMAC tokens expire as soon as they're used, so that's still a concern.

Re:Steam hit by major security breach by pfg on Monday July 27, 2015 @03:24AM (#9953848)
One thing I like about keeping reset tokens in the database is that you basically get a free audit log (if implemented properly).

Some other disadvantages were pointed out in the previous discussion[1].

[1]: https://news.ycombinator.com/item?id=9053830

Re:Steam hit by major security breach by tripzilch on Monday July 27, 2015 @05:48PM (#9958241)
The top "disadvantage" discussion in that thread is about somebody messing up their links because they rolled their own base64 encoding with period characters in it ... or something like that. I'm not even sure what they were thinking, but there's nothing about keeping reset tokens in the database that would prevent their problem.
Re:Steam hit by major security breach by tptacek on Monday July 27, 2015 @11:32AM (#9955728)
Strong disagree. You are much better off saving tokens than you are in using HMAC or any other cryptography to try to extend your security boundary to email. There is more that goes wrong even with simple HMAC tokens than there is with opaque random tokens.
Re:Steam hit by major security breach by tripzilch on Monday July 27, 2015 @05:30PM (#9958145)
Can you shed some light about what could go wrong?

I remember reading about this HMAC/"no database" technique and thinking it was pretty cool.

Is it because you may want to encode more fields than just expirationTime, but also (say) lastLoginTime and such, so the GET URL would get awkwardly long (and possibly break in some email client), or is it something more fundamental than that?

Cause I thought that using the HMAC as a primitive was the right way to get hash-based authentication right, as opposed to messing around with actual cryptographic hashes.

Re:Steam hit by major security breach by ars on Monday July 27, 2015 @01:11AM (#9953449)
> This is solved by simply deleting the tokens after reset, correct?

They should also time out after a day or two and either invalidate or delete.

Re:Steam hit by major security breach by tptacek on Monday July 27, 2015 @12:53AM (#9953408)
Yep, that's what I think you should do.
Re:Steam hit by major security breach by SixSigma on Monday July 27, 2015 @01:02AM (#9953427)
Validating email addresses is non-trivial too.
Re:Steam hit by major security breach by tptacek on Monday July 27, 2015 @01:06AM (#9953436)
If you have to validate, you're doing something wrong (but this is a something wrong people do sometimes do). You should send email only to the string you saved in the database record for the user.
Re:Steam hit by major security breach by prawn on Monday July 27, 2015 @12:37AM (#9953370)
Does anyone catalogue best practice for these sorts of functions anywhere?
Re:Steam hit by major security breach by mAritz on Monday July 27, 2015 @04:08AM (#9953968)
Re:Steam hit by major security breach by nly on Monday July 27, 2015 @07:47AM (#9954588)
I'd add:

* Not requiring any additional authentication once you have the reset link from the e-mail

even reddit is vulnerable to this:

https://np.reddit.com/r/funny/comments/3egphk/icets_seen_som...

Re:Steam hit by major security breach by hesselink on Monday July 27, 2015 @08:06AM (#9954643)
How would you prevent that?
Re:Steam hit by major security breach by nly on Monday July 27, 2015 @08:26AM (#9954704)
There's no reason you couldn't have the user pick a new password before you send them the token. Just don't activate it. Leaking the reset token in this way looks unlikely, but there could be other vectors... like an attacker poisoning the sites DNS cache to intercept reset emails, or a state or database disclosure bug in your code.

It's fairly common to see reset tokens going in to the database verbatim, instead of treating them as passwords and stashing away a hash (single SHA is fine if your tokens are long and random).

Re:Steam hit by major security breach by tptacek on Monday July 27, 2015 @11:35AM (#9955749)
There is a reason not to do this: at the point where you cache the new password, you have no idea who's making the request. An attacker banks a trivial password into the password reset, triggers the email reset token, and waits for the unsuspecting user to click the link in the email. So you have the user enter the password again after clicking through the token. But now you have a condition where accounts are only as safe as it is difficult to get users to type an attacker-chosen string into a web form.
Re:Steam hit by major security breach by nly on Monday July 27, 2015 @12:11PM (#9956032)
Hmm, can you explain how this opens up new phishing vectors?. Sure, you could dress the reset page up like a promotion with an iframe and try and get the mark to enter a 'coupon code' or something, but that isn't going to work without the reset token. Password resets by email are already vulnerable to carefully timed phishing.
Re:Steam hit by major security breach by nchelluri on Monday July 27, 2015 @01:40AM (#9953534)
What is the "lifecycle of a token"?
Re:Steam hit by major security breach by Monory on Monday July 27, 2015 @02:58AM (#9953772)
Invalidating old token after few hours/days or after requesting new token.
Re:Steam hit by major security breach by nstart on Monday July 27, 2015 @12:49AM (#9953397)
just throwing in my experience here. I've seen a few sites that actually had the password reset request send them a url that was formatted as:

example.com/password_reset?username=<username>

You could basically type that in and replace <username> with any username you wished and reset their password.

The sad part was how obscenely long it took them to close those holes (couple of weeks).

Re:Steam hit by major security breach by _asummers on Monday July 27, 2015 @12:50AM (#9953402)
Whoah, that's frightening.
Re:Steam hit by major security breach by duncanawoods on Monday July 27, 2015 @03:04AM (#9953795)
Which libraries would you recommend for password handling?
Re:Steam hit by major security breach by pfg on Monday July 27, 2015 @03:13AM (#9953820)
This usually depends heavily on your language/framework. Coming from a ruby/rails background, I can recommend devise.
Re:Steam hit by major security breach by newman314 on Monday July 27, 2015 @07:44AM (#9954581)
Any list of best practices to follow?
Re:Steam hit by major security breach by 0xffffabcd on Monday July 27, 2015 @08:31AM (#9954723)