3 ms·
That's a general description of the problem, but the more pragmatic question to ask is "why do we support explicit curve parameters at all?". In practice, nobod
by tptacek 7y ago
That's a general description of the problem, but the more pragmatic question to ask is "why do we support explicit curve parameters at all?". In practice, nobody uses them; virtually no organizations are even qualified to use them. Many platforms don't support them at all; it's not as if there's a serious compatibility argument for them.
The right response to this vulnerability is to jettison support for anything but named curves.
This is probably an inside-baseball argument for people who don't pay attention to elliptic curve implementation details. But it's easy to quickly understand.
Go to SAFECURVES.CR.YP.TO; you'll see a big long list of curves, each with their parameters and some implementation details. In reality, only a subset of these curves are commonly used (P-224, P-256, Secp256k1, and Curve25519 probably account for 95% of all curves).
Further, most specific curves are implemented not as parameters plugged into a generic elliptic curve scalar multiplication routine, but rather as curve-specific code (one of the major reasons we have different curves is to allow specific implementation optimizations). A browser that supports Curve25519 certainly uses Curve25519 code, not generic code.
The "explicit curve" feature that blew up on Microsoft is designed to allow people to specify their own parameters, not for well-known curves but for curves they themselves generated. Nobody does that. There was a time, in the long long ago, when people thought that might be a good idea; nobody thinks that anymore; everyone thinks the opposite thing. If anything, we're trying to get rid of a bunch of curves. Certainly we shouldn't be randomly supplying new Weierstrass curves.
So that's the problem here. A lot of cryptography engineers were probably surprised this CryptoAPI feature even worked. We had considered it awhile ago as a cryptopals challenge (and Sean actually did add it as one in Set 8 a few years ago), but we never dreamed anyone would be crazy enough to let this bug happen in the real world.
- sroussey 7y agoIf it can, it will... :)
- dfox 7y agoI believe that there are users who do produce keypairs with arbitrary explicit curves: NSA and its equivalents in other countries. Such agencies tend to like to use secret algorithms and generating your own curve for internal use is somewhat sane way to do that for ECC. In other words I would not be to surprised if NSA found this bug by accident because it caused some of their internal “secret” cryptosystem to not work at all instead of by actively looking for it.
- RcouF1uZ4gsC 7y agoMy feeling is that there has been a change in crypto. It seems in the past, crypto was a la carte. Over time, this has been shown to open up a big security vulnerabilities such as this one, and also issues with key agility in TLS, etc. I think the tendency today is to make make crypto more omakase where there are a few well studied, well implemented algorithms that you use for everything. The Windows CryptoAPI is from that older time.
- WorldMaker 7y agoA small part of the problem is that the omakase options do change over time with changes in threat models and knowledge of vulnerabilities. One example is the recent push away from the NIST Curves to the more open knowledge Curve 25519, in part because of reasonable concerns that the NIST Curves were backdoored by NSA for easier cryptoanalysis. So you still need "low level" a la carte tools underlying and backing the omakase experiences. Part of the problem of the Windows CryptoAPI in question is that it has to serve "both customers", the omakase sort that need the best option, and the a la carte needs to higher level tools serving as the omakase option. That is, for some traditional/legacy C/C++ users that CrpytoAPI is about as high level as they will get, and it's up to the documentation to steer its consumers to the best omakase options. But crypto32.dll also is the low-level backend of tools like WinRT's Windows.Security.Cryptography and .NET's System.Security.Cryptography (on Windows). The push towards omakase and somewhat getting applications away from micromanaging the a la carte stuff, definitely seems the smart path. Handling the onion of it all in what needs to be supported at a low level to keep the high level omakase shop running smooth seems like it still has a lot of pitfalls.
- tptacek 7y agoWithout addressing the thing about the NIST P-curves being backdoored, which is an extremely dubious proposition, I'll just say that whether you trust NIST or not, nobody should be using custom curves with TLS. Cryptographers have spent an inordinate amount of time working out, proposing, and competing with each other about what the best curves are, and what the best mechanisms for generating them are, and there are a wealth of named curves to pick from. I'd be happier if nobody used the P-curves (they're unsafe for other reasons). But that's got nothing to do with whether people should literally be plugging their own Weierstrass coefficients and base points into X.509. Standards should immediately deprecate support for explicit curve parameters.
- CiPHPerCoder 7y agoOf the remaining 5%, most of it's P-384.