1 00:00:00,000 --> 00:00:02,800 My pleasure to introduce to you Pedro Fortuna. 2 00:00:08,280 --> 00:00:16,280 Thank you all. Welcome. Thank you for being here. Today I'll be talking about protecting 3 00:00:16,540 --> 00:00:24,500 crypto exchanges from a new wave of men in the browser attacks. Starting with a little bit 4 00:00:24,500 --> 00:00:34,240 about me. So I've worked in security for the last 15 years. The last seven or eight have been 5 00:00:34,240 --> 00:00:41,520 mostly focused in JavaScript code protection. But before I started working in the network 6 00:00:41,520 --> 00:00:47,540 security side of things, then I started building things like bot detection, device fingerprinting, 7 00:00:47,560 --> 00:00:54,300 and in the last few years I've also paid a lot of attention to men in the browser attacks and 8 00:00:54,500 --> 00:01:01,900 malicious extensions. So today's talk will be mostly about men in the browser and crypto 9 00:01:01,900 --> 00:01:12,420 exchanges. But I'll start off by a brief overview of the men in the browser history. Then followed 10 00:01:12,420 --> 00:01:20,400 by I'll cover the most common security, application security features that we have found in 11 00:01:20,400 --> 00:01:24,480 crypto exchanges. Then we'll get deep into the security of the web. So let's get started. 12 00:01:24,500 --> 00:01:30,380 So I'll start with the attacks that we have seen in the last March. And at the end I will talk 13 00:01:30,380 --> 00:01:35,620 about application real time monitoring, which is kind of a new approach that we have been working 14 00:01:35,620 --> 00:01:42,980 on that can help in this type of attacks. So for those who are not familiar with men in the 15 00:01:42,980 --> 00:01:50,680 browser, it all starts with a device getting affected, usually through e-mail phishing. It's the 16 00:01:50,680 --> 00:01:54,480 most common way of doing it. And it's a very common way of doing it. And the most common way of 17 00:01:54,500 --> 00:01:59,320 doing it is to go to the web. And then the Trojan gains control of the browser and just waves off 18 00:01:59,320 --> 00:02:07,240 for the user to go to a certain targeted website. And then it makes malicious injections into the 19 00:02:07,240 --> 00:02:13,740 page and tampers with the page. And this happens regardless of other authentication factors that 20 00:02:13,740 --> 00:02:21,620 may be in use. So men in the browser can be subtle. So they can be patient. They will just wait 21 00:02:21,620 --> 00:02:24,480 for you to access the website. They will wait for you to access the website. They will wait for you 22 00:02:24,500 --> 00:02:30,240 to access the website. And then they may wait for the very last minutes to change like a 23 00:02:30,240 --> 00:02:38,500 transaction or just to collect your credentials. So it's the they do the very minimum to accomplish 24 00:02:38,500 --> 00:02:44,880 what they want to do in the website. And they can be very subtle. Not all the time they will 25 00:02:44,880 --> 00:02:51,180 produce something that's visible, like gets rendered differently. So it's very hard. So in this 26 00:02:51,180 --> 00:02:54,480 example that you see, what's happening is I'm going to show you a little bit of the 27 00:02:54,500 --> 00:03:01,320 web inject is modifying the transfer amount and destination account. But apart from that, 28 00:03:01,380 --> 00:03:09,880 that's not the through the perspective of the server, that's you have nothing else to look and 29 00:03:09,880 --> 00:03:16,340 that can tell you that this is happening. So it's really an attack focused on the client side. 30 00:03:16,640 --> 00:03:24,480 And it's hard to spot. So it all started with Zeus. Now it's a little bit more complicated. 31 00:03:24,500 --> 00:03:35,820 It's not the slot machine, but the Trojan. It first appeared in 2007. And he was able to do web 32 00:03:35,820 --> 00:03:42,400 injects and also to form, to do form grabbing. And at the bottom you can see how a web inject 33 00:03:42,400 --> 00:03:51,980 looks like. So it has three sections. The target URL, a reference, where to inject, and the 34 00:03:51,980 --> 00:03:53,100 injection itself. 35 00:03:53,100 --> 00:04:03,860 So in this example, the web inject is adding a field to a form that's requesting an ATM pin from the user. 36 00:04:04,960 --> 00:04:12,240 So the source code for Zeus was released or leaked back in 2011. And this really opened the door 37 00:04:12,240 --> 00:04:20,980 for the number of attacks growing. We have seen a lot of different forks and variants of Zeus. 38 00:04:21,220 --> 00:04:22,980 And they are still out there. 39 00:04:24,680 --> 00:04:31,200 In this table, you can see the most common features that you can find in the main in the browser Trojan. 40 00:04:31,440 --> 00:04:37,380 So most of them have form grabbing and web injection. Of course, those are practically mandatory. 41 00:04:37,720 --> 00:04:45,420 But they can do other things like key logging, remote access, and a few of them are even able to 42 00:04:45,420 --> 00:04:48,900 remove HTTP headers, which can be really dangerous. 43 00:04:51,320 --> 00:04:53,080 So back in 2007, I was able to do a lot of different things. I was able to do a lot of different things. 44 00:04:53,080 --> 00:05:02,420 In 2016, according to a study by IBM, the most prevalent main in the browser Trojans were still Zeus, 45 00:05:02,780 --> 00:05:09,500 which is surprising. After 10 years, it's the most prevalent one. And followed by a couple of variants, 46 00:05:09,700 --> 00:05:20,800 NeverQuest and Gozi. But you can see here that the attacks have been going on in the last 10 or 12 years. 47 00:05:20,800 --> 00:05:28,000 And really, we are just scratching the surface. So there's so many attacks that go unnoticed. 48 00:05:28,620 --> 00:05:33,480 But we don't have time to cover all of this today. So I'll just mention one. 49 00:05:34,080 --> 00:05:40,900 Back in 2015, a Drydex train was able to steal around $50 million. 50 00:05:41,840 --> 00:05:48,060 And what was worse is that it took two whole months for anyone. 51 00:05:48,060 --> 00:05:56,120 I mean, we're talking about hundreds of different financial institutions for anyone to notice that this was happening. 52 00:05:56,340 --> 00:05:58,060 So this is a real problem. 53 00:05:59,640 --> 00:06:06,840 The question is, how secure are crypto exchanges? Are they up to the task? 54 00:06:07,020 --> 00:06:11,420 What kind of features do they have that can mitigate or prevent this? 55 00:06:11,720 --> 00:06:14,220 This is the question that we had. 56 00:06:14,360 --> 00:06:17,680 So we went for a few exchanges. 57 00:06:18,060 --> 00:06:20,080 To find out what they were doing. 58 00:06:21,560 --> 00:06:23,600 But there's too many exchanges. 59 00:06:24,800 --> 00:06:32,060 I think the numbers I saw was roughly over 200 crypto exchanges right now. 60 00:06:32,360 --> 00:06:35,400 And so it's too many to make a survey. 61 00:06:35,600 --> 00:06:37,380 So we had to start somewhere. 62 00:06:37,620 --> 00:06:41,120 And we decided to choose a representative set. 63 00:06:42,640 --> 00:06:48,040 And the rule of thumb was, let's select exchanges that are likely to be up to the task. 64 00:06:50,000 --> 00:06:53,460 So we went for the most popular. 65 00:06:53,640 --> 00:06:55,220 But not only the most popular. 66 00:06:55,460 --> 00:06:59,500 But the ones that have also interesting features that we know about. 67 00:06:59,900 --> 00:07:01,920 So trading volume is interesting. 68 00:07:02,300 --> 00:07:03,920 Ranking on Google search. 69 00:07:05,140 --> 00:07:07,900 Links in relevant sites and social media. 70 00:07:08,180 --> 00:07:09,760 And also known user base. 71 00:07:10,060 --> 00:07:17,460 So in the end, we selected the six Binance, Bitfinex, Bittrex, Coinbase. 72 00:07:17,460 --> 00:07:19,420 Huobi, and Kraken. 73 00:07:20,060 --> 00:07:24,540 So other exchanges could have been selected, of course. 74 00:07:26,120 --> 00:07:29,560 But I believe the main conclusions wouldn't be different. 75 00:07:32,200 --> 00:07:33,820 So getting into the features. 76 00:07:34,600 --> 00:07:38,100 By now, everyone knows what two-factor authentication is. 77 00:07:38,460 --> 00:07:43,320 It can be used to first rate attacks that only compromise a single channel. 78 00:07:43,480 --> 00:07:44,660 So you have a second one. 79 00:07:45,270 --> 00:07:46,320 You can use SMS. 80 00:07:46,320 --> 00:07:49,680 You can use mobile applications like Google Authenticator. 81 00:07:49,800 --> 00:07:53,940 Or even physical hardware like FIDO. 82 00:07:55,180 --> 00:07:58,780 All exchanges that we saw use two-factor authentication. 83 00:07:59,940 --> 00:08:04,420 But they differ when they force the use of two-factor authentication. 84 00:08:04,940 --> 00:08:12,780 So in general, they can use this to confirm logins, withdrawals, password changes, API key creation, 85 00:08:13,180 --> 00:08:14,480 changing security settings, 86 00:08:14,480 --> 00:08:17,660 or changing other sensitive settings. 87 00:08:20,160 --> 00:08:22,240 Captchas are also very common. 88 00:08:23,200 --> 00:08:29,620 They are used to determine if the navigation is being done by a human or by a bot. 89 00:08:30,020 --> 00:08:33,120 And you have many different types of captchas. 90 00:08:34,180 --> 00:08:38,680 The early day captchas were all based in text. 91 00:08:38,840 --> 00:08:41,860 As you can see in the right, the top image. 92 00:08:41,860 --> 00:08:47,680 Then the image-based captchas came along and became very prevalent. 93 00:08:48,020 --> 00:08:56,000 And in the last few years, we are seeing more risk-based and hybrid or dynamic-based captchas 94 00:08:56,000 --> 00:09:00,420 that basically collect behavior information of the navigation 95 00:09:00,420 --> 00:09:06,580 and decide whether they should allow you in or just serve you an image-based captcha 96 00:09:06,580 --> 00:09:09,940 if they are suspicious that you may be a bot. 97 00:09:09,940 --> 00:09:14,320 So typically, they are used in authentication and registration. 98 00:09:14,820 --> 00:09:22,040 And most of the exchanges that we analyze are already using reCAPTCHA, 99 00:09:22,200 --> 00:09:26,000 which is the latter type of captcha, risk-based. 100 00:09:26,440 --> 00:09:34,320 But what you have to keep in mind is that there's a high threat, 101 00:09:34,500 --> 00:09:37,560 which is the use of sweatshops to solve captchas. 102 00:09:37,560 --> 00:09:42,660 So especially if you are using image-based captchas or even text. 103 00:09:42,960 --> 00:09:46,280 With text-based captchas, you don't even need sweatshops. 104 00:09:46,520 --> 00:09:49,540 But if you are using image-based captchas, 105 00:09:50,520 --> 00:09:57,060 there's a whole set of services that you can easily integrate with your automation tools to attack 106 00:09:57,540 --> 00:10:01,560 that can get you solved any captcha in just a few seconds. 107 00:10:01,840 --> 00:10:06,500 And you can scale that up and you can abuse many websites 108 00:10:06,500 --> 00:10:09,320 that are only protected by image-based captchas. 109 00:10:09,560 --> 00:10:11,040 So you have to watch out for those. 110 00:10:13,560 --> 00:10:17,560 Exchanges also lay out a number of different account takeover defenses, 111 00:10:18,800 --> 00:10:21,540 starting with two-factor authentication, of course. 112 00:10:22,360 --> 00:10:25,340 But they are only forced by a couple. 113 00:10:25,520 --> 00:10:30,860 So only Binance and Bitfinex really force you to use two-factor authentication. 114 00:10:31,340 --> 00:10:34,800 So in the other cases, you can disable this option, 115 00:10:34,800 --> 00:10:42,620 so it becomes a viable road for an attacker to disable those options and try to attack. 116 00:10:43,040 --> 00:10:47,200 So another thing is that they send an email on every successful login. 117 00:10:47,380 --> 00:10:51,440 So this is useful because if you receive an email and you haven't logged in, 118 00:10:51,520 --> 00:10:53,980 maybe you should take measures, right? 119 00:10:54,920 --> 00:10:58,100 If you reset your password or two-factor authentication, 120 00:10:58,540 --> 00:11:04,280 some of those will require you to confirm that action through an email 121 00:11:04,280 --> 00:11:05,220 they sent you. 122 00:11:05,440 --> 00:11:11,940 And in a few cases, that will also cause your account to be frozen 123 00:11:11,940 --> 00:11:13,520 for a certain amount of time. 124 00:11:13,700 --> 00:11:17,720 So you cannot do withdrawals if you just reset your password 125 00:11:17,720 --> 00:11:19,000 or two-factor authentication. 126 00:11:20,040 --> 00:11:20,960 And this is good. 127 00:11:22,000 --> 00:11:27,340 You can also have a white list of IP addresses and devices. 128 00:11:27,940 --> 00:11:31,360 So you always have to confirm your devices. 129 00:11:31,360 --> 00:11:35,600 So not all exchanges offer this. 130 00:11:35,860 --> 00:11:40,080 And in some situations, you have to approve as well through email. 131 00:11:42,540 --> 00:11:47,840 In some cases, there's also the possibility of freezing your account directly 132 00:11:48,800 --> 00:11:51,360 using the emails that you received, 133 00:11:51,520 --> 00:11:55,360 which is good because if you receive an email telling you about some action, 134 00:11:55,760 --> 00:11:58,260 you can quickly disable your account 135 00:11:58,260 --> 00:12:01,260 and hopefully in time for stopping 136 00:12:01,360 --> 00:12:04,480 the funds from being exfiltrated from your account. 137 00:12:04,860 --> 00:12:08,240 And all exchanges in general, they collect, 138 00:12:09,100 --> 00:12:12,200 they log the actions that you do 139 00:12:12,200 --> 00:12:15,200 and they make this information available to you 140 00:12:15,200 --> 00:12:18,900 so you can spot if weird things have been done with your account. 141 00:12:21,060 --> 00:12:23,820 Withdrawal protections are probably the category 142 00:12:24,120 --> 00:12:27,180 that I found more interesting 143 00:12:28,200 --> 00:12:30,840 because some of the features can really be helpful 144 00:12:31,360 --> 00:12:32,120 in protecting exchanges. 145 00:12:32,700 --> 00:12:35,500 For instance, if you reset your passwords 146 00:12:35,500 --> 00:12:36,900 or two-factor authentication, 147 00:12:37,320 --> 00:12:39,980 like I said, your account can be frozen 148 00:12:39,980 --> 00:12:41,680 for a certain amount of time. 149 00:12:41,860 --> 00:12:46,020 And that amount of time can go from 24 hours to 15 days, 150 00:12:46,260 --> 00:12:47,840 which is really aggressive 151 00:12:48,360 --> 00:12:51,100 but gives enough time for people to understand 152 00:12:51,100 --> 00:12:53,860 if someone is messing with your password 153 00:12:53,860 --> 00:12:55,600 or with your two-factor authentication. 154 00:12:56,340 --> 00:12:58,940 And this amount of time in certain situations 155 00:12:58,940 --> 00:13:00,620 depends on the exchange 156 00:13:01,360 --> 00:13:03,440 and the amount of funds that you wish to transfer. 157 00:13:03,880 --> 00:13:06,800 You can also lock or disable withdrawals 158 00:13:06,800 --> 00:13:09,260 for crypto coins that you are not using 159 00:13:09,260 --> 00:13:12,780 and you don't wish to trade at all. 160 00:13:13,160 --> 00:13:16,120 And you also have a withdrawal address whitelist. 161 00:13:16,220 --> 00:13:17,220 So you need to specify 162 00:13:20,480 --> 00:13:23,080 the crypto wallet addresses 163 00:13:23,720 --> 00:13:26,700 that you intend to do transfers to. 164 00:13:27,080 --> 00:13:30,500 And if you need to add a new address 165 00:13:30,500 --> 00:13:33,700 that can cause your account to be frozen 166 00:13:33,700 --> 00:13:35,600 during, for instance, five days. 167 00:13:37,160 --> 00:13:40,140 But the problem is some exchanges, 168 00:13:40,420 --> 00:13:42,500 they let you disable this feature 169 00:13:42,500 --> 00:13:44,380 and they let you disable 170 00:13:44,380 --> 00:13:48,100 without requesting a two-factor authentication token. 171 00:13:48,400 --> 00:13:50,540 So this is a weak spot for sure. 172 00:13:51,840 --> 00:13:54,160 Also, the IP device whitelist 173 00:13:54,160 --> 00:13:59,320 lets you withdraw for new IPs on new devices, 174 00:13:59,320 --> 00:14:02,240 but only if they were previously approved. 175 00:14:02,560 --> 00:14:07,600 And you have a minimum of 24 hours, commonly, 176 00:14:07,920 --> 00:14:11,300 that you need to wait before they are really approved 177 00:14:11,300 --> 00:14:13,360 and cleared out to use. 178 00:14:14,520 --> 00:14:17,440 Also, as you can see in the screen 179 00:14:17,440 --> 00:14:18,960 at the right, the image, 180 00:14:19,260 --> 00:14:21,980 some exchanges also present this image 181 00:14:21,980 --> 00:14:23,620 with the transaction details, 182 00:14:23,940 --> 00:14:27,420 but also with a secret phrase that you can set. 183 00:14:27,680 --> 00:14:29,240 And this is done 184 00:14:29,320 --> 00:14:31,120 to prevent things like phishing attacks 185 00:14:31,120 --> 00:14:32,160 or tampering attacks 186 00:14:32,160 --> 00:14:35,400 that are forging transactions 187 00:14:35,400 --> 00:14:36,800 or tricking you 188 00:14:37,320 --> 00:14:39,700 and diverting the funds to other accounts. 189 00:14:40,020 --> 00:14:42,560 So if you don't find your secret phrase there, 190 00:14:42,740 --> 00:14:45,380 maybe it's an automated tampering attack 191 00:14:45,380 --> 00:14:46,960 and you need to watch out for those. 192 00:14:50,360 --> 00:14:52,220 There's also some anti-phishing, 193 00:14:52,240 --> 00:14:54,940 more anti-phishing techniques. 194 00:14:55,700 --> 00:14:57,720 You can set a secret phrase 195 00:14:57,720 --> 00:15:00,400 that's sent in every email that you receive 196 00:15:00,400 --> 00:15:01,940 to prevent email phishing. 197 00:15:02,240 --> 00:15:03,920 And you can also configure, 198 00:15:04,160 --> 00:15:06,200 I think in a couple of exchanges, 199 00:15:07,740 --> 00:15:12,540 PGP keys to be able to receive encrypted emails. 200 00:15:12,740 --> 00:15:14,020 So this is useful as well. 201 00:15:14,860 --> 00:15:17,980 Pretty much all of them use HTTPS by now. 202 00:15:18,260 --> 00:15:21,580 And I think only Binance, 203 00:15:21,720 --> 00:15:22,940 no, a couple of them, 204 00:15:23,660 --> 00:15:25,980 they show you warnings 205 00:15:25,980 --> 00:15:29,500 or requests for you to check and double check 206 00:15:29,500 --> 00:15:31,980 if you are running in the HTTPS 207 00:15:31,980 --> 00:15:34,720 and if you get the green lock and everything 208 00:15:35,620 --> 00:15:38,720 to make sure that you pay attention to those things. 209 00:15:40,400 --> 00:15:41,680 Last but not least, 210 00:15:41,840 --> 00:15:42,840 content security policy. 211 00:15:44,660 --> 00:15:48,100 So after going through all the six exchanges, 212 00:15:49,280 --> 00:15:50,840 I'm kind of disappointed 213 00:15:50,840 --> 00:15:54,800 because what I saw is most of the exchanges 214 00:15:54,800 --> 00:15:56,520 are not using, 215 00:15:56,680 --> 00:15:59,060 are either not using CSP at all 216 00:15:59,480 --> 00:16:03,500 or they are using it very wrongly. 217 00:16:03,720 --> 00:16:08,120 So as a couple of friends of mine, 218 00:16:08,180 --> 00:16:11,080 Michele and Lucas from Google said, 219 00:16:11,560 --> 00:16:13,660 and they speak about CSP a lot, 220 00:16:14,680 --> 00:16:19,240 over 94% of all CSPs based in wireless 221 00:16:19,600 --> 00:16:20,780 are bypassable. 222 00:16:20,940 --> 00:16:23,080 So you shouldn't use them at all. 223 00:16:23,080 --> 00:16:24,080 Oh, oops. 224 00:16:28,500 --> 00:16:31,120 And what I saw is that 225 00:16:31,120 --> 00:16:35,180 at least more than half of these exchanges, 226 00:16:35,360 --> 00:16:38,860 they are using white listed domains in CSP 227 00:16:38,860 --> 00:16:40,840 which they shouldn't do at all. 228 00:16:41,000 --> 00:16:43,380 And plus they use unsafe eval, 229 00:16:43,400 --> 00:16:44,780 they use unsafe inline, 230 00:16:44,880 --> 00:16:48,020 and they don't use base URI none. 231 00:16:48,440 --> 00:16:50,160 And like I said, 232 00:16:50,260 --> 00:16:52,700 some don't even use CSP at all. 233 00:16:52,700 --> 00:16:56,980 So they practically do all the mistakes 234 00:16:56,980 --> 00:16:58,700 that you can do with CSP. 235 00:16:58,860 --> 00:17:00,320 I don't know the reasons, 236 00:17:00,600 --> 00:17:05,400 but I think they should fix this. 237 00:17:06,540 --> 00:17:07,860 CSP should be used, 238 00:17:07,920 --> 00:17:09,100 but should be used right. 239 00:17:09,320 --> 00:17:11,600 And I really can't recommend enough 240 00:17:11,600 --> 00:17:13,560 the use of CSP Evaluator, 241 00:17:13,700 --> 00:17:15,500 which is a tool from Google 242 00:17:15,500 --> 00:17:18,440 that can warn you off 243 00:17:18,440 --> 00:17:20,240 if you are doing like obvious mistakes 244 00:17:20,240 --> 00:17:21,600 in your CSP configuration. 245 00:17:23,280 --> 00:17:24,700 So in this table, 246 00:17:24,780 --> 00:17:26,560 you can see a summary of most 247 00:17:26,560 --> 00:17:29,020 of what we already talked about. 248 00:17:30,720 --> 00:17:32,980 Also, I include here 249 00:17:33,700 --> 00:17:36,540 the X-Frame options that we have found 250 00:17:36,540 --> 00:17:37,740 in these exchanges. 251 00:17:38,160 --> 00:17:41,040 And the general overview is that 252 00:17:41,040 --> 00:17:43,240 most of them are allowing 253 00:17:43,240 --> 00:17:45,400 iframing of their website 254 00:17:45,400 --> 00:17:46,940 from their own domain. 255 00:17:47,240 --> 00:17:49,140 And as we are going to see, 256 00:17:49,300 --> 00:17:50,140 this is a problem. 257 00:17:50,460 --> 00:17:52,320 So only kind of moments 258 00:17:52,700 --> 00:17:55,000 is denying iframing 259 00:17:55,000 --> 00:17:56,400 from within their website. 260 00:17:57,460 --> 00:17:59,280 Other things that you can see, 261 00:17:59,380 --> 00:18:00,860 the two-factor authentication, 262 00:18:01,840 --> 00:18:04,870 in the case of Binance and Bitfinex, 263 00:18:05,460 --> 00:18:06,320 they are being forced 264 00:18:06,320 --> 00:18:09,080 in a lot of the actions that you can do. 265 00:18:09,600 --> 00:18:11,560 In the remaining four, 266 00:18:12,340 --> 00:18:15,140 you can disable two-factor authentication. 267 00:18:15,640 --> 00:18:17,360 And this is bad 268 00:18:17,360 --> 00:18:19,380 because many in the browser 269 00:18:19,380 --> 00:18:21,440 can exploit this by disabling 270 00:18:21,440 --> 00:18:23,480 the requesting two-factor authentication. 271 00:18:23,900 --> 00:18:26,740 And so it becomes 272 00:18:26,740 --> 00:18:29,640 a useless security feature. 273 00:18:31,460 --> 00:18:33,340 And this is the same table 274 00:18:34,300 --> 00:18:37,300 with the positive things 275 00:18:37,300 --> 00:18:38,320 and negative things. 276 00:18:38,620 --> 00:18:41,540 And I believe this table should be 277 00:18:41,540 --> 00:18:44,220 way greener than actually it is. 278 00:18:45,440 --> 00:18:47,460 And there is no single exchange 279 00:18:47,460 --> 00:18:49,220 that can get away because, 280 00:18:49,340 --> 00:18:51,200 let's say Bitfinex 281 00:18:51,440 --> 00:18:53,900 is way greener than the others. 282 00:18:54,100 --> 00:18:55,840 But at the same time, 283 00:18:55,880 --> 00:18:57,700 they are not using CSP. 284 00:18:58,260 --> 00:19:00,080 So they should be blocking 285 00:19:00,080 --> 00:19:02,080 all sorts of cross-site scripting, 286 00:19:03,100 --> 00:19:04,180 disabling framing 287 00:19:04,180 --> 00:19:05,860 from within their websites. 288 00:19:06,100 --> 00:19:08,220 So no one gets out easily 289 00:19:08,220 --> 00:19:09,160 from this. 290 00:19:10,560 --> 00:19:11,860 So the main takeaways 291 00:19:11,860 --> 00:19:13,720 is that improvements can be made. 292 00:19:14,240 --> 00:19:16,040 CSP is not being used properly. 293 00:19:17,120 --> 00:19:18,560 In one case, 294 00:19:18,740 --> 00:19:20,840 I didn't point out that 295 00:19:20,840 --> 00:19:23,600 Bitfinex is using text-based captchas, 296 00:19:23,860 --> 00:19:26,460 which are very used to overcome 297 00:19:26,460 --> 00:19:28,600 using OCR or whatever. 298 00:19:29,380 --> 00:19:31,600 It should ban framing 299 00:19:31,600 --> 00:19:34,960 of the website from within, 300 00:19:35,160 --> 00:19:36,800 which is also useful 301 00:19:36,800 --> 00:19:39,300 to mitigate attacks like click-checking. 302 00:19:39,920 --> 00:19:41,940 So you get that as a bonus. 303 00:19:42,220 --> 00:19:43,540 So there's no reason 304 00:19:43,540 --> 00:19:45,000 why you shouldn't use CSP. 305 00:19:45,660 --> 00:19:47,280 And every important action 306 00:19:47,280 --> 00:19:49,260 should trigger two-factor authentication. 307 00:19:49,260 --> 00:19:50,400 And that 308 00:19:51,200 --> 00:19:52,420 can't be disabled. 309 00:19:52,780 --> 00:19:54,760 So you can't let the user decide 310 00:19:54,760 --> 00:19:56,540 whether two-factor authentication 311 00:19:57,260 --> 00:19:58,400 should be used or not. 312 00:19:58,980 --> 00:20:01,000 So all sorts of whitelists can help. 313 00:20:01,380 --> 00:20:02,660 They should be used, 314 00:20:02,780 --> 00:20:05,060 but they should be forcefully used 315 00:20:05,060 --> 00:20:06,140 with freeze time, 316 00:20:06,180 --> 00:20:08,500 freeze time. 317 00:20:09,100 --> 00:20:11,340 And the anti-phishing, 318 00:20:11,380 --> 00:20:12,220 tamper-proof images 319 00:20:12,220 --> 00:20:13,620 are also good to 320 00:20:15,010 --> 00:20:15,740 fight bots. 321 00:20:16,320 --> 00:20:18,900 But some of the stuff were nailed down 322 00:20:19,260 --> 00:20:20,220 by the exchanges. 323 00:20:20,660 --> 00:20:21,620 So they all use 324 00:20:21,620 --> 00:20:24,540 They all 325 00:20:24,540 --> 00:20:30,140 One, two. 326 00:20:30,280 --> 00:20:30,760 Okay. 327 00:20:32,900 --> 00:20:33,620 Tractor authentication. 328 00:20:34,300 --> 00:20:36,440 They all log 329 00:20:37,200 --> 00:20:37,600 history. 330 00:20:39,120 --> 00:20:39,860 Wait a second. 331 00:20:42,960 --> 00:20:45,860 But if you look at 332 00:20:45,860 --> 00:20:47,260 what's being done, 333 00:20:47,420 --> 00:20:48,920 we are using a lot 334 00:20:49,260 --> 00:20:50,020 of two-factor authentication, 335 00:20:50,560 --> 00:20:51,140 captures, 336 00:20:51,520 --> 00:20:52,160 countries, 337 00:20:53,060 --> 00:20:53,700 whitelists, 338 00:20:53,920 --> 00:20:55,340 this and that. 339 00:20:55,640 --> 00:20:57,440 And the overall usability 340 00:20:57,440 --> 00:20:58,920 is being hurt. 341 00:20:59,220 --> 00:21:01,040 So what we want to know 342 00:21:01,040 --> 00:21:03,320 is whether we are gaining 343 00:21:03,320 --> 00:21:05,200 more security in return 344 00:21:05,200 --> 00:21:06,960 by doing all of this. 345 00:21:09,220 --> 00:21:11,120 So now I will show you 346 00:21:11,120 --> 00:21:13,400 I will talk about the attacks. 347 00:21:14,380 --> 00:21:15,660 So roughly 348 00:21:15,660 --> 00:21:16,760 five months ago, 349 00:21:17,680 --> 00:21:19,580 I heard in the news that 350 00:21:19,580 --> 00:21:21,040 Coinbase and 351 00:21:22,580 --> 00:21:23,860 blockchain.info 352 00:21:23,860 --> 00:21:25,520 were being targeted by 353 00:21:25,520 --> 00:21:26,520 many of the browser attacks. 354 00:21:27,380 --> 00:21:29,380 And it all started by the work 355 00:21:29,380 --> 00:21:31,060 of a couple of malware 356 00:21:31,420 --> 00:21:31,740 researchers, 357 00:21:32,080 --> 00:21:32,580 and 358 00:21:35,700 --> 00:21:37,720 from security scorecard. 359 00:21:37,960 --> 00:21:39,040 So they did a 360 00:21:39,040 --> 00:21:40,520 white paper on this. 361 00:21:40,760 --> 00:21:43,440 And basically what they found 362 00:21:43,440 --> 00:21:45,640 is this was an attack 363 00:21:45,660 --> 00:21:47,320 caused by Zeus Panda, 364 00:21:47,560 --> 00:21:48,720 which is a variant of Zeus. 365 00:21:49,160 --> 00:21:50,680 And they were targeting 366 00:21:51,760 --> 00:21:53,840 so what stood out 367 00:21:53,840 --> 00:21:55,240 from this is that 368 00:21:55,240 --> 00:21:56,960 among 50 targets 369 00:21:57,660 --> 00:21:59,680 we found two crypto 370 00:21:59,680 --> 00:22:00,060 exchanges. 371 00:22:00,680 --> 00:22:03,060 And this really caught my attention. 372 00:22:03,400 --> 00:22:05,420 So I've 373 00:22:05,420 --> 00:22:07,220 read the white paper 374 00:22:07,220 --> 00:22:09,620 carefully, and this is what you can see 375 00:22:09,620 --> 00:22:11,480 there. So this is the 376 00:22:11,480 --> 00:22:12,940 first stage web inject. 377 00:22:13,280 --> 00:22:15,340 I don't know, maybe you cannot read this, 378 00:22:15,660 --> 00:22:17,480 but it has a 379 00:22:17,480 --> 00:22:19,820 div element in the top, 380 00:22:19,960 --> 00:22:21,420 and then you have an inline script. 381 00:22:22,000 --> 00:22:23,400 Hello, use of 382 00:22:23,400 --> 00:22:24,520 CSP, please. 383 00:22:25,000 --> 00:22:27,680 And here you can see 384 00:22:27,680 --> 00:22:29,020 the obfuscated 385 00:22:29,820 --> 00:22:31,740 version of the same script. 386 00:22:32,020 --> 00:22:33,300 It's not really complete, 387 00:22:33,460 --> 00:22:35,000 but you can see the different parts. 388 00:22:35,240 --> 00:22:37,240 But basically what it's doing is 389 00:22:37,240 --> 00:22:39,440 just waiting out for the page to 390 00:22:39,440 --> 00:22:41,500 complete loading, and then afterwards 391 00:22:41,500 --> 00:22:43,440 it's just dumping 392 00:22:43,440 --> 00:22:45,540 an inline script that will 393 00:22:45,660 --> 00:22:47,140 load a second stage 394 00:22:47,660 --> 00:22:49,580 JavaScript payload from the website. 395 00:22:49,860 --> 00:22:51,560 So this means that the attacker 396 00:22:51,560 --> 00:22:53,620 can change the attack 397 00:22:53,620 --> 00:22:54,940 at any given point. 398 00:22:55,220 --> 00:22:57,520 So the only thing that's static 399 00:22:57,520 --> 00:22:58,680 is the web inject. 400 00:22:59,020 --> 00:23:01,560 So you put the browser out there 401 00:23:01,560 --> 00:23:03,300 is injecting 402 00:23:03,300 --> 00:23:05,040 when people visit the websites, 403 00:23:05,360 --> 00:23:07,180 but then at that moment 404 00:23:07,180 --> 00:23:09,020 they will dynamically load 405 00:23:09,020 --> 00:23:11,000 a second stage JavaScript payload. 406 00:23:11,320 --> 00:23:12,680 And that can evolve. 407 00:23:13,020 --> 00:23:14,720 They can do different things 408 00:23:15,960 --> 00:23:18,300 So in this case it's only doing that 409 00:23:18,300 --> 00:23:20,380 and we didn't have 410 00:23:21,360 --> 00:23:22,700 all the details. 411 00:23:22,880 --> 00:23:24,580 So with the white paper 412 00:23:24,580 --> 00:23:26,140 you didn't have access to 413 00:23:26,140 --> 00:23:28,260 all the second stage payload. 414 00:23:28,780 --> 00:23:31,320 And we wanted more details 415 00:23:31,320 --> 00:23:31,900 on this. 416 00:23:32,020 --> 00:23:33,460 So we reached out to 417 00:23:33,460 --> 00:23:37,000 and we were able to discuss 418 00:23:37,000 --> 00:23:38,460 the attack with them. 419 00:23:38,600 --> 00:23:40,780 And they were kind enough to share 420 00:23:40,780 --> 00:23:43,240 the stage two payload 421 00:23:43,240 --> 00:23:44,000 with us. 422 00:23:45,660 --> 00:23:46,880 So with that we implemented 423 00:23:46,880 --> 00:23:49,040 for coinbase.com 424 00:23:49,400 --> 00:23:51,700 a C2 capable 425 00:23:51,700 --> 00:23:53,360 of interacting with 426 00:23:53,360 --> 00:23:54,440 the JavaScript payload 427 00:23:54,440 --> 00:23:57,000 and we are doing the injections 428 00:23:57,500 --> 00:23:59,240 in the browser using 429 00:23:59,240 --> 00:24:00,000 burp proxy. 430 00:24:01,580 --> 00:24:03,480 So this is what we know. 431 00:24:03,860 --> 00:24:05,660 So initially the user 432 00:24:05,660 --> 00:24:06,840 visits coinbase. 433 00:24:08,440 --> 00:24:10,300 At any given page 434 00:24:10,300 --> 00:24:11,260 the web inject 435 00:24:11,260 --> 00:24:13,020 is always injected 436 00:24:13,580 --> 00:24:14,980 no matter what's 437 00:24:15,660 --> 00:24:17,420 your URL you are visiting. 438 00:24:18,560 --> 00:24:19,240 And 439 00:24:19,240 --> 00:24:21,000 when you access 440 00:24:21,000 --> 00:24:21,980 the login form 441 00:24:21,980 --> 00:24:24,020 they overlay 442 00:24:24,020 --> 00:24:26,600 they put a button 443 00:24:26,600 --> 00:24:28,100 over the real button 444 00:24:28,100 --> 00:24:30,500 and they disable the enter key 445 00:24:30,500 --> 00:24:32,660 so that you cannot use that 446 00:24:32,660 --> 00:24:34,560 because that would trigger 447 00:24:34,560 --> 00:24:37,280 the bottom real button. 448 00:24:37,580 --> 00:24:39,260 And they force you 449 00:24:39,260 --> 00:24:40,500 to click their own button. 450 00:24:40,680 --> 00:24:41,740 So it's kind of 451 00:24:41,740 --> 00:24:44,960 an easy trick they can do. 452 00:24:45,660 --> 00:24:47,300 So when you login 453 00:24:47,300 --> 00:24:49,900 they will extract your credentials 454 00:24:49,900 --> 00:24:51,320 but they will also 455 00:24:52,620 --> 00:24:53,960 put forward 456 00:24:53,960 --> 00:24:55,360 the normal login. 457 00:24:57,380 --> 00:24:59,320 So after you login 458 00:24:59,320 --> 00:25:01,460 at the dashboard 459 00:25:01,460 --> 00:25:03,240 they will present you 460 00:25:03,240 --> 00:25:05,100 with this model window 461 00:25:05,520 --> 00:25:06,760 that says that 462 00:25:07,540 --> 00:25:09,880 they detected unusual sign in 463 00:25:09,880 --> 00:25:10,660 activity. 464 00:25:11,260 --> 00:25:13,480 You're probably trying to log from 465 00:25:13,480 --> 00:25:15,120 a new location or device 466 00:25:15,660 --> 00:25:17,340 and so it seems 467 00:25:17,340 --> 00:25:18,520 pretty generic 468 00:25:18,520 --> 00:25:21,440 so it could potentially warn you off 469 00:25:21,440 --> 00:25:23,180 but at the same time 470 00:25:23,180 --> 00:25:25,120 who knows when the crypto exchanges 471 00:25:25,120 --> 00:25:26,860 are requesting two factor authentication. 472 00:25:27,300 --> 00:25:28,460 It's really complex 473 00:25:28,460 --> 00:25:30,200 and it's dynamic too 474 00:25:30,200 --> 00:25:32,700 so we never know what's their strategy 475 00:25:32,700 --> 00:25:35,180 for serving and requesting two factor authentication. 476 00:25:35,580 --> 00:25:37,040 So at the same time 477 00:25:37,040 --> 00:25:38,680 this can easily trick people 478 00:25:38,680 --> 00:25:41,360 into entering the two factor 479 00:25:41,360 --> 00:25:42,940 authentication credentials. 480 00:25:43,480 --> 00:25:45,540 So let's imagine 481 00:25:45,660 --> 00:25:47,020 that you enter it 482 00:25:47,660 --> 00:25:48,340 and 483 00:25:49,380 --> 00:25:50,440 when you do that 484 00:25:50,440 --> 00:25:53,420 they will basically use that credential 485 00:25:53,420 --> 00:25:55,160 that two factor authentication 486 00:25:55,160 --> 00:25:57,520 to load the security 487 00:25:57,520 --> 00:25:58,420 settings page 488 00:25:58,420 --> 00:26:00,400 in an iframe 489 00:26:00,400 --> 00:26:03,580 so that's why we shouldn't 490 00:26:03,580 --> 00:26:05,540 allow your website from being 491 00:26:05,540 --> 00:26:07,260 iframed from your own website. 492 00:26:08,400 --> 00:26:09,580 So they load 493 00:26:09,580 --> 00:26:10,680 the security settings 494 00:26:10,680 --> 00:26:12,800 and they set requesting 495 00:26:12,800 --> 00:26:14,420 two factor authentication 496 00:26:15,660 --> 00:26:16,800 to none, to never. 497 00:26:16,960 --> 00:26:19,280 So basically you are just 498 00:26:19,280 --> 00:26:21,620 downgrading security in the website. 499 00:26:21,980 --> 00:26:23,040 So one thing 500 00:26:23,600 --> 00:26:25,300 that was weird is that 501 00:26:25,300 --> 00:26:27,240 this iframe was not 502 00:26:27,240 --> 00:26:29,480 invisible which is one of the 503 00:26:29,480 --> 00:26:30,700 indications that we have 504 00:26:30,700 --> 00:26:33,400 that the attack wasn't complete. 505 00:26:33,800 --> 00:26:35,220 So they were 506 00:26:35,220 --> 00:26:37,560 probably still working on the 507 00:26:37,560 --> 00:26:39,220 attack, they were debugging and seeing 508 00:26:39,220 --> 00:26:39,840 how it goes. 509 00:26:40,480 --> 00:26:41,840 So after this 510 00:26:42,680 --> 00:26:45,300 if you try to go to the security 511 00:26:45,660 --> 00:26:47,100 settings page you are presented 512 00:26:47,100 --> 00:26:49,580 with one line error 513 00:26:49,580 --> 00:26:51,160 saying you that something 514 00:26:51,160 --> 00:26:53,740 went wrong, please try again later. 515 00:26:54,100 --> 00:26:55,720 And this is presently 516 00:26:55,720 --> 00:26:57,280 what it does. 517 00:26:57,720 --> 00:26:59,280 What it could do 518 00:26:59,280 --> 00:27:01,340 it could initiate 519 00:27:01,340 --> 00:27:03,040 a transaction 520 00:27:03,280 --> 00:27:04,180 for a 521 00:27:05,500 --> 00:27:07,180 wallet controlled by the attacker 522 00:27:07,180 --> 00:27:09,380 and it would be easy because 523 00:27:09,380 --> 00:27:11,500 after disabling two factor authentication 524 00:27:11,500 --> 00:27:13,440 there was nothing 525 00:27:13,440 --> 00:27:15,400 there to stop the attacker 526 00:27:15,660 --> 00:27:17,380 from doing this and the account 527 00:27:17,380 --> 00:27:19,100 wasn't frozen so 528 00:27:19,380 --> 00:27:21,300 it could be done immediately. 529 00:27:21,500 --> 00:27:23,300 All your funds are lost 530 00:27:23,300 --> 00:27:25,600 and this is far too 531 00:27:25,600 --> 00:27:27,700 appealing because you cannot 532 00:27:27,700 --> 00:27:29,560 undo this and 533 00:27:29,560 --> 00:27:31,200 the money is untraceable. 534 00:27:31,420 --> 00:27:33,260 So why shouldn't many of the browser 535 00:27:33,260 --> 00:27:35,360 trojans target crypto exchanges? 536 00:27:35,720 --> 00:27:37,380 They should. It's easier than 537 00:27:37,380 --> 00:27:38,320 targeting 538 00:27:38,320 --> 00:27:40,880 a conventional bank 539 00:27:41,340 --> 00:27:42,300 in my opinion. 540 00:27:43,480 --> 00:27:45,300 So this is how we implemented 541 00:27:45,660 --> 00:27:46,000 the attack. 542 00:27:46,700 --> 00:27:49,300 So we deployed a burp proxy 543 00:27:49,300 --> 00:27:50,960 and the burp proxy is 544 00:27:50,960 --> 00:27:53,720 applying the web injects 545 00:27:53,720 --> 00:27:55,320 but it's also 546 00:27:55,320 --> 00:27:57,400 stripping the CSP and 547 00:27:57,400 --> 00:27:58,940 the XFrame options headers. 548 00:27:59,380 --> 00:28:00,980 Why we are doing this? 549 00:28:01,180 --> 00:28:02,880 Because we believe that after 550 00:28:02,880 --> 00:28:04,740 the attack, Coinbase 551 00:28:05,840 --> 00:28:06,580 disabled 552 00:28:06,580 --> 00:28:09,620 the framing within their website 553 00:28:09,620 --> 00:28:11,520 and this attack in 554 00:28:11,520 --> 00:28:13,460 particular is using the iframe 555 00:28:13,460 --> 00:28:15,600 as I told you. So in order 556 00:28:15,660 --> 00:28:17,380 to replicate how it 557 00:28:17,380 --> 00:28:19,620 worked, we are 558 00:28:19,620 --> 00:28:20,640 stripping the headers. 559 00:28:22,480 --> 00:28:23,740 And by the way 560 00:28:23,740 --> 00:28:25,340 Coinbase, like I said, 561 00:28:25,480 --> 00:28:27,520 is the only exchange that is 562 00:28:27,520 --> 00:28:28,860 presently doing this. 563 00:28:29,320 --> 00:28:31,440 All the others are still vulnerable to 564 00:28:31,440 --> 00:28:33,520 this type of iframing. 565 00:28:34,780 --> 00:28:35,500 So 566 00:28:35,500 --> 00:28:37,720 obviously we configured a browser 567 00:28:37,720 --> 00:28:38,800 to use the proxy 568 00:28:40,120 --> 00:28:40,840 and 569 00:28:41,620 --> 00:28:43,560 the JavaScript payload 570 00:28:43,560 --> 00:28:45,540 is communicating with 571 00:28:45,660 --> 00:28:47,660 the C2 that we have implemented. 572 00:28:49,460 --> 00:28:51,320 So now it's time for the demo. 573 00:28:54,820 --> 00:28:57,260 So here in burp you can see 574 00:28:57,260 --> 00:28:58,320 that we are 575 00:28:59,640 --> 00:29:00,280 removing 576 00:29:00,280 --> 00:29:01,520 the 577 00:29:02,580 --> 00:29:04,620 replace with nothing the 578 00:29:04,620 --> 00:29:06,520 XFrame options headers and 579 00:29:06,520 --> 00:29:07,720 control and security policy 580 00:29:07,720 --> 00:29:10,560 and we are also adding the 581 00:29:10,560 --> 00:29:11,360 web injects. 582 00:29:11,400 --> 00:29:13,360 So let me try to show you that. 583 00:29:18,240 --> 00:29:18,960 . 584 00:29:21,840 --> 00:29:22,560 . 585 00:29:22,560 --> 00:29:22,920 . 586 00:29:25,120 --> 00:29:25,840 . 587 00:29:25,840 --> 00:29:26,200 . 588 00:29:26,200 --> 00:29:26,380 . 589 00:29:26,380 --> 00:29:26,500 . 590 00:29:26,500 --> 00:29:27,720 . 591 00:29:27,720 --> 00:29:27,740 . 592 00:29:38,120 --> 00:29:38,840 . 593 00:29:38,840 --> 00:29:38,860 . 594 00:29:38,860 --> 00:29:39,020 . 595 00:29:39,020 --> 00:29:39,560 . 596 00:29:39,560 --> 00:29:42,260 . 597 00:29:42,260 --> 00:29:43,340 . 598 00:29:43,340 --> 00:29:43,920 . 599 00:29:43,920 --> 00:29:45,060 . 600 00:29:45,060 --> 00:29:45,200 . 601 00:29:45,200 --> 00:29:46,000 . 602 00:29:46,000 --> 00:29:46,020 . 603 00:29:46,020 --> 00:29:48,440 . 604 00:29:48,440 --> 00:29:48,460 . 605 00:29:48,460 --> 00:29:48,780 . 606 00:29:53,700 --> 00:29:55,080 . 607 00:29:59,980 --> 00:30:00,860 . . 608 00:30:08,720 --> 00:30:09,600 . . 609 00:30:09,600 --> 00:30:09,980 . . 610 00:30:09,980 --> 00:30:10,240 . . 611 00:30:10,240 --> 00:30:11,780 . . 612 00:30:11,780 --> 00:30:11,900 . . 613 00:30:11,900 --> 00:30:11,980 . . 614 00:30:11,980 --> 00:30:12,220 . . 615 00:30:12,220 --> 00:30:12,780 . . 616 00:30:12,780 --> 00:30:12,840 . . 617 00:30:12,840 --> 00:30:12,900 . . 618 00:30:12,900 --> 00:30:13,000 . . 619 00:30:25,080 --> 00:30:30,680 thinks it's in a mobile device because it's a really short... Okay, login. 620 00:30:45,480 --> 00:30:51,300 So right now, it's already tampering with the webpage, so this sign-in button will exfiltrate 621 00:30:51,300 --> 00:31:00,320 the credentials. So I need to use the two-factor authentication 622 00:31:00,920 --> 00:31:13,800 running in my mobile device. And verify it. So here is the model that's injecting into 623 00:31:13,800 --> 00:31:18,040 the webpage. They're probably trying to log in from a new location. 624 00:31:21,380 --> 00:31:33,260 And if we go to the security settings, so... Sorry. Something went wrong. Let me just try 625 00:31:33,260 --> 00:31:50,820 again. Okay. Okay. Okay. Okay. Okay. Okay. Okay. Okay. Okay. Okay. Okay. Okay. Okay. 626 00:31:59,360 --> 00:32:13,580 Okay. Okay. Okay. Okay. Okay. Okay. Okay. Okay. Okay. Okay. Excuse me. Sorry. Oh sorry. 627 00:32:13,680 --> 00:32:21,280 Okay. So it's now requesting my two 628 00:32:21,300 --> 00:32:27,080 original attack, it would show the iframe. So in this case, we have disabled it because 629 00:32:27,080 --> 00:32:32,720 it wouldn't be, like, it's hard to understand what's going on if you are seeing an iframe. 630 00:32:33,400 --> 00:32:44,080 And now if you go to the settings, you see this error. So something went wrong. Please 631 00:32:44,080 --> 00:32:52,400 try again later. Okay. So this is the attack, and what they aren't doing is transferring the 632 00:32:52,400 --> 00:33:02,840 funds out, but they could easily do that. If we go, if we log in using another browser, which is 633 00:33:02,840 --> 00:33:14,060 not using the burr proxy, we can confirm. So this is the attack. So if we go to the 634 00:33:39,000 --> 00:33:44,000 security settings, the two-factor authentication is disabled. So we can see this because we 635 00:33:44,000 --> 00:33:51,420 are not using the infected browser. But if we try to use Firefox, in this case, we are not 636 00:33:51,420 --> 00:33:59,760 allowed to see the settings or even change them. Let's, because we are at DEF CON, we should fix 637 00:33:59,760 --> 00:34:13,980 this immediately. All right. Okay. So now we can see the 638 00:34:27,700 --> 00:34:36,920 web. Okay. So what have we learned by doing this? So first, the first conclusion is that this 639 00:34:36,920 --> 00:34:43,840 attack is very noisy. So it basically injects the web inject in every endpoint of the web 640 00:34:44,000 --> 00:34:49,060 site. So if they were trying to be quiet, they shouldn't do that. They should target, like, 641 00:34:49,160 --> 00:34:57,740 two or three very specific URLs and only drop the web inject in those endpoints. But we can 642 00:34:57,740 --> 00:35:05,120 speculate because the attack was still being designed. Maybe the guy doesn't know yet which 643 00:35:05,120 --> 00:35:12,660 endpoints he will use. So he doesn't want to lose an opportunity to tamper in other pages 644 00:35:12,660 --> 00:35:13,480 of the web. 645 00:35:13,960 --> 00:35:13,980 Okay. 646 00:35:14,000 --> 00:35:20,580 And maybe Coinbase can change the endpoints as well. So he wants to retain the ability 647 00:35:20,580 --> 00:35:28,520 of just tamper with any inner URL. It also uses a state machine to control how it works. 648 00:35:29,000 --> 00:35:36,800 But it seems very experimental, very poorly written JavaScript. I believe it's uncompleted 649 00:35:36,800 --> 00:35:43,980 work and we have different signs that this is true, like the visible iframe, like the 650 00:35:44,000 --> 00:35:44,200 text iframe. 651 00:35:44,200 --> 00:35:50,660 Also, there's the parts in the payload where they are doing the transferring out the funds. 652 00:35:50,940 --> 00:35:57,580 But you have a return statement just at the top of that function. So it's an unconditional 653 00:35:58,070 --> 00:36:04,200 return statement. So it means that they are disabling that part. And we also saw that 654 00:36:04,200 --> 00:36:11,480 some automata states are missing from the code, seem to be missing. So two factor authentication 655 00:36:11,480 --> 00:36:12,940 or SMS confirmation. 656 00:36:13,340 --> 00:36:13,960 Okay. 657 00:36:13,960 --> 00:36:19,360 it's not a real barrier for this attack vector. And I believe 658 00:36:19,360 --> 00:36:23,280 that even security professionals can be tricked because it's so 659 00:36:23,280 --> 00:36:28,660 confusing when and when not two-factor authentication is 660 00:36:28,660 --> 00:36:34,240 used or should be used or why it's used. So you can easily be 661 00:36:34,240 --> 00:36:38,720 tricked with this. And we assume that in this case Coinbase has 662 00:36:38,720 --> 00:36:45,080 since disabled the iframing from within their website. So 663 00:36:45,420 --> 00:36:47,960 obviously you can follow the usual many of the browser 664 00:36:47,960 --> 00:36:52,920 recommendations like using a live distro to go to your 665 00:36:52,920 --> 00:36:57,220 favorite banking website or crypto exchanges. But, I mean, 666 00:36:57,880 --> 00:37:03,660 that's hurting the usability even more, right? So the 667 00:37:04,840 --> 00:37:08,700 question is, what if we could be able to use this kind of 668 00:37:08,720 --> 00:37:11,700 technology to detect the injections and do something 669 00:37:11,700 --> 00:37:16,080 about it? And this is the question that we have been 670 00:37:16,080 --> 00:37:27,220 trying to we have been working on lately. So this is 671 00:37:27,220 --> 00:37:38,700 one, two. Okay. So this the this is what we came with. So 672 00:37:38,720 --> 00:37:42,720 we have a web application real time monitoring. And this is 673 00:37:42,720 --> 00:37:46,160 more or less how it works. So it has two components, the client 674 00:37:46,160 --> 00:37:49,800 and the server. And the client components, the real time 675 00:37:49,800 --> 00:37:53,560 monitoring agents, is continuously monitoring the page 676 00:37:53,560 --> 00:37:58,600 and the DOM. And it checks for DOM injections, for JavaScript 677 00:37:59,360 --> 00:38:04,980 script injections, and for modified event handlers. And it 678 00:38:04,980 --> 00:38:08,700 does that by leveraging mutation of servers. And it does that by 679 00:38:08,720 --> 00:38:12,140 using an visitors to receive a stream of things that are being 680 00:38:12,140 --> 00:38:17,180 changed in the DOM in real time. It also combines that with the 681 00:38:17,180 --> 00:38:22,480 checksums for certain parts of the DOM. And it does poisoning 682 00:38:22,480 --> 00:38:29,060 detection. So when the injections are detected, we send 683 00:38:29,060 --> 00:38:32,680 that out to the real time monitoring backend, which 684 00:38:32,680 --> 00:38:37,360 validates if this is a real threat. And then it sends out to 685 00:38:37,360 --> 00:38:43,200 the back end application using a special web hook. So this web hook is receiving a stream 686 00:38:43,890 --> 00:38:49,620 of events of things that are being injected into the application. And this is done in 687 00:38:49,620 --> 00:38:55,700 real time. And you can set policies on your application back end on how to react to this. 688 00:38:55,960 --> 00:39:03,400 So you can black list the user, automatically freeze the account. You can do a lot of things. 689 00:39:03,400 --> 00:39:09,960 And it can be done in timely fashion in order to stop funds from being exfiltrated from the 690 00:39:09,960 --> 00:39:17,180 account. So you can send more you can ship more things to the clients as a feedback loop. And 691 00:39:17,180 --> 00:39:24,360 this can be really helpful. So it follows a white-listing approach means that it detects any 692 00:39:24,360 --> 00:39:31,180 unseen injections. It has different levels of sensitivity according to what is being injected 693 00:39:31,180 --> 00:39:33,280 and where. And it? 694 00:39:33,400 --> 00:39:36,060 uses machine learning to tackle the false positives. 695 00:39:36,500 --> 00:39:41,060 Also support signatures, so for known injections, 696 00:39:41,500 --> 00:39:44,820 in which case it can launch countermeasures. 697 00:39:45,040 --> 00:39:49,320 So it can remove injections that we already knew about, 698 00:39:49,600 --> 00:39:53,860 but it can also redirect the page to a certain URL, 699 00:39:54,160 --> 00:39:57,520 delete cookies, or execute a custom callback 700 00:39:57,520 --> 00:39:58,600 in the client side. 701 00:39:58,940 --> 00:40:00,760 So this is very flexible. 702 00:40:00,760 --> 00:40:06,980 Of course, all of this is done by using code protection 703 00:40:06,980 --> 00:40:10,440 because the client side components is JavaScript, 704 00:40:10,700 --> 00:40:14,120 can also be tampered with, so it needs to be resilient 705 00:40:14,120 --> 00:40:19,560 to any kind of manipulation from the web inject. 706 00:40:19,880 --> 00:40:22,700 So it uses polymorphic JavaScript obfuscation, 707 00:40:22,940 --> 00:40:26,840 it is tamper resistant, and can optionally be mixed 708 00:40:26,840 --> 00:40:30,300 with the code of the application, making it very hard 709 00:40:30,300 --> 00:40:34,200 to distinguish which part is the agent and which part 710 00:40:34,200 --> 00:40:36,500 is the regular code of the application. 711 00:40:37,800 --> 00:40:42,300 So let's redo the demo, but this time using 712 00:40:42,300 --> 00:40:44,240 the application real time monitoring. 713 00:40:45,960 --> 00:40:49,860 So I'll struggle a little bit with the size of the windows, 714 00:40:50,200 --> 00:40:52,080 but I'll try to do my best. 715 00:40:54,660 --> 00:40:59,620 In order to add the agent, I'm also using Burp Proxy, 716 00:40:59,620 --> 00:41:03,460 so this part is adding the agent to every web page 717 00:41:03,460 --> 00:41:07,880 dynamically, because we couldn't get Coinbase to install it 718 00:41:07,880 --> 00:41:09,820 in time for this talk, sorry. 719 00:41:13,020 --> 00:41:16,380 And let's go here again. 720 00:41:20,060 --> 00:41:25,940 And let me open the dashboard here. 721 00:41:27,080 --> 00:41:27,840 Okay. 722 00:41:27,840 --> 00:41:30,860 So I want you to be able to at least see a portion 723 00:41:31,420 --> 00:41:34,460 of this graphic in the back. 724 00:41:34,680 --> 00:41:39,020 So I will try to position things so that you can see 725 00:41:39,020 --> 00:41:42,140 a little bit, to see what happens. 726 00:41:42,740 --> 00:41:43,220 Okay? 727 00:41:44,960 --> 00:41:49,460 So I have to restart C2. 728 00:41:56,120 --> 00:41:56,600 Okay. 729 00:41:58,080 --> 00:41:58,700 Let's go. 730 00:42:15,100 --> 00:42:17,940 So we are already seeing things in the back. 731 00:42:19,240 --> 00:42:20,240 Just a second. 732 00:42:23,160 --> 00:42:24,460 Already seeing things. 733 00:42:24,560 --> 00:42:25,900 So we have four new threats. 734 00:42:26,080 --> 00:42:27,300 So things are getting, 735 00:42:27,840 --> 00:42:31,380 are landing in the, so we can see the button here. 736 00:42:33,970 --> 00:42:37,180 And you can see the overlaid button code here. 737 00:42:38,170 --> 00:42:41,080 So you could already be doing something about this. 738 00:42:45,980 --> 00:42:47,000 Let's proceed. 739 00:42:54,020 --> 00:42:56,500 This is the regular two-factor authentication. 740 00:42:58,120 --> 00:42:59,880 That's Coinbase requests. 741 00:43:11,700 --> 00:43:14,320 So here you can see the iFrame. 742 00:43:19,780 --> 00:43:23,120 So sometimes the code isn't really reliable. 743 00:43:23,380 --> 00:43:26,080 So as I said, it's a work in progress. 744 00:43:26,080 --> 00:43:30,120 And may take a long time to just move over. 745 00:43:36,840 --> 00:43:37,480 Okay. 746 00:43:37,600 --> 00:43:38,940 And we have new stuff. 747 00:43:40,240 --> 00:43:45,360 All the time they are adding the web injects to the page. 748 00:43:45,600 --> 00:43:49,920 And deciding whether they should do something or just quit. 749 00:43:49,920 --> 00:44:00,380 it. When they decide to do nothing, they also remove the injection from the web page. So 750 00:44:00,380 --> 00:44:08,440 if you do a dump at a later stage of the dump, you won't find the injection there. Okay. 751 00:44:08,500 --> 00:44:13,300 So this seems to be stuck. Let me try again. Bear with me, please. 752 00:44:22,960 --> 00:44:38,800 Of course. Sure. Yeah, good question. So burp is replacing me having my device infected. 753 00:44:39,500 --> 00:44:47,060 So if I had my device infected, my browser would be in control of the web injects. And 754 00:44:47,060 --> 00:44:49,900 as you go to Coinbase, it's automatic. 755 00:44:51,520 --> 00:45:01,160 Yes, I know. I know. We have shown you before. I can show you in the end if that's all right. 756 00:45:01,480 --> 00:45:11,260 Okay. I can show you again. So let me try this again. 757 00:45:15,480 --> 00:45:19,880 Okay. Okay. Okay. Okay. Okay. Okay. 758 00:45:23,720 --> 00:45:42,200 All right. Seems to only work at second time. Shit. Okay. So you've seen this before. Let's 759 00:45:42,200 --> 00:45:49,800 see what we have here. We have quite a few injections in the page. Let me try to show 760 00:45:49,900 --> 00:45:56,300 you a couple that might be interesting for you to see and to understand what kind of 761 00:45:56,300 --> 00:46:02,860 information we can supply. So here you can see this is a form and it's actually the two 762 00:46:02,860 --> 00:46:11,400 factor authentication thingy where it's requested like the model, complete model having the 763 00:46:12,140 --> 00:46:19,880 form to request the two factor authentication. And let's see another. So this is the 764 00:46:21,860 --> 00:46:28,640 dashboard. Okay. So this one is in the dashboard and it presents an image. Let me see what kind 765 00:46:28,640 --> 00:46:39,440 of image. This is it. So this is the icon that shows just next to the two factor authentication. 766 00:46:40,000 --> 00:46:45,340 I don't know if you remember, but this is the kind of thing that you can collect as well. 767 00:46:45,980 --> 00:46:49,880 All right. So let us go to the security. Let's go to the security. Let's go to the security. 768 00:46:49,900 --> 00:46:55,100 Let's go to the security. We can see what the security settings. Let's see the security 769 00:46:55,100 --> 00:47:09,300 settings. I'm in the wrong browser. Okay. Load the security settings. Something went wrong. 770 00:47:09,420 --> 00:47:19,880 Please try again later. Okay. So four new threats. This is all live. And we can see this 771 00:47:19,900 --> 00:47:23,820 that a bunch of DOM has just been removed 772 00:47:23,820 --> 00:47:25,620 from the security settings page, 773 00:47:25,920 --> 00:47:30,720 and this is the actual security controls 774 00:47:30,720 --> 00:47:32,240 that you usually see in the page. 775 00:47:32,380 --> 00:47:33,500 They have been removed, 776 00:47:33,700 --> 00:47:36,820 and the attacker has placed the error message. 777 00:47:38,000 --> 00:47:38,160 Okay? 778 00:47:38,400 --> 00:47:44,320 So in conclusion, 779 00:47:45,160 --> 00:47:48,840 if there's anything I'd like you to take away from this talk 780 00:47:48,840 --> 00:47:53,900 is that crypto exchanges are being targeted 781 00:47:53,900 --> 00:47:55,060 by many in the browser, 782 00:47:55,180 --> 00:47:58,440 and they should beware of this attack vector. 783 00:47:59,240 --> 00:48:04,980 Of course, every other vector should be in their horizon as well. 784 00:48:06,360 --> 00:48:09,100 But I believe we are seeing more of this 785 00:48:09,100 --> 00:48:11,480 because it's far too appealing for an attacker 786 00:48:11,480 --> 00:48:14,540 because it's anonymous, it's untraceable, 787 00:48:15,160 --> 00:48:16,420 and if they get out, 788 00:48:16,460 --> 00:48:18,260 it's really difficult to... 789 00:48:18,840 --> 00:48:21,700 to find out who stole the money. 790 00:48:22,490 --> 00:48:26,860 So I think this attack against Coinbase and Blockchain.info 791 00:48:26,860 --> 00:48:28,520 can be seen as warnings 792 00:48:30,080 --> 00:48:33,220 because the work, after all, was incomplete. 793 00:48:33,640 --> 00:48:35,780 We don't know if there were consequences. 794 00:48:36,660 --> 00:48:38,400 We know that the credentials 795 00:48:38,400 --> 00:48:41,420 could have been stolen during this period, 796 00:48:41,640 --> 00:48:46,700 so we don't know if someone is using them in any way. 797 00:48:47,060 --> 00:48:48,820 But we know that... 798 00:48:48,840 --> 00:48:50,860 at least this version of the Trojan 799 00:48:50,860 --> 00:48:52,840 is not yet stealing money. 800 00:48:53,300 --> 00:48:56,020 And other conclusion is that 801 00:48:56,020 --> 00:48:56,960 two-factor authentication 802 00:48:57,680 --> 00:49:00,520 is not enough for this attack vector. 803 00:49:00,980 --> 00:49:03,940 So definitely, exchanges can improve their defenses. 804 00:49:04,320 --> 00:49:06,800 Things like temporary freezing the account 805 00:49:06,800 --> 00:49:11,100 when you change anything about the security of your account. 806 00:49:11,460 --> 00:49:14,960 And I don't mind paying with usability, 807 00:49:15,740 --> 00:49:17,520 but at least do it right 808 00:49:17,520 --> 00:49:17,880 and... 809 00:49:18,660 --> 00:49:18,820 and... 810 00:49:18,840 --> 00:49:19,160 don't... 811 00:49:19,160 --> 00:49:22,680 don't provide workarounds for people to just go 812 00:49:22,680 --> 00:49:24,380 and disable two-factor authentication 813 00:49:24,380 --> 00:49:30,640 because this can also be a tool for web injects 814 00:49:30,640 --> 00:49:33,960 and for Trojans to be able to perform their attack. 815 00:49:34,840 --> 00:49:38,360 So I think attacks will most likely get more creative 816 00:49:38,820 --> 00:49:42,080 and they can be executed by anyone. 817 00:49:42,320 --> 00:49:46,080 Because you can acquire a Trojan kit in the black market. 818 00:49:46,160 --> 00:49:48,820 You don't need to really understand how it works. 819 00:49:48,820 --> 00:49:51,340 You just need to write some JavaScript 820 00:49:51,340 --> 00:49:53,880 that goes into a web page 821 00:49:53,880 --> 00:49:56,220 and adds stuff to the DOM, 822 00:49:56,400 --> 00:49:57,240 removes others, 823 00:49:57,580 --> 00:49:59,340 and implements a state machine 824 00:49:59,340 --> 00:50:01,520 to control how you are doing that. 825 00:50:01,860 --> 00:50:03,780 So it's not really sophisticated. 826 00:50:04,220 --> 00:50:05,320 It's really simple. 827 00:50:05,540 --> 00:50:08,120 And due to the potential returns, 828 00:50:09,040 --> 00:50:11,500 I think we are definitely seeing more stuff. 829 00:50:12,320 --> 00:50:15,100 I think for this attack vector application, 830 00:50:15,260 --> 00:50:16,580 real-time monitoring is... 831 00:50:16,580 --> 00:50:17,920 is really... 832 00:50:17,920 --> 00:50:18,800 can be... 833 00:50:18,820 --> 00:50:19,060 can be effective. 834 00:50:19,900 --> 00:50:22,700 We just assume that the injections will occur. 835 00:50:22,960 --> 00:50:24,160 We cannot prevent that. 836 00:50:24,380 --> 00:50:27,880 And try to detect them in real-time when they do. 837 00:50:28,340 --> 00:50:30,240 You can set custom policies. 838 00:50:30,600 --> 00:50:33,200 You can adopt what you're doing in real-time. 839 00:50:33,480 --> 00:50:35,420 And you can mitigate the attacks 840 00:50:35,420 --> 00:50:36,940 before they are successful. 841 00:50:38,480 --> 00:50:41,560 And as you know, if attacks keep failing, 842 00:50:42,620 --> 00:50:45,340 probably the attackers will move to the next site 843 00:50:45,340 --> 00:50:48,180 because they always look for the least amount of effort 844 00:50:48,820 --> 00:50:51,300 and the maximum profits they can have. 845 00:50:51,960 --> 00:50:56,740 So I cannot tell you exactly how to earn money 846 00:50:56,740 --> 00:50:59,620 using this talk, like Ming said, 847 00:51:00,360 --> 00:51:01,700 because I shouldn't, 848 00:51:02,380 --> 00:51:04,020 unless you pay me a beer afterwards. 849 00:51:04,960 --> 00:51:06,640 Then I can consider that. 850 00:51:09,160 --> 00:51:10,800 So this is all I have. 851 00:51:10,920 --> 00:51:11,360 Thank you. 852 00:51:11,840 --> 00:51:12,900 Thank you. 853 00:51:13,480 --> 00:51:14,240 Thank you.