News for hackers. Stuff that matters.
Re:Show HN: PAST, a secure alternative to JWT by tptacek on Thursday January 04, 2018 @10:51AM (#16071232)
This is the logic people use when they encrypt cookies to public keys. I've never tested a system with public key encrypted cookies that wasn't broken. As a general rule of thumb: public key is what you use when you have no other choice.

PAST mitigates the risk somewhat by hardcoding a public key system into its version. But I'm still recoiling from the kind of first-principles mixing of systems security and cryptography that happens when people find new reasons to deploy public key primitives.

Note that one of the first crypto bugs in JWT stemmed from how it used curve public key crypto.

Re:Show HN: PAST, a secure alternative to JWT by giaour on Thursday January 04, 2018 @11:51AM (#16071806)
I think you're conflating the 'seal' and 'sign' use cases. I'm not sure how one could design a secure system where encrypted cookies could either be read by everyone (encrypted with private key) or forged by everyone (encrypted with public key), but using public keys to validate that an attestation was signed by a trusted third party is both sound and commonplace.

For example, this is how identity tokens from AWS Cognito are verified. They are RS256 JWTs signed with Cognito's private key, and any server can download Cognito's public key to validate that the tokens were issued by Cognito and haven't been subsequently altered (without having to make a network call to Cognito to request validation).

Re:Show HN: PAST, a secure alternative to JWT by CiPHPerCoder on Thursday January 04, 2018 @03:06PM (#16073589)
On that note: https://github.com/paragonie/past/issues/13

I might be dropping "seal" entirely, as its utility isn't really a good fit for security tokens. (Sealing APIs can be very useful in other contexts, though.)

Re:Show HN: PAST, a secure alternative to JWT by davewritescode on Thursday January 04, 2018 @12:36PM (#16072201)
Was just going to post this, JWT with public keys is very handy for stateless verification of claims, which is what it seems was the primary motivator of the spec.

As someone who had to work with XML-DSIG, JWT seems less bad :)

Re:Show HN: PAST, a secure alternative to JWT by lvh on Thursday January 04, 2018 @12:43PM (#16072277)
You don't need public-key crypto to do stateless verification of claims. Secret-key crypto does that just fine. You need public-key crypto if you want _other people_ to be able to verify the claims -- that's an important distinction, because it specifies what you're buying for your much more complicated crypto.
Re:Show HN: PAST, a secure alternative to JWT by WorldMaker on Thursday January 04, 2018 @01:32PM (#16072759)
Or stateless verification when "other people" are allowed to create claims. There are certainly federation scenarios where PKI alone could be sufficient (as opposed to complex handshakes such as OpenID Connect or SAML). Obviously in accepting those claims you get to treat every claim with a giant grain of salt, but there are auth models where that makes sense (the only claim I need to trust is the certificate itself scenarios, for example).

That said, very few people want such a security scheme and as theoretically simple as it is on paper, it quickly ramps up to the real world complexity of PKI key management.

(I could see a small use for web APIs for developers and power users that allowed, for instance, Keybase-verified claims like HN account name/FB name/email, for very simple and easy to curl/iwr/httpie from the command line using Keybase-managed keys.)

I'm not sure if that small window of opportunity is worth the support complexity in PAST here, but given the model of support only specific versions, having them as separate verbs (sign/seal) makes it easy to block claims you don't expect. The one flipside from an API design standpoint that I see is that leaves a need for some sort of header like X-Accept-PAST: v2.auth

Re:Show HN: PAST, a secure alternative to JWT by lvh on Thursday January 04, 2018 @02:12PM (#16073138)
I’m not sure I follow: if the other party is allowed to create claims too, symmetric crypto seems more obvious. That’s what NS (and later KRBv5) did in the seventies. Or is that precisely what you’re saying?
Re:Show HN: PAST, a secure alternative to JWT by e12e on Thursday January 04, 2018 @05:00PM (#16074480)
Kerberos vouching hinges on "ticket-granting server says...", and you know that because the tgt shares a secret with every player. On the face of it, it'd be much easier to just demand everyone know the tgt's public key (no need for N keys on the tgt for N participants).

I've long considered the merits of a kerberos-like system built on top of something like nacl... But without out-of-the-box support from all kinds of systems... It'd essentially build down to ssh+certificates with expiration dates... So i've gathered "better CA for ssh" is the better product. And there are thankfully a couple of projects in that vein (teleport, netflix/bless, others?).

[ed: i should add: I think tptacek is absolutely right about public key systems being easier to get wrong; but part of that is also the problem domain: look at the history of security issues with Kerberos (both implementations and protocol evolution) for a great example. On the face of it NxN key exchange is "text book simple; should be easy to define, a little tricky to scale". Then there's replay, clock drift, (de)serialisation, nounces, large number of session keys (secure random numbers)...]

Re:Show HN: PAST, a secure alternative to JWT by WorldMaker on Thursday January 04, 2018 @02:34PM (#16073328)
In a stateless, negotiation-less flow where you have no pre-existing relationship with the other party? Isn't that exactly the bootstrap that PKI was built for?
Re:Show HN: PAST, a secure alternative to JWT by lvh on Thursday January 04, 2018 @03:03PM (#16073551)
Aha, I missed the stateless negotiation-less flow. But yes, that's basically TLS as deployed in browsers :)
Re:Show HN: PAST, a secure alternative to JWT by kpil on Thursday January 04, 2018 @01:16PM (#16072602)
Public keys solve the key management problem. If you have just one or two tiers it's not a problem.

If you have thousands, you end up spending a lot of time on key distribution if you need individually distributed secret keys.

Re:Show HN: PAST, a secure alternative to JWT by lvh on Thursday January 04, 2018 @01:25PM (#16072690)
You say that, but best practice for systems that have that option (say, internal SAML IdPs) still means you do per-peer keys with the annoying key management problem so that you get cryptographic binding instead of relying on a bunch of broken RPs to validate audience restrictions (spoiler: they don't) and in some cases IdPs or middleboxes that need to add audience restrictions (spoiler: they don't either).

What you get is that the peer can't forge tokens. But you're trying to authenticate to them; they already have full authority. So what are you fixing? (I'm not saying it's "nothing", but I am saying it's very little, and it's definitely plausible the increased risk isn't worth it.)

What do you mean by "tiers" here? The specificity of that word suggest you don't just mean "peers", but at the same time clearly symmetric systems win at nested delegation. (krb5, macaroons come to mind)

Re:Show HN: PAST, a secure alternative to JWT by zeveb on Thursday January 04, 2018 @05:01PM (#16074484)
> What you get is that the peer can't forge tokens. But you're trying to authenticate to them; they already have full authority. So what are you fixing? (I'm not saying it's "nothing", but I am saying it's very little, and it's definitely plausible the increased risk isn't worth it.)

You get something you can show to a third party: 'see, the bank said their client was good for $10,000!' I can see where that might be useful.

Re:Show HN: PAST, a secure alternative to JWT by lvh on Thursday January 04, 2018 @05:52PM (#16074875)
I don't think I could've made my own point this elegantly. Eventually trying to disprove what the other party is saying is literally the opposite of what normal token schemes (say, SAML or OIDC JWT) is trying to accomplish: trying to establish what the other party is claiming.
Re:Show HN: PAST, a secure alternative to JWT by tptacek on Thursday January 04, 2018 @05:43PM (#16074810)
This feels like grasping at straws.
Re:Show HN: PAST, a secure alternative to JWT by lvh on Thursday January 04, 2018 @12:43PM (#16072271)
I don't understand the conflation. 'tptacek is arguing that you preferentially use secret-key crypto to public-key crypto, because public-key crypto is significantly more precarious. It seems like you are raising a new point, not arguing with his.
Re:Show HN: PAST, a secure alternative to JWT by giaour on Thursday January 04, 2018 @12:52PM (#16072356)
tptacek was saying everyone should be cautious about PKI-based JWTs and provided encrypted cookies as an example of something that is rarely (if ever) implemented safely and securely with PKI cryptography. My point is that while the 'seal' function of PAST may be of questionable value, the 'sign' function is not. I think it's important to disambiguate those two uses of asymmetric cryptography.
Re:Show HN: PAST, a secure alternative to JWT by lvh on Thursday January 04, 2018 @01:06PM (#16072508)
Gotcha, thanks! That makes more sense now.

I agree that they're worth examining separately, but the more general point still stands that there is a lot more that can go wrong with sign than with aead. The arguments for broken RSA-encrypted cookies apply similarly to broken signed cookies. It's not clear to me for example that an invalid curve attack against seal is intrinsically worse than a nonce (ab|re)use bug against ECDSA.

Re:Show HN: PAST, a secure alternative to JWT by grogenaut on Thursday January 04, 2018 @11:04AM (#16071364)
Your points sound very interesting but don't provide any details. Could you provide more details, I'm interested in learning about this.

For instance is there a good resource you use on what are good alternatives when you think you need to use PKI when in fact there are better alternatives?

Is there a good resource on how to use JWT correctly that you trust?

(Edited-tone, was a bit more aggressive but was pointing out the opportunity to educate instead of just say things are bad).

Re:Show HN: PAST, a secure alternative to JWT by yuhong on Saturday January 06, 2018 @02:51AM (#16084329)
JWS and JWE aren't as bad as JWT itself. You can use them without the JWT header.
Re:Show HN: PAST, a secure alternative to JWT by tptacek on Thursday January 04, 2018 @11:14AM (#16071461)
I'm pretty comfortable with the makeup of the subset of HN readers that take me seriously and/or understand where I'm coming from, and so I'm going to avoid litigating with strangers on this one.
Re:Show HN: PAST, a secure alternative to JWT by zimpenfish on Thursday January 04, 2018 @11:22AM (#16071530)
But that also means you're missing the opportunity to educate the rest of the HN readers who would like to understand -why- something is bad (like me because we're rolling out public key JWTs). Even just a link to a blog post would be better than just "because I'm me and people agree".
Re:Show HN: PAST, a secure alternative to JWT by atmosx on Thursday January 04, 2018 @01:12PM (#16072564)
Here:

https://storify.com/jcuid/thomas-h-ptacek-don-t-use-json-web...

https://news.ycombinator.com/item?id=13866883

https://kev.inburke.com/kevin/things-to-use-instead-of-jwt/

or go with the flow:

https://www.google.gr/search?q=ptacek+jwt&oq=ptacek+jwt&aqs=...

He has countless comments preaching against JWT and DNSSEC.

Mind you, I know the nickname, I know he is good with sec (I'd hire him to vet an app) and all but I don't know him IRL or ever heard of him before joining HN ... that's to say that he spent a lot of digital ink discussing these two topics here. The subset he's talking about, should amount for more than 50% of the regulars I guess.

Re:Show HN: PAST, a secure alternative to JWT by zimpenfish on Friday January 05, 2018 @05:37AM (#16077807)
The HN link doesn't explain why public key JWTs are bad; it's just more "don't use JWTs" (with the exceptionally unhelpful "as engineers, you need to understand first and foremost that JWT is bad". How can we understand if all we get is "JWT is bad because I say it is"?)

The Storify link is slightly more useful but again doesn't really explain anything - it's just bullet points of "I think these things are bad in a standard" which is great if you already have the knowledge of those things. Utterly useless otherwise.

And if "implementation errors should lower your opinion of a specification" means we shouldn't use JWT, where does that leave us on WIFI, SSL, HTTP, speculative execution in pipelines, ...?

Re:Show HN: PAST, a secure alternative to JWT by tptacek on Friday January 05, 2018 @11:33AM (#16079598)
To me, this rebuttal reads, "I don't understand it, ergo it must be dubious".

I'm criticizing JWT. Not you, or any other developer. If you don't understand or follow or agree with my criticism, that's OK. We can still live our lives.

Re:Show HN: PAST, a secure alternative to JWT by zimpenfish on Friday January 05, 2018 @12:13PM (#16079874)
> To me, this rebuttal reads, "I don't understand it, ergo it must be dubious".

That is not intended - it's more "I don't understand it, I'm happy to believe it's broken but all we get is Appeal To (self)Authority as to why rather than actual usefulness."

> If you don't understand or follow or agree with my criticism, that's OK. We can still live our lives.

Well, sure, but wouldn't you prefer to help people who don't understand by actually explaining something for once?

Re:Show HN: PAST, a secure alternative to JWT by owenmarshall on Thursday January 04, 2018 @11:27AM (#16071570)
So I trust you completely here - but I lack the crypto chops to understand why that’s the case, and I’m interested in understanding.

Do you have any good recommended primers that’d help me get it?

Or should I just get off my arse and finally do cryptopals? ;-)

Re:Show HN: PAST, a secure alternative to JWT by andrewaylett on Thursday January 04, 2018 @02:46PM (#16073406)
Having started it but to my shame never managed to finish -- children having got in the way -- I wholeheartedly recommend the latter approach.
Re:Show HN: PAST, a secure alternative to JWT by wglb on Thursday January 04, 2018 @05:09PM (#16074550)
I would recommend doing cryptopals in any case. It will give you a good background on this and other crypto topics so you can evaluate for yourself.
Re:Show HN: PAST, a secure alternative to JWT by grogenaut on Thursday January 04, 2018 @11:21AM (#16071516)
I'd still love to know the details.
Re:Show HN: PAST, a secure alternative to JWT by WhitneyLand on Thursday January 04, 2018 @12:22PM (#16072075)
My speculative interpretation (which Thomas may disavow completely) is that not that eadmund was doing something technically broken, as much as adding complexity, and risk of mistakes somewhere along the chain, without benefits to justify doing so.

If you listen closely, some security wisdom could applies to a lot of specialties. For ex this quote is about authenticated encryption, but it's not really bad advice if you change the subject from encryption, to rolling your own web server:

"Authenticated encryption is something you should use as a complete package, implemented as a single unit by a well-reputed open source cryptographic library and not assembled piecemeal by people who do not specialize in cryptography."

So what's the difference then? The stakes are higher. Serve the wrong web page, you'll be working on a bug. Be careless with security primitives, you could make a fortune 500 stock price go down, or make your CEO have to issue a press release, which tends to not to reflect well on your performance review.

In this light, "finding new reasons" I would infer to mean deviating from established best practices in any way without a damn good reason, even then without that reason being challenged and vetted.

All of the creativity in security should be in the research. For production implementations I don't want any creativity. Ideally, I'd want prod to be the opposite of research: Conservative and uncreative, struggling to stay awake because it's so boring and uneventful.

Re:Show HN: PAST, a secure alternative to JWT by grogenaut on Thursday January 04, 2018 @12:38PM (#16072229)
Sure, I get all that, I want the technical details though. Or pointers to where I can learn more. His advice says what not to do but not really what to do or where to learn more.
Re:Show HN: PAST, a secure alternative to JWT by lvh on Thursday January 04, 2018 @01:18PM (#16072614)
(Hi I'm not 'tptacek, I work with him but don't speak for him)

If you just want a few examples of stuff that can go wrong that doesn't go wrong if you just use a stored token instead of crypto, or doesn't go wrong if at least you use symmetric crypto instead of asymmetric crypto:

- Some bugs are about negotiation, e.g. key material misuse between RSA and HMAC schemes in JWT.

- Some bugs are about cryptographic implementation, such as not reusing nonces for ECDSA or RSA padding oracles or RSA keygen vulns (see Infineon bugs a few months ago). These are almost exclusively in the asymmetric crypto camp.

- Some bugs are about specification issues, such as non-mandatory aud (audience) and exp (expiry). You don't have specification issues if your tokens are opaque random numbers. You have significantly less bad/fewer specification issues if your tokens are versioned and you don't allow negotiation.

Re:Show HN: PAST, a secure alternative to JWT by hirsin on Thursday January 04, 2018 @12:39PM (#16072232)
If you're open to questions, I'd be curious for your take on token binding as well, as that seems to be in the same ballpark (or same sport at least).
Re:Show HN: PAST, a secure alternative to JWT by lawnchair_larry on Thursday January 04, 2018 @02:44PM (#16073394)
This is actually pretty common and I don't think there is a better way to do it. I am surprised you haven't encountered these systems in cloud environments, particularly where multiple organizations (or just untrusted networks) are involved. Or maybe I'm misunderstanding your criticism.
Re:Show HN: PAST, a secure alternative to JWT by xir78 on Thursday January 04, 2018 @04:56PM (#16074442)
How do you support multiple keys and key rotation without using RS256?
Re:Show HN: PAST, a secure alternative to JWT by sumnulu on Thursday January 04, 2018 @11:25AM (#16071560)
> As a general rule of thumb: public key is what you use when you have no other choice.

I think you mean, "private" key is what you use when you have no other choice.

Re:Show HN: PAST, a secure alternative to JWT by lvh on Thursday January 04, 2018 @12:41PM (#16072260)
No: he's using public key as in public-key cryptography, as opposed to secret-key cryptography.
Re:Show HN: PAST, a secure alternative to JWT by dullgiulio on Thursday January 04, 2018 @12:49PM (#16072328)
I think "public key" as in "asymmetric cryptography with public key."
Re:Show HN: PAST, a secure alternative to JWT by tptacek on Thursday January 04, 2018 @11:33AM (#16071616)
No, that's not what I mean.