WEBVTT

00:00.000 --> 00:01.440
Hello everyone.

00:01.440 --> 00:06.720
So, um, welcome to this year's email security talk at, um, DefCon.

00:06.840 --> 00:08.200
So, uh, my name is Jens Muller.

00:08.200 --> 00:13.240
I'm a PhD student at the Jeffrey Network Data Security at the University of, uh, Bochum in Germany.

00:13.400 --> 00:26.180
And, uh, this is joint work with the University of Applied Sciences in Münster, uh, on covert content attacks targeting PGP and asthma based encryption and digital signatures.

00:27.220 --> 00:32.500
Okay, so, um, what happened in the world of, uh, email security last year?

00:32.820 --> 00:33.480
E-fail happened.

00:33.480 --> 00:35.360
Some of you may remember it.

00:35.360 --> 00:38.280
It was one of the most important attacks of last year.

00:38.480 --> 00:40.320
Uh, why was E-fail so important?

00:40.600 --> 00:44.080
Because it was one of those attacks that come with a logo.

00:44.580 --> 00:59.600
Okay, and besides some click baiting headlines we've seen in the press, actually E-fail was a real world crypto issue targeting the cipher modes of operation in those PGP and asthma with a lot of things not fixed until today.

00:59.600 --> 01:08.360
So, when we did E-fail last year, we also stumbled across some minor bugs in, in email clients.

01:08.360 --> 01:19.540
So we thought it would be minor bugs, but then we looked deeper and, uh, then we found out, whoa, that's actually totally RFC standard, uh, behavior of email.

01:19.660 --> 01:22.060
And that's what I'm going to talk about today.

01:22.060 --> 01:33.960
So we are not going to do any math, not, no crypto, but super practical, uh, and super simple attacks against encryption and digital signatures in the context of email.

01:35.360 --> 01:37.520
Okay, so here's an outline of the talk.

01:37.520 --> 01:42.540
First I'm going to give you a short introduction on, uh, email and PGP and asthma.

01:42.760 --> 01:52.100
Um, then I'm going to come to the attacks on encryption and digital signatures and an evaluation of those attacks on 24 widely used email clients.

01:52.100 --> 02:00.960
Uh, and finally I'm going to show some count images so developers of email clients can protect, um, their customers from those attacks.

02:00.960 --> 02:04.460
Okay, let's start with technology's promise.

02:05.240 --> 02:19.300
So in the 90s we've heard, um, representatives of the cyber movement, cyberpunk movement claiming, like, strong crypto is mathematically unbreakable, use it, encryption for the masses.

02:19.300 --> 02:22.740
And they were right, of course, yes, we should use it.

02:22.820 --> 02:41.520
Um, and then we've heard other actors like government people, they didn't believe in mass encryption at that time, but they, uh, like to think about, well, in the year 2000 everybody will use, like, digital signatures to sign their business contracts and things like that.

02:41.520 --> 02:51.300
Which also didn't really happen, but, um, well it's based on the same idea that they're mathematically hard to solve, uh, problems, okay?

02:51.780 --> 02:55.660
Um, so, now let me ask the what if question.

02:55.860 --> 03:02.340
What if those claims could be bypassed with a single reply to a benign looking email?

03:02.580 --> 03:05.960
And that's what today's talk is going to be about.

03:07.040 --> 03:11.800
Okay, to fully understand, let me give you a brief history lesson on email.

03:11.900 --> 03:15.940
So, in the beginning there was ASCII text messages, okay?

03:15.940 --> 03:17.580
And it was good, okay?

03:17.580 --> 03:32.680
With a great signal to noise ratio, no spam, basically, and until today emails consist of, like, a header which contains, uh, information about maybe sender, recipient, subject, and so on, and a body containing the actual message.

03:33.020 --> 03:43.400
And because email back in the time was transferred usually over unencrypted insecure channels, um, people began to think about privacy, okay?

03:43.400 --> 03:49.780
So, Phil Zimmerman came up with this great idea of traditional PGP, PGP inline back then.

03:49.840 --> 03:59.160
So, which basically leaves the header as it is, but encrypts the text message body using public key crypto.

03:59.280 --> 04:01.580
And was good back at the time, okay?

04:02.520 --> 04:06.060
And then people came around and thought, well, we want to do more.

04:06.060 --> 04:12.560
We want not only to send text messages over email, we also want to send, like, binary data, binary files, and so on.

04:12.680 --> 04:16.360
Therefore, multipurpose in-chain mail extensions was born.

04:16.720 --> 04:25.340
So, with MIME email, you can, for example, send an email that contains of multiple parts of multiple data formats, okay?

04:25.340 --> 04:37.940
Like, for example, you could have a mixed multi-part message, uh, with multiple parts that are separated by some boundary, and in this example we have two plain text, two ASCII text messages.

04:38.400 --> 04:41.600
Okay, resulting in a structure like this.

04:42.100 --> 04:49.060
But you could also, of course, for example, use, uh, create an HTML email with a PDF attachment, okay?

04:49.060 --> 04:52.560
So, MIME, MIME is how modern email is used today.

04:53.540 --> 05:03.440
Okay, and then, um, based on the MIME standard, people came around with yet another, um, standard for email end to end encryption, which is S-MIME.

05:03.440 --> 05:09.580
You probably have heard about it, um, similar to PGP, but more used in, like, corporate environments.

05:09.740 --> 05:24.520
So, um, S-MIME defines the content type of application, PQSS7, MIME, and then encrypts and Base64 encodes the body of the email, which could, by itself, be a complete MIME structure.

05:25.440 --> 05:30.120
Okay, so how do you, um, encrypt your emails in, uh, 2019?

05:30.620 --> 05:47.120
So, we still have those two competing standards, like PGP, which is more used by journalists, activists, hackers, by us, and S-MIME, which is more used in business environments, or, like, by universities, you can afford running a central certificate authority.

05:47.420 --> 06:04.840
And besides the, the trust model, actually, both standards use more or less the same crypto, which is, which has a lot of flaws, and it's all crypto, but it's not, I'm not going to talk about crypto today, because the attacks I'm going to present now are basically independent of the actual encryption scheme,

06:04.840 --> 06:05.000
okay?

06:05.000 --> 06:07.760
Let it be PGP, or S-MIME, or whatever.

06:07.760 --> 06:15.340
At least, um, unless, um, so they must be used in the context of email, then we can probably, uh, apply them.

06:16.180 --> 06:19.900
Okay, so let me come to the attacks on encryption.

06:19.900 --> 06:22.680
So, our attacker model is super simple.

06:22.920 --> 06:28.760
The ETH trap, or ETH, has somehow captured ciphertext between two communication parties.

06:28.860 --> 06:39.460
It's quite a strong attacker model, obviously, but the only reason why you use end-to-end email encryption is that an insecure communication channel, of course, is presumed, right?

06:39.940 --> 06:48.880
So, um, what ETH now can do with the, uh, captured ciphertext email is she can modify the outer structure of the email.

06:49.000 --> 06:56.100
We do not do any ciphertext modifications, any bit-flipping today, but we modify the, the outer MIME structure, okay?

06:56.620 --> 07:14.640
And then she can re-send that modified email to the victim, which can either be the original sender, or the original recipient of the message, because emails are usually encrypted with the, uh, public key of both of them, so both of them should be able to decrypt the email later.

07:14.680 --> 07:20.180
Okay, both of them can be misused as decryption oracle.

07:20.240 --> 07:23.620
Um, so, here's an outline of the attack.

07:23.780 --> 07:31.720
The attacker ETH, um, sends a benign-looking, uh, email message that is visible to Johnny.

07:31.740 --> 07:42.940
And then she, um, appends some, um, something we call, um, um, covert content, like the hidden ciphertext part, okay?

07:42.940 --> 07:47.480
Which Johnny cannot really see, but Johnny's email client can parse it.

07:47.480 --> 07:57.300
So, for reasons we will see later, if Johnny replies to that, uh, message, um, to that harmless-looking message, he will leak the plain text to the attacker.

07:58.120 --> 08:00.380
Okay, how do we do that in practice?

08:00.680 --> 08:07.560
So, assume this is, um, a captured SMIME email from Alice to Johnny.

08:07.560 --> 08:11.320
Now, what could ETH possibly do with that email?

08:11.480 --> 08:17.560
So, of course, she can simply change the from address to her own address, so replies go to her, okay?

08:18.080 --> 08:27.520
And then what she can do is she can use this ciphertext part and wrap it into her own specially-crafted MIME structure.

08:27.740 --> 08:33.840
Okay, for example, she can prepend some ASCII text, resulting in a MIME tree like this.

08:34.960 --> 08:42.320
So, um, an email client would then, of course, parse that message and see this encrypted part and decrypt it, okay?

08:42.320 --> 08:43.820
That's what email clients do.

08:44.080 --> 08:48.580
So, this, uh, this message would be shown in Thunderbird like this.

08:48.720 --> 08:57.360
You have the attacker's part and the original ciphertext which got translated to the plain text, which got decrypted by the email client, okay?

08:58.240 --> 09:00.640
You see what I'm pointing you to.

09:00.640 --> 09:03.240
What happens if we reply to that message, okay?

09:03.240 --> 09:09.220
If Johnny replies to that message, he will also leak the secret message, he will leak the plain text.

09:09.820 --> 09:14.720
Well, Johnny is not the brightest guy on planet Earth, but Johnny is not super dumb either.

09:14.720 --> 09:17.360
He sees that something fishy is going on.

09:17.500 --> 09:24.100
But all we need now is some way to hide the existence of the second part.

09:24.280 --> 09:32.780
So, what we can simply do is some obfuscation, like add a lot of new lines, um, and if Johnny's in a hurry, he may already reply to that message, okay?

09:32.780 --> 09:36.860
Uh, and thereby leak the ciphertext if it doesn't scroll down.

09:37.140 --> 09:42.040
We could also hide it with some longer communication, um, history, or things like that.

09:42.040 --> 09:46.800
We could also use HTML and simply comment out the second part.

09:47.180 --> 09:54.100
So, if Johnny replies to that email, he sees nothing but a benign looking message and thereby leaks the plain text.

09:55.020 --> 10:15.440
So, if email clients do try to, uh, counter those attacks and enforce a strong isolation between multiple MIME parts, well, we can simply break that isolation using content ideas which allow you to refer from one MIME part to another part, which is in an RC standard.

10:15.440 --> 10:17.840
So, it's supported by most email clients.

10:18.880 --> 10:31.240
Okay, you may say, well, that's HTML issues, but, um, there are lots of other possibilities, like, for example, we could also define the second part as an attachment, use unicode tricks, encoding tricks, and so on.

10:31.240 --> 10:35.600
So, the takeaway here is that it's not an HTML issue, okay?

10:35.600 --> 10:37.200
The issue is MIME wrapping.

10:37.200 --> 10:45.460
Why is it possible to use the encrypted part in a completely different context, um, and then it's only engineering, um, to hide it, basically.

10:46.440 --> 10:50.240
Okay , so, um, I hope I can give you a demo for that one.

10:59.490 --> 11:01.310
I need some help here.

11:11.450 --> 11:13.170
Okay, so, can you sync the screens?

11:26.760 --> 11:27.780
Thank you.

11:27.800 --> 11:43.720
Okay, so, um, in this example we have, um, a captured, um, as my message, um, from the manager to Johnny, um, but it could also be PGP MIME or, or PGP inline or whatever.

11:43.720 --> 11:50.020
Now, Eve can, of course, modify the subject of that email and also change the from address.

11:50.020 --> 11:55.800
And what she does now is she wraps, simply wraps that encrypted part into her own MIME structure.

11:55.800 --> 12:01.960
In this example we have some HTML message, um, before the actual ciphertext part.

12:01.960 --> 12:07.420
And in this example we use some iframe to basically hide the second part.

12:07.800 --> 12:12.220
Okay, um, so, uh, let's send that email to poor Johnny.

12:12.220 --> 12:21.960
And what Johnny's email client, in this example, uh, Apple Mail, does is it will only, of course, display the first part because of the iframe.

12:22.040 --> 12:27.200
So it will only display something like, hello Johnny, I'm interested in your research, could me, could you tell me, blah, blah, blah.

12:27.200 --> 12:29.760
And because Johnny's a nice guy, he replies to that email, okay?

12:29.760 --> 12:31.700
He uses email as a communication medium.

12:32.380 --> 12:51.720
And in the reply to Eve, uh, you will not see anything visible, but if you look at the, if Eve looks at the source code, she will see that in the coded, uh, reply message, not only the visible part, but also the invisible part containing the, uh, ciphertext was,

12:51.720 --> 12:52.660
uh, coded.

12:56.520 --> 13:05.040
Okay, so, um , the takeaway here is that, um, you cannot only, um, leak one single ciphertext, okay?

13:05.040 --> 13:10.020
So the NSA could, for example, have captured hundreds of emails, um, over years.

13:10.020 --> 13:19.540
And then she wraps all of them into one specially crafted email, resends that email to the victim, and with one single reply, hundreds of plain text would be leaked.

13:20.740 --> 13:25.600
Okay, so, um, we thought, can we adapt those attacks maybe to digital signatures?

13:25.740 --> 13:28.700
So the, um, the outline is pretty much the same.

13:28.700 --> 13:41.000
Again, we, um, have some benign looking message, and in this case, what we want to do is we want to misuse the email client of Johnny, not as a decryption oracle, but as a signing oracle, okay?

13:41.000 --> 13:47.040
We want to obtain a validly signed, uh, message that displays I hereby declare war.

13:47.040 --> 13:52.540
Okay, Johnny is the commander-in-chief in this example, and we want to start false flag warfare.

13:53.160 --> 13:59.500
Okay, if Johnny replies to that message, he will sign, he will quote and sign, therefore, both parts.

13:59.880 --> 14:15.160
And for, for, with some tricks we will see, uh, in a second , we can resend that signed message to a third party, like to some army general, who will then only see a displayed string, which is signed by Johnny and says, I hereby declare war.

14:15.160 --> 14:22.420
So, hopefully, the army commander general will give some phone call to Johnny before actually starting that war, right?

14:22.700 --> 14:25.320
Okay, um, how can we do that in practice?

14:25.320 --> 14:46.000
Um, well, we can use HTML email and, um, have two strings, uh, a malicious one and, um, a benign one, and we can wrap the malicious message into some div class, and all we need now is some CSS conditional rules to, based on some conditions, hide the first text or the second text,

14:46.000 --> 14:46.720
okay?

14:46.740 --> 14:51.680
So, for example, we can do this using the media CSS conditional rule.

14:51.680 --> 15:00.520
So, based on the screen size, for example, so, the certain text is hidden, maybe on mobile devices, but shown on desktop devices.

15:01.800 --> 15:11.820
Okay, so, um, if this email is, um, opened by Johnny, in most email clients, a benign looking message, he has to reply.

15:11.820 --> 15:19.120
Johnny actually, uh, uses this technology, believes in PGP and SMAM, therefore he signs all his outgoing messages, okay?

15:19.120 --> 15:22.160
Because he does not want to be impersonated.

15:22.660 --> 15:32.860
But the signed message, um, on a desktop device, with another screen size, would, of course, um, have a completely different string being displayed, okay?

15:33.900 --> 15:37.180
Okay, so, now we can target, like, the device type, okay?

15:37.180 --> 15:41.220
Like, like, you know, mobile, desktop, maybe that's not too interesting.

15:41.280 --> 15:44.740
But we can also target, um, each and every email client.

15:44.740 --> 15:55.740
So, using the supports, uh, conditional rule in CSS, we could be, um, fingerprinted, um, all major email clients, um, and show, can show a certain string only on certain email clients.

15:56.320 --> 16:05.460
Um, and also we can go down further and target certain user accounts only, which is what I'm hopefully going to show you, um, now.

16:16.410 --> 16:26.510
Okay, so, um, in this example we have, um, only two parties, like, um, Eve directly impersonates the manager, so it's an email from the manager to Johnny.

16:26.510 --> 16:32.370
Eve directly spoofs the, the, um, from address, um, to make things a bit easier in this example.

16:32.370 --> 16:38.690
And what you can see here is some CSS code based on the mods document URL prefix.

16:38.690 --> 16:44.410
If it starts with IMAP colon double slash manager at something, a certain text is shown, okay?

16:44.470 --> 16:49.570
So, let's send that message from the manager to poor Johnny.

16:50.350 --> 17:01.390
So, as you can see, there's, uh, just some harmlessly looking message, um, and, well, what's up Johnny from the manager, well, whatever, Johnny replies, yeah, I'm fine, blah, blah.

17:01.390 --> 17:08.350
And as said, Johnny believes in PGP and S-MIME, he, he uses actually this technology, he always signs his outgoing messages, okay?

17:08.510 --> 17:17.610
And now if this message is received by the manager, a completely different string is shown, like, like, I hereby quit my job, but it's validly signed by Johnny.

17:18.470 --> 17:21.230
Okay, that's HTML tricks.

17:21.230 --> 17:33.770
For signatures, that's HTML tricks, but anyway, um, if we define digital signatures as mathematically unbreakable and unfortunate, such simple stupid tricks shouldn't be working, right?

17:35.190 --> 17:39.870
Okay, so, now, now, let me come to an evaluation of those attacks.

17:39.870 --> 17:48.270
So, um, we tested, uh, 24 widely used, uh, email clients, basically every client that supports either PGP or S-MIME or both.

17:48.290 --> 18:01.750
And regarding being misused as a decryption oracle, um, a lot of email clients, including, uh, Thunderbird and Apple Mail, for example, are vulnerable, and all Linux-based email clients.

18:01.790 --> 18:17.950
And, uh, my guess here is actually that email clients where the, um, the developers actually read the RFCs and tried to implement a standard compatible email client, they are more vulnerable than those who maybe just had a quick hack for a PGP plugin.

18:18.610 --> 18:31.550
And, uh, regarding signatures, it's kind of even worse, I mean, basically every email client that supports HTML, uh, can be at least tricked to, uh, display a certain, uh, message only in this client and things like that.

18:31.550 --> 18:33.230
It's hard to counter against.

18:33.230 --> 18:36.530
Also, the signature issues are not fixed until today.

18:37.590 --> 18:41.630
Okay, so, now, let me come to some, uh, some counter measures.

18:42.250 --> 18:46.070
Well, you may say, let's accept ASCII text only.

18:46.070 --> 18:48.690
Let's finally get rid of HTML email.

18:48.690 --> 18:50.990
I'm totally on your side.

18:51.110 --> 18:53.830
Let's start getting another ASCII ribbon campaign.

18:54.250 --> 18:58.790
But, it will not solve the decryption issues, okay?

18:58.830 --> 19:01.950
Because it's, um, the problem is mime-wrapping, okay?

19:01.950 --> 19:05.390
We could also use some Unicode tricks and other tricks to hide the second part.

19:05.390 --> 19:08.270
It will not, unfortunately , solve the decryption oracle tricks.

19:08.910 --> 19:14.310
Um, we could say, what about do not decrypt unless the email is validly signed?

19:14.310 --> 19:23.010
Doesn't work either in the context of email, um, because attackers can simply strip the signatures and resign on their own, on their own identity.

19:23.970 --> 19:31.170
So, what a lot of email clients now did as a counter measure is they warned the user if the email is partly encrypted.

19:31.750 --> 19:34.110
Um, I think that's a bad idea.

19:34.110 --> 19:39.310
Because it delegates security decisions back to the user, which, which I don't want.

19:39.310 --> 19:42.830
So, what I would prefer is like having an all or nothing decryption.

19:43.050 --> 19:52.210
Email clients should not decrypt my email unless the whole, um, message was encrypted within one single mime blob, one single element, okay?

19:54.010 --> 19:54.970
Yeah.

19:54.970 --> 19:59.690
Uh, also we could, of course, think about other cryptographic counter measures.

19:59.870 --> 20:06.810
Um, one thing maybe regarding all or nothing encryption, it will break some, it will, may break some PGP inline emails.

20:06.810 --> 20:14.090
It will break, definitely, emails, some emails composed by K-mail, which allows you to encrypt only the attachment and things like that.

20:14.090 --> 20:17.450
But it's a tradeoff between, you know, compatibility and security.

20:18.190 --> 20:29.950
Okay, also we could think about cryptographic counter measures, like, why is it even possible to use the ciphertext from one email and years later, use it in a completely different context in a completely different email?

20:30.210 --> 20:36.590
Modern online protocols, they would, you have a binding of the ciphertext to the current communication session, right?

20:36.850 --> 20:40.390
Um, in here, email, this, this still seems hard, hard to do.

20:41.210 --> 20:45.910
Okay, regarding signatures, you may say, let's drop simply support for CSS.

20:45.990 --> 20:47.390
I'm on your side, yeah?

20:47.510 --> 21:00.250
Um, I think, unfortunately, a lot of, like, a lot of people want to have fancy formatting and, and, which is done by CSS, so, so it may not be realistic for, for many email clients.

21:00.250 --> 21:15.650
So, um, but email client vendors, um, and, and implementers, what they can at least do is only reply with ASCII text or remove CSS styles from replies so they cannot be misused as, uh, signing oracles anymore.

21:16.730 --> 21:21.130
Okay, so, um, let me come to a conclusion .

21:22.190 --> 21:24.230
Um, so crypto is great, okay?

21:24.230 --> 21:27.350
But sometimes super simple bypasses exist.

21:27.350 --> 21:34.570
Sometimes we don't have to break the mass, um, and in, in this example, this bypasses existed for, for decades, okay?

21:34.670 --> 21:42.730
And the vast majority of detested clients are vulnerable to either being misused as decryption oracles or, or signing oracles or both.

21:42.830 --> 21:46.730
Um, and, and PGP and SRAM, they are more or less equally affected, okay?

21:46.730 --> 21:50.270
Because we do not target the underlying cryptography.

21:50.270 --> 21:52.330
We target standard email features.

21:52.470 --> 21:55.650
So, um, this brings me to the final question.

21:55.650 --> 21:59.570
Is it even possible to build security on top of email?

21:59.570 --> 22:02.470
I think this is very, very challenging, okay?

22:02.470 --> 22:07.330
And this talk is just one of many examples, um, where things fail.

22:07.990 --> 22:19.350
Okay, so, um, we reported, um, all those issues to affected vendors in, uh, until February and, uh, most of the decryption oracle issues are fixed now.

22:19.350 --> 22:21.870
Uh, the signing issues are not fixed.

22:21.950 --> 22:30.850
Um, anyway, we are going full disclosure now, so if you want to test if your client is still vulnerable, um, you can use the test cases on, on GitHub.

22:31.370 --> 22:34.930
Okay, thank you guys, and enjoy this great conference.

