1 00:00:00,000 --> 00:00:07,120 This talk is Escaping the Privacy Sandbox with Client-Side De-Anonymization Attacks. 2 00:00:07,120 --> 00:00:10,560 So if this is the wrong talk, this is your time to change. 3 00:00:10,560 --> 00:00:12,420 But otherwise, thank you for staying with me. 4 00:00:12,420 --> 00:00:14,800 And let's have a good 45 minutes. 5 00:00:15,980 --> 00:00:17,640 So a little bit about me. 6 00:00:18,000 --> 00:00:18,980 I'm Eugene Lim. 7 00:00:18,980 --> 00:00:21,880 I go by SpaceRaccoonOnline and I'm from Singapore. 8 00:00:22,040 --> 00:00:25,340 It took about 15-16 hours to get here. 9 00:00:25,340 --> 00:00:28,800 And it's currently, I think, 7.30am in Singapore. 10 00:00:28,800 --> 00:00:31,360 So let's see if I can make it. 11 00:00:31,500 --> 00:00:36,340 In my day job, I do application security for a small organization of about 200 people. 12 00:00:36,340 --> 00:00:39,340 So I focus on cybersecurity, application security. 13 00:00:39,420 --> 00:00:42,460 But outside of my day job, I love to do vulnerability research. 14 00:00:42,460 --> 00:00:46,520 I kind of touch everything from hardware to software to web technologies. 15 00:00:46,700 --> 00:00:51,840 One of my most recent pieces of research was smart weighing scales that connected to the Internet. 16 00:00:52,000 --> 00:00:58,220 And I think the question of why would you connect that to the Internet is a pretty common theme across a lot of the stuff that I've done. 17 00:00:58,220 --> 00:01:01,100 So that's really part of my interest. 18 00:01:02,260 --> 00:01:12,280 So before we begin, I thought I'd just give a bit of background on what this is all about and why the Privacy Sandbox, why the Google Privacy Sandbox exists. 19 00:01:12,360 --> 00:01:18,980 And you may be aware that third-party cookies are a piece of web technology that's on the way out. 20 00:01:19,040 --> 00:01:29,060 A lot of advertising platforms use third-party cookies in order to track users and analytics and perform all kinds of functions such as conversion tracking. 21 00:01:29,060 --> 00:01:35,720 For example, if you view an ad and you make a purchase because you saw the ad, third-party cookies kind of serve that function. 22 00:01:36,380 --> 00:01:45,900 But one of the big changes that's happened in recent years is that browsers are starting to phase out third-party cookies because, you know, it's not great for privacy. 23 00:01:46,080 --> 00:01:53,000 And you may have also noticed that there's a bunch of new legislation and regulations that are restricting the use of third-party cookies. 24 00:01:53,000 --> 00:01:58,360 So if you have ever seen a website and you had a pop-up that says, do you accept or allow cookies? 25 00:01:58,360 --> 00:02:01,840 That's all part of that going on behind the scenes. 26 00:02:02,020 --> 00:02:05,420 And obviously, I think consumers are getting a lot smarter as well. 27 00:02:05,420 --> 00:02:14,760 So you see now browser add-ons and extensions as well as network-level ad blocking that are blocking the use of these third-party cookies. 28 00:02:14,980 --> 00:02:28,360 So in recognition of that, Google came up with the Privacy Sandbox technologies which allow and replace these third-party cookies functions in advertising, but do it in a more privacy-preserving manner. 29 00:02:28,440 --> 00:02:31,480 And I think we're going to unpack that for the rest of this talk. 30 00:02:32,200 --> 00:02:34,660 Now, I want to address the elephant in the room. 31 00:02:34,660 --> 00:02:43,000 So for those of you who are kind of plugged into this, Google has been saying that they're going to phase out third-party cookies for about, I think, four years now, since 2022. 32 00:02:43,260 --> 00:02:46,440 And every year, they kind of say, OK, we'll do it next year. 33 00:02:46,440 --> 00:02:52,840 And what happened in April, very conveniently, right after I submitted my talk, they said, OK, we're giving up. 34 00:02:52,840 --> 00:02:56,900 So we're not going to use Privacy Sandbox to completely replace third-party cookies. 35 00:02:56,900 --> 00:02:58,720 We're going to keep third-party cookies. 36 00:02:59,160 --> 00:03:06,420 But I think all that being said, why do we still care about the Privacy Sandbox that Google has built? 37 00:03:06,980 --> 00:03:10,420 Well, number one, obviously, is that it's already live. 38 00:03:10,420 --> 00:03:15,360 It's still being served in Chrome and Chromium-based browsers, including Microsoft Edge, for example. 39 00:03:15,360 --> 00:03:18,500 And a lot of ad tech companies still use it. 40 00:03:18,540 --> 00:03:23,940 Google is one of the biggest advertising platforms out there, and they still rely heavily on Privacy Sandbox. 41 00:03:24,560 --> 00:03:27,760 And I think, most importantly, it's still interesting, right? 42 00:03:27,820 --> 00:03:36,080 Because one thing that stood out to me when I was doing this research is that ad tech companies really don't want you to know about ad tech. 43 00:03:36,080 --> 00:03:37,900 They don't have a lot of documentation. 44 00:03:37,900 --> 00:03:40,400 They don't really publish a lot. 45 00:03:40,400 --> 00:03:44,500 And part of the reason why is, obviously, they take a lot of information, right? 46 00:03:44,500 --> 00:03:47,320 And they don't really want you to know too much about that. 47 00:03:47,320 --> 00:03:53,180 But I think also because it is privacy, it may not often overlap with security in some senses. 48 00:03:53,180 --> 00:03:59,340 And not a lot of research has gone into this very interesting field of Internet technology. 49 00:03:59,440 --> 00:04:04,180 But the fact is that advertising takes up a large part of the Internet today. 50 00:04:04,180 --> 00:04:10,500 And if you actually uncover a little bit more about it, as I have, there's a lot to unpack. 51 00:04:10,500 --> 00:04:12,280 So we're going to dive right in. 52 00:04:14,500 --> 00:04:16,740 So what is the Privacy Sandbox? 53 00:04:17,020 --> 00:04:26,980 This is a piece of technology that Google has built up over the years that's meant to replace some of the features and functions of third-party cookies to perform stuff like tracking, conversions. 54 00:04:27,340 --> 00:04:29,140 And it consists of three parts. 55 00:04:29,200 --> 00:04:35,480 The first is a set of proprietary... well, I wouldn't say proprietary, but client-side browser and mobile APIs. 56 00:04:35,480 --> 00:04:40,280 These are JavaScript interfaces that allow you to then perform some of these functions. 57 00:04:40,280 --> 00:04:50,280 The second is a walled garden that Google operates that allows advertising platforms to register with Google and also call on these APIs. 58 00:04:50,780 --> 00:04:52,300 And the last is pretty interesting. 59 00:04:52,300 --> 00:05:02,700 It is an aggregation and decryption of some of these aggregated analytic data in trusted execution environments that Google allows you to deploy in your own cloud accounts. 60 00:05:02,700 --> 00:05:08,960 And this is pretty interesting because they use the term trusted execution environment, but you're really just executing it in your own cloud account. 61 00:05:08,960 --> 00:05:13,380 And so there's some question as to whether it is that trusted. 62 00:05:13,580 --> 00:05:25,040 But for today, I'm going to focus on client-side browsers and mobile APIs, the client side of this, and there's already a lot that you can do to subvert some of these protections that the Privacy Sandbox offers. 63 00:05:26,420 --> 00:05:33,360 So I'm going to go through, I think, three weaknesses that I've discovered as part of my deep dive into the Privacy Sandbox. 64 00:05:33,420 --> 00:05:41,740 The first is the Attribution Reporting API and how I was able to leak some information through what they call transitional debug reports. 65 00:05:41,820 --> 00:05:47,260 The second is browser history reconstruction or stealing via side channels. 66 00:05:47,260 --> 00:05:55,880 And the last is the Shared Storage API, where I was able to leak private data from the shared storage through insecure workload code. 67 00:05:56,640 --> 00:06:04,960 And if you have some time, I'm happy to just take questions from outside of this talk if you have any questions to have. 68 00:06:06,260 --> 00:06:08,260 So let's dive right in. 69 00:06:08,260 --> 00:06:11,060 What is the Attribution Reporting API? 70 00:06:11,060 --> 00:06:20,940 And what you see here is kind of a screenshot from the Chrome debug where you can see the source triggers and reports that make up the Attribution Reporting API. 71 00:06:21,620 --> 00:06:32,200 Essentially, I think the Privacy Sandbox provides the Attribution Report API to solve and address a very common advertiser's problem, which is, all right, I paid for someone to see an ad. 72 00:06:32,200 --> 00:06:34,420 Did that ad actually lead to a conversion? 73 00:06:34,420 --> 00:06:40,080 If someone viewed the ad on website A, did they click the ad and eventually make a purchase on website B? 74 00:06:40,240 --> 00:06:42,580 And this operates entirely on the client side. 75 00:06:42,580 --> 00:06:49,100 So I'm going to break it down into a few steps about how this Attribution Reporting API works. 76 00:06:50,520 --> 00:06:56,000 Well, step one is, obviously, you have to first view the ad, and that's registering a source. 77 00:06:56,160 --> 00:07:04,600 So, for example, you visit a website like the publisher's website, it may be a new site or some other site that's hosting the ad, and you interact with the ad in some way. 78 00:07:04,600 --> 00:07:16,380 You may click on it, you may view it, and this can be done and registered using the AttributionSource attribute or the JavaScript AttributionSource option to any kind of XML HTTP request. 79 00:07:17,300 --> 00:07:34,840 Once this is done, the browser automatically sends a request with the Attribution Reporting eligible header to your AdTags server, which will then respond with an AttributionReportingRegisterSource header, which includes a specific destination that that ad is linked to, 80 00:07:34,840 --> 00:07:35,880 so that source. 81 00:07:35,880 --> 00:07:40,280 So, for example, you viewed an ad to maybe buy tickets to Singapore, right? 82 00:07:40,280 --> 00:07:44,500 The destination might be SingaporeAirlines.com, and so on and so forth. 83 00:07:44,500 --> 00:07:52,480 And this is then stored by the browser on your client-side storage for future matching, which I'll go into in the next steps. 84 00:07:53,380 --> 00:08:00,060 So you've viewed the ad, and now your browser knows that you've viewed this ad and potentially may make a conversion. 85 00:08:00,240 --> 00:08:06,640 This is what the request looks like when you make a request to the Google Ads server. 86 00:08:06,900 --> 00:08:09,440 Again, you can see the headers that are being sent. 87 00:08:09,540 --> 00:08:12,740 What's interesting I want to draw your attention to is on the right side. 88 00:08:12,920 --> 00:08:28,780 In the response as well, you would see some information regarding your source, such as the aggregation keys, the destination, some debug information, and all of these metadata that's used to characterize the ad that you just viewed for future analytics. 89 00:08:31,060 --> 00:08:32,320 So what's step two? 90 00:08:32,320 --> 00:08:34,080 Step two is a trigger. 91 00:08:34,080 --> 00:08:46,820 So you may click on that ad, you may go back to the website that was advertised later and make a purchase, and regardless of that, this is counted as a conversion that they may want to register. 92 00:08:47,320 --> 00:08:57,160 In order to do so, it's going to send a request again by your browser with the attribution reporting eligible header, and the AdTag server is going to respond accordingly as well. 93 00:08:57,160 --> 00:09:00,700 And this will then trigger source trigger matching. 94 00:09:01,480 --> 00:09:04,020 So this is what the requests look like. 95 00:09:04,020 --> 00:09:14,560 On the left, you have some sort of trigger where you maybe bought a product, and the Google Ads server is going to respond with some of this header data. 96 00:09:14,560 --> 00:09:23,500 You may notice, for example, some filters that are used to, again, characterize what kind of purchase you made, that may then be used to calculate a conversion. 97 00:09:24,880 --> 00:09:26,680 And this is the last step. 98 00:09:26,820 --> 00:09:34,280 After you have registered the source and you perform a trigger, the browser is going to try to match that trigger with your source. 99 00:09:34,280 --> 00:09:38,780 So, for example, you made a purchase after viewing an ad for Apple products. 100 00:09:38,780 --> 00:09:51,120 It's going to confirm if that happened by comparing the stored source in your browser storage, and it's going to use several other filters to confirm this. 101 00:09:51,220 --> 00:09:58,240 And it will then send an event level or summary report to the AdTag server, telling them that, yes, a successful conversion had occurred. 102 00:09:59,160 --> 00:10:08,540 So that was a lot of talking to explain what seems like a pretty simple function, which is just to register a successful conversion. 103 00:10:08,540 --> 00:10:13,500 And you can probably imagine how this can be done already using third-party cookies. 104 00:10:15,000 --> 00:10:27,380 But I think one of the key things, if you look at the request that was sent, where it's an event report confirming a successful conversion, is that there's actually quite limited data that's being sent. 105 00:10:27,380 --> 00:10:36,760 It sends a destination where this attribution has occurred, it sends some metadata related to your conversion, but not a lot more than that, and that is by design. 106 00:10:38,540 --> 00:10:45,260 So there are some intended privacy protections for this very complex way of implementing a conversion. 107 00:10:45,660 --> 00:10:49,740 First is that Google Privacy Sandbox adds randomization. 108 00:10:49,740 --> 00:10:58,800 It randomizes the time when the report will be sent, so that you can't individually filter for a specific individual's behavior. 109 00:10:59,100 --> 00:11:03,260 It sends a limited set of data that is supported by the Privacy Sandbox API. 110 00:11:03,260 --> 00:11:20,740 And it's also pretty noisy, because it adds, I think, aggregate noise, so that while individual activity is somewhat obfuscated, you can't actually track a single person's browsing history because of this, on aggregate, you're still going to get fairly accurate data and analytics. 111 00:11:20,860 --> 00:11:25,060 So this seems like it solves all of the problems. 112 00:11:25,060 --> 00:11:28,360 You have privacy, but you also have analytics. 113 00:11:28,360 --> 00:11:29,640 So that sounds pretty good. 114 00:11:29,640 --> 00:11:31,920 So obviously we've got to break it. 115 00:11:33,140 --> 00:11:42,620 So one of the first things about the Privacy Sandbox API that you may notice is that it tries to solve many problems at once. 116 00:11:42,620 --> 00:11:49,360 It tries to make the marketers happy, it tries to make the advertising platforms happy, and it tries to satisfy privacy concerns. 117 00:11:49,460 --> 00:11:53,740 And one symptom of that is that you see a lot of escape hatches. 118 00:11:53,740 --> 00:11:56,940 And one of these escape hatches is debugging reports. 119 00:11:56,940 --> 00:12:04,540 So if you look at the documentation for the Privacy Sandbox API, it says that these are explicitly transitional debugging reports. 120 00:12:04,540 --> 00:12:06,420 They're not meant to last forever. 121 00:12:06,580 --> 00:12:10,780 They're only supposed to last up until third-party cookies are deprecated. 122 00:12:10,840 --> 00:12:12,800 Well, good luck with that, because they're not doing that anymore. 123 00:12:12,800 --> 00:12:15,000 So this is now a permanent feature. 124 00:12:15,400 --> 00:12:29,540 And what this is used for is essentially a way for advertising platforms to perform additional debugging requests with additional information about a particular conversion, or ad view, and so on. 125 00:12:30,760 --> 00:12:33,640 And ostensibly, this is a feature, not a bug. 126 00:12:35,380 --> 00:12:44,180 Now, if any of you have done source code review or static analysis, you'll know that one of the favorite things to look out for is to-dos, because it never gets done in the code. 127 00:12:44,180 --> 00:12:55,620 And this is one of the to-dos in the system design for Privacy Sandbox API, where they said, consider adding support for the top-level site to opt in to receiving debug reports without cross-site leak. 128 00:12:55,620 --> 00:13:02,620 And what this means is that it's supposed to prevent leaking of cross-site data. 129 00:13:02,940 --> 00:13:05,600 Let me illustrate this with a simple example. 130 00:13:06,020 --> 00:13:10,020 A website may be loading third-party resources from a different origin. 131 00:13:10,020 --> 00:13:17,560 And typically, browsers can send a referral header that tells the third-party origin where this resource was being loaded from. 132 00:13:17,560 --> 00:13:20,380 And in some cases, this might be sensitive information. 133 00:13:20,440 --> 00:13:31,180 For example, you may be loading a website or an ad that is owned by a third party, and you don't want to know where the ad was being viewed. 134 00:13:31,520 --> 00:13:37,720 In this case, you would send a referral policy header with the no-referral value. 135 00:13:38,420 --> 00:13:49,260 But if you had enabled the Attribution Reporting API on this page, it would actually send the referral site, despite the no-referral policy, via a debugging report. 136 00:13:49,260 --> 00:13:56,460 So this would actually subvert a mitigation that you would typically have to prevent leaking of the top-level site. 137 00:13:58,040 --> 00:14:09,200 So what this means is that previous mitigations or protections that were based on this assumption of using the referral header no longer work as intended. 138 00:14:09,220 --> 00:14:12,340 And one of these technologies is SafeFrame. 139 00:14:12,540 --> 00:14:24,380 So SafeFrame is a hardened iframe standard by the Interactive Advertising Bureau, which is a conglomeration of various advertising platforms, including Google, which uses them for double-click ads. 140 00:14:25,460 --> 00:14:31,140 What SafeFrame is supposed to do is because actually serving ads on your website can be pretty risky. 141 00:14:31,140 --> 00:14:42,940 What you're essentially doing is that you are running JavaScript or HTML that is created by the person purchasing the ad, and this may actually be a security risk for your website. 142 00:14:43,280 --> 00:14:56,640 So by putting all of these ads within a SafeFrame, what it's meant to do is that it's prevent and limit the amount of data that's leaked through the SafeFrame or the amount of control that's done through the SafeFrame to the publisher website. 143 00:14:58,120 --> 00:15:05,600 But what the Attribution Reporting API does is that it effectively subverts the protections of the SafeFrame. 144 00:15:05,620 --> 00:15:16,860 You can trigger header error debugging reports deliberately through malformed Attribution Reporting API response headers, and this would then leak the top-level site. 145 00:15:17,700 --> 00:15:20,400 So I'll just kind of walk through an example here. 146 00:15:20,400 --> 00:15:27,720 We start with visiting the website, for example, the publisher, or maybe diverge.com, which is a tech website. 147 00:15:27,740 --> 00:15:34,560 And you interact with an ad that is within a SafeFrame, and this is how some Google ads are sometimes served. 148 00:15:35,340 --> 00:15:43,780 And it would then trigger an Attribution Reporting-eligible header to your attacker-controlled attack server. 149 00:15:44,180 --> 00:15:56,280 And by sending a malformed response in your header, this would trigger a header error debugging report on the browser site, which includes the contact site, which is the top-level site. 150 00:15:56,740 --> 00:16:04,120 Essentially, this tells the person who bought the ad and served the ad which website your ad was viewed in. 151 00:16:04,480 --> 00:16:10,880 Now, this might not seem so serious, but this is actually information that is typically meant to be obscured. 152 00:16:10,880 --> 00:16:17,160 You're not supposed to know whether this individual IP address has visited X website or not. 153 00:16:17,160 --> 00:16:24,100 If you buy an ad on Google, this data is aggregated, but it's not broken down into specific IP addresses. 154 00:16:24,360 --> 00:16:39,120 So by purchasing an ad on Google Ads, for example, and if this weakness was available, you would then be able to kind of serve a Trojanized ad that would de-anonymize the browsing traffic of anyone who views your ads. 155 00:16:40,500 --> 00:16:50,860 So this effectively subverts some of the protections in older advertising technology that may not have accounted for this new API. 156 00:16:51,960 --> 00:16:56,700 So what was pretty interesting was seeing how various advertising platforms dealt with this. 157 00:16:56,700 --> 00:17:09,600 If you look at Facebook Ads, which doesn't use SafeFrame, but has its own sandbox domain, it essentially disabled the Attribution Reporting API completely using the permissions policy header. 158 00:17:09,780 --> 00:17:11,560 And I think that probably makes sense. 159 00:17:11,560 --> 00:17:27,520 It's kind of a cat-and-mouse game, but this kind of highlights how important it is that your iFrame or your SafeFrame, where you're serving an ad, needs to be kind of a hermetic environment because new technologies emerge all the time, such as Attribution Reporting API, 160 00:17:27,520 --> 00:17:30,940 and this may break certain assumptions that your protections have been built on. 161 00:17:32,220 --> 00:17:37,820 So this was kind of an interesting start to this research. 162 00:17:37,820 --> 00:17:43,060 But what was more interesting is the destination hijacking attack. 163 00:17:43,700 --> 00:17:53,240 Now, what Privacy Sandbox API allows through Attribution Reporting API is to register multiple destinations, up to three of them, per source registration. 164 00:17:53,240 --> 00:18:07,960 So say, for example, you saw an ad for buying tickets to Singapore, and you can register not just SingaporeAirlines.com, you can register several other destination websites where someone can perform the conversion of buying a ticket. 165 00:18:09,180 --> 00:18:24,340 But while I was checking the real-world implementations of this in various websites, in this case, I was on Diverge.com, I began to notice two strange domains that were appearing throughout all of the Google DoubleClick ads that were served. 166 00:18:24,760 --> 00:18:33,760 If you kind of look at it here, I was viewing an ad for Semrush.com, and so obviously one of the destinations linked to this ad was Semrush.com. 167 00:18:33,980 --> 00:18:36,550 But two other destinations were added to it. 168 00:18:36,820 --> 00:18:41,920 One was DebugConversionDomain1.com and DebugConversionDomain2.com. 169 00:18:42,360 --> 00:18:46,520 Do you kind of want to make a guess what's wrong with these domains? 170 00:18:48,300 --> 00:18:50,080 Yeah, you could buy them. 171 00:18:50,460 --> 00:19:03,140 So Google DoubleClick ads was basically injecting this into every single ad that they served across the Google ad network as one of the destinations, and they didn't buy it for some reason. 172 00:19:03,140 --> 00:19:04,820 So it was debugging, right? 173 00:19:04,820 --> 00:19:05,820 So I bought it for $10. 174 00:19:05,900 --> 00:19:08,200 Or $20, because I bought both of them. 175 00:19:09,060 --> 00:19:12,340 Now, the question is, what can you actually do with it, right? 176 00:19:12,800 --> 00:19:20,040 On the surface, if you understand and kind of look through the attribution reporting API, this isn't super serious. 177 00:19:20,040 --> 00:19:22,640 It seems like you can maybe perform ad click fraud. 178 00:19:23,400 --> 00:19:41,580 So if a user visits a website, and you interact with the ad, and we now know that Google DoubleClick ads injects these two additional destinations for every single ad out there, if they then visit my attacker-controlled site, which is now DebugConversionDomain1 or 2.com, 179 00:19:41,580 --> 00:19:46,560 I could then trigger an attribution, and this would be counted as a conversion. 180 00:19:47,320 --> 00:19:51,320 So, OK, cool, but not super crazy. 181 00:19:51,900 --> 00:19:55,960 What I wanted to do was really just figure out what you've done, right? 182 00:19:55,960 --> 00:19:59,280 What websites you've been visiting and where you've seen ads. 183 00:20:01,100 --> 00:20:08,520 So I began looking for ways to get around this, and one of the things I started looking into was rate limits. 184 00:20:09,680 --> 00:20:14,840 The attribution reporting API is really very intentionally designed to preserve privacy. 185 00:20:14,840 --> 00:20:16,880 I don't think that's really a question. 186 00:20:16,880 --> 00:20:27,840 And one of the ways they've done this is they have added rate limits for various actions, because, for example, they don't want an advertiser to track too much information about a particular individual. 187 00:20:28,200 --> 00:20:36,480 They also don't want to create resource exhaustion by triggering too many of these client-side storage. 188 00:20:36,860 --> 00:20:43,800 There is one undocumented storage limit for event-level reports per destination site to prevent excessive resource usage. 189 00:20:44,400 --> 00:20:49,200 And through testing, I found that this was actually a limit of 1,000, so not too much. 190 00:20:49,200 --> 00:20:56,660 And when this limit is hit, new conversion reports can no longer be sent, and it's going to send an error instead. 191 00:20:58,780 --> 00:21:05,380 So we can actually leverage this oracle to find out if a user had visited a particular website. 192 00:21:05,840 --> 00:21:16,580 So, for example, they visit a publisher website, and they viewed an ad, and now we know, again, DoubleClick injects these two additional domains on top of the intended destination domain. 193 00:21:16,580 --> 00:21:24,640 And if the user did visit that destination domain and perform a conversion event, then one event-level report would be sent. 194 00:21:25,180 --> 00:21:45,240 But later, if they were to visit the attacker-controlled website, because I control debugconversion1.com and 2.com, I'm able to then repeatedly trigger source and trigger registrations and perform that matching, and trigger the remaining 999 event-level reports. 195 00:21:47,610 --> 00:21:56,450 Conversely, if that user didn't actually visit the advertiser.com destination, I would be able to send 1,000 of these reports instead. 196 00:21:56,450 --> 00:22:04,960 So this effectively allows me to use a Boolean oracle to determine if that user had actually visited the advertised website or not. 197 00:22:07,310 --> 00:22:25,630 So this then allows me to achieve de-anonymization, because by understanding and leveraging the DoubleClick ad network, I can figure out exactly where the user has been through a combination of filters and also this rate-limit oracle. 198 00:22:26,630 --> 00:22:37,930 Now, again, this is pretty much the opposite of what the Privacy Sandbox is supposed to do, which is to not leak an individual's browsing history to anyone. 199 00:22:37,970 --> 00:22:44,610 More concerning is that this doesn't even require me to be serving a protogenized ad in any form. 200 00:22:44,610 --> 00:22:51,570 It just means that the user has to have visited a website that served a Google DoubleClick ad in the past. 201 00:22:52,370 --> 00:22:58,610 So this is all fairly interesting, but there's still more to find. 202 00:22:58,870 --> 00:23:15,410 As I began to look into the rest of the advertising platforms, I noticed, for example, sites like YouTube.com were serving Privacy Sandbox API, Attribution API registrations with interesting destinations. 203 00:23:15,410 --> 00:23:18,970 In this case, user 436576.site. 204 00:23:18,970 --> 00:23:34,550 And one of the conclusions I kind of draw from this is that advertising platforms are actually kind of piggybacking on this data field to inject user-identifying information or use it for other kind of debugging purposes. 205 00:23:34,670 --> 00:23:51,450 And this is actually a common pattern you see in schemas, in protocols, when people have to perform certain actions, but the schema doesn't support it, so they use the existing schema to kind of hijack and build their own features on top of that. 206 00:23:51,470 --> 00:23:57,410 So there's actually a lot more to find in this abuse of destination sites. 207 00:23:59,370 --> 00:24:03,590 So the next thing I want to talk about is the Shared Storage API. 208 00:24:03,870 --> 00:24:13,530 So what the Shared Storage API essentially is, is a privacy sandbox API for cross-site storage and access to data in a privacy -preserving way. 209 00:24:13,550 --> 00:24:27,970 This again serves an advertising outcome , which is to able to store a user's interest group or any other identifying information regarding that user and to use it to then customize the ads that the user views. 210 00:24:27,970 --> 00:24:37,150 So it may store items such as, this person's a cat lover, or a new home buyer , and then be able to use this to serve specific ads for that user. 211 00:24:39,050 --> 00:24:44,430 And how this works is, again, through a set of JavaScript APIs unique to the privacy sandbox. 212 00:24:44,810 --> 00:24:48,410 In this case, for example, it would first set this value. 213 00:24:48,630 --> 00:24:51,070 In this case, ABTestingGroup is zero. 214 00:24:51,830 --> 00:24:55,550 Once this is set, it essentially should never be accessed again. 215 00:24:55,550 --> 00:25:01,790 The privacy sandbox API for shared storage does not allow you to directly retrieve that value ever again. 216 00:25:01,790 --> 00:25:10,010 So no website should be able to understand which cohort you belong to, what your interests are, again, to preserve the privacy of the individual. 217 00:25:10,970 --> 00:25:17,750 Instead, what you have to do through the shared storage API is to use something called shared storage worklet modules. 218 00:25:18,770 --> 00:25:22,950 And what this module does is that it uses something called an output gate. 219 00:25:22,950 --> 00:25:38,690 So for those of you who are familiar with, I think, confidential compute or trusted execution environments, this pattern actually takes some inspiration from that, where there's some private data that you do not want to expose directly to the person using that data, 220 00:25:38,690 --> 00:25:42,090 but that person can call on that data through a function. 221 00:25:42,090 --> 00:25:46,350 In this case, select a URL for what app to serve to that user. 222 00:25:46,810 --> 00:25:51,390 And the output of that function is the only thing that comes out of it. 223 00:25:51,390 --> 00:25:53,550 You never really access that data directly. 224 00:25:54,150 --> 00:25:58,810 So this is called an output gate in privacy sandbox API terminology. 225 00:25:58,810 --> 00:26:15,310 And what this output gate is then fed to is another privacy sandbox API unique element, which is called fence frame, which is some variant of an iframe with even more opaqueness so that the top level site can't even query what content is being loaded in a fence frame. 226 00:26:16,190 --> 00:26:30,510 So again, all of this complexity, all of this design, the whole point of it is that it should be completely opaque to the publisher side or the advertiser what value is in the shared storage. 227 00:26:30,950 --> 00:26:39,690 And this also allows them to anonymize a certain user based on what ads they're seeing online. 228 00:26:40,930 --> 00:26:53,710 So as I mentioned when I first discussed debugging reports, one of the symptoms that you see with the privacy sandbox API is escape hatches. 229 00:26:53,710 --> 00:26:59,510 And these escape hatches then subvert some of the protections built into the privacy sandbox. 230 00:27:00,170 --> 00:27:11,950 And there are a number of discussions, and I was looking through the GitHub issues, the mailing lists, and the documentation where there was this discussion about allowing for cross-origin shared storage workloads. 231 00:27:11,950 --> 00:27:21,310 This means that the origin that set the shared storage and the module that is allowed to access it can be loaded by other origins. 232 00:27:21,370 --> 00:27:23,630 And it's an opt-in feature. 233 00:27:23,930 --> 00:27:28,530 And this means that you have to make sure that your script is secure. 234 00:27:29,830 --> 00:27:37,450 Unfortunately, as we know, this is a foot gun that means that there's a lot of insecure implementations out there. 235 00:27:38,590 --> 00:27:43,970 One example I have here is fledge.criteo.com workload code. 236 00:27:43,970 --> 00:27:46,410 Criteo is another big advertising platform. 237 00:27:46,970 --> 00:27:52,590 In this case, it seemed fairly experimental, so I wouldn't say that this is full production. 238 00:27:52,950 --> 00:28:02,670 But in this case, what they were using shared storage for, and this is simplified code, they were using to set the A-B testing population value of a user. 239 00:28:03,190 --> 00:28:05,670 And this would be put in shared storage. 240 00:28:06,610 --> 00:28:21,070 Later on, this would then be used to select a URL that would be the advertising URL that would be displayed to that user, simply by performing an ends-with string match with the list of URLs passed to this function. 241 00:28:21,590 --> 00:28:34,410 Now you can see why this is probably an issue, because you're not actually supposed to know, firstly, what population this person is supposed to do, but you can infer that based on the URL that was matched. 242 00:28:36,410 --> 00:29:06,110 So in this case, what we see here is a proof-of-concept way to exploit this implementation, where an attacker, because this is a cross-origin workload code, can load the workload code and pass to it a number of URLs, and essentially add a fragment at the end of these URLs for the entire range of possible values that Chrome A-B-T population could be in a shared storage. 243 00:29:06,910 --> 00:29:16,530 And by loading the selected URL, you would now then be able to infer and retrieve the value of this shared storage. 244 00:29:19,180 --> 00:29:33,160 So in this case, we see here that shared storage value for Chrome A-B-T population is 2, and simply by visiting this proof-of-concept website, you're now able to fetch this value and kind of infer that and leak this value. 245 00:29:33,820 --> 00:29:38,740 I emphasize again that this is something that you're not supposed to do with the shared storage API. 246 00:29:38,740 --> 00:29:51,860 You're not supposed to leak cohort data about a particular individual, but because of the way that this worklet has been designed, and the way that cross-origin worklets have been enabled, this is now possible. 247 00:29:54,340 --> 00:29:58,420 So just a brief summary of some of these attacks that I've gone through. 248 00:29:58,440 --> 00:30:13,700 There are still more I think that you can probably find, but the first is the ability to leak the top-level site of someone who has viewed an ad to bypass certain legacy implementations such as SafeFrame. 249 00:30:13,700 --> 00:30:23,360 The second is de-anonymization with destination hijacking, to understand whether someone has visited a particular website in the past as a complete third party. 250 00:30:23,720 --> 00:30:31,900 And the last is to leak shared storage value that is meant to be completely private, but is now available to insecure worklet code. 251 00:30:34,100 --> 00:30:41,740 So I think I kind of talked a lot about all of these attacks, and I want to step back and look at the bigger picture here. 252 00:30:42,020 --> 00:30:46,360 The first is that privacy-preserving ad tech is hard. 253 00:30:46,360 --> 00:30:47,640 It's really difficult. 254 00:30:47,640 --> 00:30:58,060 I've gone through all the documentations and discussions, and the Privacy Sandbox API team has really put in a lot of effort to design it in a way that is privacy-preserving. 255 00:30:58,120 --> 00:31:03,820 But I will put it to you that privacy-preserving ad tech is an oxymoron. 256 00:31:03,820 --> 00:31:05,360 It's kind of impossible. 257 00:31:05,440 --> 00:31:13,740 And in order to satisfy the needs of both advertising platforms and marketers and obviously ad buyers, something's got to give. 258 00:31:13,740 --> 00:31:26,240 And this emerges in the form of all the escape hatches that are built inside the Privacy Sandbox API, which then allow you to exploit it and subvert the protections of the Privacy Sandbox API. 259 00:31:26,640 --> 00:31:32,300 The second point I want to make is that this attack surface is still large and unexplored. 260 00:31:32,400 --> 00:31:37,680 I think the web has a long history of hardening new features over time and continuously iterating them. 261 00:31:37,680 --> 00:31:44,440 As new standards are put out, bypasses are discovered, and then the standard is then further hardened. 262 00:31:44,440 --> 00:32:03,220 In the case of the Privacy Sandbox API, I think I get the sense that not enough research interest has been put into the Privacy Sandbox API, and a lot of it has now kind of subverted the assumptions of existing protections and mitigations in advertising technology. 263 00:32:03,220 --> 00:32:08,160 So, my encouragement to everyone is look into advertising technology. 264 00:32:08,160 --> 00:32:18,300 It's a large field that I think takes up a large percentage of the internet today, but I think it's going to be a lot more interesting than you think. 265 00:32:21,040 --> 00:32:25,280 So, there's still a lot more to do with regards to the Privacy Sandbox. 266 00:32:25,360 --> 00:32:31,620 For example, the client-side APIs, what I presented today is only a small portion of all the browser-side APIs. 267 00:32:31,700 --> 00:32:45,920 There's a Topics API, a Protected Audience API, Private Aggregation API, and I haven't even kind of dealt with fuzzing any of these APIs, so you may want to look into the actual code that implemented this in the Chrome and Chromium-based projects. 268 00:32:46,240 --> 00:32:48,760 The second is the aggregation service. 269 00:32:48,860 --> 00:33:07,300 There's a whole additional set of infrastructure that the Privacy Sandbox offers that advertising platforms can run in their own environments that is ostensibly meant to be a trusted execution environment that fetches and decrypts information about aggregate analytics data, 270 00:33:07,300 --> 00:33:11,520 but not actually leak that data directly to the advertising platform. 271 00:33:11,520 --> 00:33:13,180 This is a big question mark. 272 00:33:13,180 --> 00:33:19,640 As I've seen with the client-side APIs, there may be escape hatches, there may be issues, so there's a lot to do here. 273 00:33:20,040 --> 00:33:21,680 And the last is enrollment. 274 00:33:21,700 --> 00:33:26,900 So, the Privacy Sandbox API and the Privacy Sandbox is a walled garden. 275 00:33:26,900 --> 00:33:38,040 You have to register as a company or an advertising platform in order to use the attribution API, and this is done through a set of attestations that rely on public keys, for example. 276 00:33:38,540 --> 00:33:49,980 And the question is, if this can be subverted, and you can bypass this enrollment to then manipulate and abuse the Privacy Sandbox APIs. 277 00:33:50,540 --> 00:33:56,580 So, there's a lot more to do and a lot more research to do, so I hope this kind of sparks your interest as well. 278 00:33:58,020 --> 00:34:01,640 So, with that, I think I bring the presentation to an end. 279 00:34:01,640 --> 00:34:18,920 I hope this has given you a kind of brief background on the Privacy Sandbox, given you a bit more interest in advertising technology that tends to be ignored by researchers, and hopefully gives you some ideas of creative ways that you can use to attack and bypass privacy-preserving technology. 280 00:34:18,980 --> 00:34:21,740 If you have more questions, I have a website. 281 00:34:21,860 --> 00:34:24,280 I'm going to post the white paper there. 282 00:34:24,280 --> 00:34:31,320 I also do have a Twitter account, and I also have a book signing tomorrow with Nostalgia Press at 1pm. 283 00:34:31,320 --> 00:34:32,680 So, I hope to see you there. 284 00:34:32,680 --> 00:34:33,480 Thank you.