News for hackers. Stuff that matters.
Re:Show HN: A microservice that makes adding authentication ... by arekkas on Sunday February 19, 2017 @05:57PM (#13682682)
Never, ever use access tokens as proof of identity the way you are doing it. It makes you vulnerable to token substitution attacks. OAuth2 is not an authentication protocol.

https://oauth.net/articles/authentication/

DO NOT USE THIS in its current state. Stop upvoting this.

Re:Show HN: A microservice that makes adding authentication ... by imh on Sunday February 19, 2017 @06:54PM (#13683024)
I've been recently learning my way around web dev. Most of it is straightforward enough, but security is my sticking point. Everything on the web is contradictory, half explained, and rapidly changing. Seems like you know your way around best practices. Can you point to a decent trustworthy tutorial/book on how to handle logins and identity? Seems like lesson one is "don't implement it yourself" and lesson two is never quite spelled out.
Re:Show HN: A microservice that makes adding authentication ... by Cyph0n on Sunday February 19, 2017 @08:27PM (#13683501)
Agreed. The token should be used only after the user is authenticated through another channel (e.g., username+password).

Otherwise, an attacker could obtain the target's OAuth token by getting the target to provide the token to a malicious application. The attacker can then easily authenticate through your library.

Re:Show HN: A microservice that makes adding authentication ... by donpark on Monday February 20, 2017 @12:49AM (#13684654)
On OAuth 2.0 token substitution threat model: https://tools.ietf.org/html/rfc6819#section-4.4.2.6

Given that OAuth is all about delegated authorization, meaning entity that uses the access token may not be the user but some third-party service using the token on behalf of the user, using it as proof-of-identity makes no sense.

This point becomes clearer with limited permissions. If access token is proof-of-identity, why limit what the user can do when you know it's the user?

Re:Show HN: A microservice that makes adding authentication ... by ziikutv on Sunday February 19, 2017 @06:03PM (#13682717)
Upvotes happen from titles only
Re:Show HN: A microservice that makes adding authentication ... by rblatz on Sunday February 19, 2017 @07:50PM (#13683317)
So how would this apply to using a JWT as a bearer token?
Re:Show HN: A microservice that makes adding authentication ... by snuxoll on Sunday February 19, 2017 @08:29PM (#13683514)
JWT is designed for authentication, it's what OpenID connect is based on (in conjunction with OAuth 2.0).
Re:Show HN: A microservice that makes adding authentication ... by arekkas on Monday February 20, 2017 @02:59AM (#13685348)
No. A JSON Web Token defines a compact and self-contained way for securely transmitting information between parties as a JSON object
Re:Show HN: A microservice that makes adding authentication ... by homakov on Monday February 20, 2017 @12:55AM (#13684679)
That attack is trivially fixed - just inspect token and see its app id. But no one should use oauth for auth.
Re:Show HN: A microservice that makes adding authentication ... by pluma on Monday February 20, 2017 @03:55AM (#13685621)
Maybe I'm missing something but isn't every single "social login" effectively using OAuth for auth?
Re:Show HN: A microservice that makes adding authentication ... by homakov on Monday February 20, 2017 @05:35AM (#13686155)
Yes. Some apps without sensitive info can do it, but that's it.
Re:Show HN: A microservice that makes adding authentication ... by pluma on Monday February 20, 2017 @10:39AM (#13688119)
So in other words StackOverflow etc (i.e. all non-trivial apps that support third-party login via OAuth) are all broken from a security POV?
Re:Show HN: A microservice that makes adding authentication ... by homakov on Monday February 20, 2017 @01:54PM (#13689862)
In one way or another. Most are vulnerable to bugs in standard (see sakurity.com/oauth) but every single one depends on central authority which is just stupid for auth.