6 ms·
Matt Green gave a pretty good summary of this: https://twitter.com/matthew_d_green/status/995989254143606789 https://twitter.com/matthew_d_green/status/99598925
by baby 9y ago
Matt Green gave a pretty good summary of this: https://twitter.com/matthew_d_green/status/995989254143606789 https://twitter.com/matthew_d_green/status/99598925414360678...
Some of these thoughts are echoed by Filippo:
> No, in 2018 you don’t get to claim the high ground and blame users and implementations if your crypto API returns the plaintext on a decryption error.
from https://twitter.com/FiloSottile/status/996010161427935233 https://twitter.com/FiloSottile/status/996010161427935233
So yeah, most clients seem vulnerable but since the command line utility that pretty much no lambda users use is not broken HN is saying that this is a joke?
As for contacting the PGP team, I've tried reaching out Werner Koch many time for a vuln in libgcrypt without success. That was 2 years ago, the vuln is still there.
- aepiepaey 9y agoSo what would you expect GPG to do when invoked to operate on a pipe (rather than a file¹)? Buffer (possibly) gigabytes of decrypted data in memory, just to be able to discard it once DECRYPTION_FAILED is detected? ¹: where GPG does the right thing
- tptacek 9y agoYes. It has one job!
- Xylakant 9y agoAren’t modern ciphers checksummed and authenticated blockwise? If so, you could just abort the moment you see a broken block. Anything before that block would not be under the attackers control and harmless.
- tptacek 9y agoModern AE schemes are designed to make it easy to quickly abort the whole decryption operation as soon as an error is detected. But the PGP protocol is from the 1990s, and uses vanilla CBC or CFB and then tacks the SHA-1 hash of the plaintext to the end of the message in a separate record.
- Xylakant 9y agoSo the reasonable answer for me would be “go forth and use a modern scheme by default.”
- rocqua 9y agoThe issue there is that if you call something PGP, people expect backwards compatibility, but if you switch to a different mode of encryption that becomes a massive pain.
- Xylakant 9y agoGood old SSH managed to update ciphers. This is certainly easier if Server and client can negotiate, but it’s not impossible for GPG. You could start by adding better modes as an option, later make them default and ask for confirmation when decrypting an old message format. If I read the vulnerability description correctly, it allows stripping the message authentication signature and then trick the client into decoding it. So any message sent with a modern cipher or just requiring message authentication by default would have substantially mitigated the attack.
- rocqua 9y agoIt is possible, but note that SSH is interactive and always had multiple ciphers. On PGP, as far as I can tell, there is no field for the cipher used. So you somehow need to introduce that field somewhere, but be able to deal with files that do not have that field. Possible but very tedious. The non-interactivity seems like it makes it harder to 'negotiate' a version. As there is no way to get clarification. At the same time, you need to be careful against downgrade attacks.
- Xylakant 9y agoSure, as I mentioned, it’s easier if you can negotiate ciphers. But on the upside, there’s no downgrade attack. If the sender uses a modern cipher, the receiver either supports it or can’t decode the message. Still, that’s not a hard reason to not introduce protocol changes like new ciphers and a new field. Funny that you mention that since currently GPG on my Ubuntu spits out warnings about some feature it does not understand in files encrypted with a newer GPG on my fedora. This actually trips up some of my tooling.
- sp332 9y agoRelevant comment from Werner Koch: https://twitter.com/FiloSottile/status/996011473112576000 https://twitter.com/FiloSottile/status/996011473112576000 Either GPG buffers the data and checks for DECRYPTION_FAILED, or the application depending on GPG does. Of the two options, it makes much more sense for GPG to handle this.
- tptacek 9y agoThis is shades of the curl maintainer rationalizing CURL_SSL_VERIFYHOST=1 not doing any checking, because CURL_SSL_VERIFYHOST=2 does.
- jwildeboer 9y agoDECRYPTION_FAILED should always result with an empty return. Not with the decrypted content.
- slrz 9y agoThe application is likely better equipped to do something reasonable if temporarily storing lots of data is in order. Still, GnuPG could do the buffering automatically for small messages and force explicit configuration otherwise. The latter might not be realistically enforcable given the compatibility constraints.
- eigengrau 9y agoIt might be prudent to have GnuPG return an error exit code instead of just printing a warning on stderr. Currently, it seems that clients (at least when using the shell interface) are supposed to parse the error stream. And even when they do (which many probably don’t), it’s not necessarily obvious that the presence of warnings indicates to the client that the data should not be used.
- shinigami 9y agoIt should split it in chunks and authenticate each one of them. Then the worst attack would be the ability to truncate the file, and it could be at least detected. Unfortunately this is not supported by the PGP spec, or any other well established spec.
- tptacek 9y agoWhat's happened here is that GPG has used the OpenPGP spec as excuse to support extremely insecure default behavior. In reality, GPG can simply buffer and check before writing to stdout, and, in the rare cases where messages are too large to buffer, a flag can be used to override the secure default.
- rocqua 9y agoIf the message is too large to buffer, one might also first just decrypt and stream the plaintext into sha-1. Once the MDC clears, you can just decrypt again, this time writing to stdout.
- tedunangst 9y agoThis is difficult if the input is a nonseekable stream, but that doesn't excuse producing bad output.
- tptacek 9y agoThat's why I didn't suggest it, but to be fair, you could tee the stream into an intermediate file for a two-pass scheme.
- shinigami 9y agoI agree they should have done that as a stopgap measure, but we should push for security in all cases (e.g. streaming AEAD with STREAM or CHAIN https://github.com/miscreant/miscreant/wiki/STREAM https://github.com/miscreant/miscreant/wiki/STREAM )
- julian37 9y agoIt could also buffer the ciphertext, doubling CPU time but meaning that message size is constrained by disk space rather than available RAM.
- deleted 9y ago[deleted]
- Natanael_L 9y agoYes. Show me the right message or nothing at all.
- segmondy 9y agoJust curious, why didn't you submit a patch?
- jakobegger 9y agoNot the OP, but finding a vulnerability is a very different skill compared to fixing a vulnerability.
- baby 9y agoI can't remember but I was probably too swamped back then, I should do it though.
- scandox 9y agoI think what people are saying is that this has been represented as an intrinsic flaw in PGP and that this may cause the media to basically say PGP is broken. I agree that this is significant because it affects many users and the potential effect is extremely negative. On the other hand if the headlines on this were more focused I think people on HN would not have reacted so negatively.
- baby 9y agoWhen almost all implementation of PGP are broken, can we say PGP is broken?
- ComodoHacker 9y agoBut in MOV SS/POP SS case we don't say Intel chips are broken, we fix the OSes and the docs.
- Natanael_L 9y agoWhy not both? Documentation can also be faulty
- LinuxBender 9y agoIs PGP broken? Or the plugins that make PGP easier to use email, that are rendering HTML, or those perhaps what is really broken?
- tptacek 9y agoPretty much the whole cryptography field has been saying PGP is broken for something close to a decade now; the attack published today is an applied refinement of theoretical tools we've had for a very long time. The MAC of a PGP message is the SHA-1 of its plaintext appended to the message. There are coherent ways to downplay today's announcement, but "PGP isn't broken" isn't one of them. The best you can do is "PGP is broken but we already knew that".
- dangerface 9y agoNo, in CURRENT_YEAR you don't get to not handle errors, and blame the api when theres errors.
- eyeareque 9y agoIt’s known that remote image loading is bad. Why is this even enabled? I think they get a pass on this, it’s definitely a bit over blown.
- rocqua 9y agoThe issue is apparently that pgp outputs the plain text to a pipe before checking the MAC in the message. Instead, they provide an error code when the MAC doesn't fail. Apparently a lot of implementations don't check for this error. In general, this leads to message malleability. Malleability is always bad. It just so happens that in this example, they used malleability to sneak in <img> tags. So the issue here is that PGP outputs plain text even when the message fails the MAC check.