Now we have Alex and Konark with anonymous rate limiting with direct anonymous attestation. Thank you and welcome everybody to our talk. My name is Konark and this is Alex and we both work for a company called Clix based out of Munich, Germany. For those of you who have not heard about Clix, we are basically a privacy friendly search engine which can be accessed through our browser and through our Firefox add-on. And apart from being a search engine, we also package the browser and an add-on with various privacy features like anti-tracking, ad-blocking. And we're also the parent company for GhostRaid. Today we're going to talk about a system that we developed and use at Clix, which basically helps us prevent attacks on our data collection system. Although the examples that we will take here will be based on the events that we receive in our data streams, but we believe the system is generic enough that we're not going to use it as a means to other users. So we're going to talk about a system that wherever rate limiting applies, this system can be used. Before Alex will talk about the system in detail, I would just like to explain why at first place we needed to build an anonymous rate limiting system and how it has evolved since 2016. Now, it's important to understand that data is important to build services. And Clicks is no exception. To power our search engine, anti-tracking, anti-phishing, data is of the most importance. And yes, it might sound a bit controversial talking about data collection at a privacy village, but it's important to understand that when you talk about data and privacy, how that data is being collected is of the uttermost importance. If you look at this table here, this is what most of the data streams in the industry will look like. Most of the data collection happens with an identifier that is sent back home with the events. The identifier could be a long-term identifier, an explicit identifier like a cookie, which you see on the extreme right. Or it could be based on, it could be an implicit identifier based on multiple parameters like IP and the user agent. The whole, the whole notion of sending back identifier is so that use cases like analytics could be solved on the back end. So, for example, based on this data stream, we can easily solve the question, how many unique visitors visited Facebook.com in a given hour, right? But also, because of the presence of the identifier, you can link multiple events on the back end. Which means not only can you solve the use cases, but you can also solve the use case of finding out unique visits on Facebook. You can also see that the same user also visited booking.com, Twitter dashboard, and maybe because of some capability URLs, you can potentially de-anonymize the user itself, right? So, when we started to design our data collection streams, we wanted to ensure that any data point that can link multiple messages on the back end needs to be dropped on the client side itself. What that means is, in our data streams, there is no way you can link multiple messages on the back end. So, when we started to think about how to link multiple messages together, that could be implicitly or explicitly, and in order for us to even prevent ourselves from linking messages based on network fingerprinting, we also want to route the data through a set of proxies. So, that means the data collection streams are clean and cannot be linked with multiple events. That said, we still can solve the use cases that the, that is needed, that is needed to collect identifiers for, but for this purpose, for this talk, we will not dig deeper into how we do it. If you want to know how to do that, go to more details we can talk offline or you can read this paper and our approach how we do data collection anonymously and yet solve the use cases. Coming back to the motivation of doing this talk. Now the problem is all the data collection systems suffer from the same problem that attacker can spam you with multiple messages which are fake. Which are not actually happening on the user's machine. Right? And we are no exception. But because so if you take let's take an example here. So for example one of the most important data points for us is query logs. What that means is what is the query that user did and what result did the user select from our search results. Right? And this query log powers how we rank our search engine and how we promote the content because that detects what's the popularity of a query and landing page. Right? Now an attacker knowing that we do not have a lot of identifiers in our data streams can spam us with multiple messages. Right? And once the spammer starts to send us multiple messages it could be used for altering or promoting their own content at a different rank or maybe disrupt our services by promoting a bad result for a good query. Right? To give you a more concrete example just based on these two messages these are two sample query logs. Query booking, the landing page booking dot com. Query booking, the landing page booking holidays dot com. And you can see that this query log is based on the message content. We cannot detect whether it's a fabricated data or a genuine data. Right? And because unlike other search engines we do not track users there is no way we can know what is the source of the message and what is the history of the source itself to use it for server side rate limiting or for server side rate limiting solutions. Right? And this is a big, big concern for us because now at one point we are doing anonymous data collection but because it's anonymous we are not able to track users. Right? And this is a big, big concern for us because now at one point we are doing anonymous data collection but because it's anonymous it can negatively impact our services itself. Right? So one solution could be let's stop anonymous data collection and let's start tracking users. But that is not what we want to do. So we want to build a service wherein we can detect without de-anonymizing the user whether it's the same user sending us multiple messages or these are different users. You can think about this as a voting system where a trusted user can vote but can only vote once for a given period. Right? Now think about this problem as the user needs to vote for popularity of a query but can only vote once in a given time frame. In the context of this query log we only want to receive one query per user, one normalized query per user in one hour. Right? And if you talk about the general implementation of the system based on the message type and the content of the message we want to rate limit the users, rate limit per user per time frame. Right? And that's kind of important for us. And that's why the problem that we try to solve is without knowing the user how do we enforce these rate limiting users or these rate limiting rules. Right? So in 2016 we pushed a version to production which we call anonymous rate limiting version one. And the idea was because we are already using proxies to transport data we can actually empower the proxies without learning the content of message but still perform de-duplication for us. But what that meant was these proxies needed to run custom software which perform these de-duplication tasks. Now this protocol was based on blind signatures and other standard crypto primitives. But yet for this solution to work we needed multiple trusted third party providers to run proxies for us. The reason we needed multiple third party proxy providers first was because they need to run the custom application and second we did not want that the users could collide with the proxies or the proxies could collide among themselves or clicks in clicks itself could collude among the proxies. Right? But what happened was we tried finding these multiple third party vendors to run proxies for us and sadly in about two years we could not find any. Right? What that meant was clicks had to run their own proxies which kind of defeated the whole purpose. And because these proxies had to run a custom software to perform de-duplication we cannot rely on the off shelf solutions like tor or other um. Trusted vendors. So based on these challenges that we faced in the first version uh earlier this year we started testing a new version which we call HPN uh which we call anonymous rate limiting version two and which Alex will explain in detail. So uh as Konrad said I'll uh talk about our new anonymous rate limiting uh system which is based on the right anonymous attestation. Uh he already made a statement about the benefits but just as a quick review uh this system has several benefits over the previous one. Uh the first one is is that now we don't need uh we we remove the need for trusted third parties. Uh second there are less interactions between the client and the server because in the previous system we required uh one blind signature per message so the client had to first get message blind sign then actually uh send a message. So there was a lot of problems with that. So there was two interactions. And the third one is now that we can we can use uh known solutions for network anonymity like tor which in the previous system was a bit more complicated because of this custom third party proxies. So what is actually direct anonymous attestation? Direct anonymous anonymous attestation is a cryptographic primitive which is implemented in processors that follow the trusted platform module standard as well as other chips which follow the Intel enhanced privacy of the system. So this is actually a very specific application. But rather than focusing on the hardware that runs this uh cryptographic uh protocol we would rather like to focus on the cryptographic primitive itself. So uh for our purposes uh direct anonymous attestation has two key features. First it allows for anonymous authentication. Uh this means that you can prove that a trusted platform is signing a message but not which concrete platform is doing so. So in order to do that you have to have a specific device. In other words uh the signatures can prove membership of the device in a group but not which concrete device is signing the message. Uh the second feature that uh is important for us is the controlled linkability. So given sorry for this controlled linkability a device signs a message with respect to a base name string. Uh in a way that two signatures from the same member are linkable if and only if they are done in a group. So this means that the device is signed with respect to the same base name string. So for example if a device always signs a message with the same base name then all the signatures will be linkable. So we will be able to link all his messages together. Uh on the other extreme if a device would randomize this base name and sign every message with respect to a different base name then all the all the messages will be completely unlinkable. So we'll see later that we can use this linkability properties to uh achieve our rate limiting uh needs. But before that uh we have to talk about the main four operations about uh that are involved in direct anonymous attestation because we'll need to refer to them later. Uh the first one is called join. And this is where a device gets credentials from an issuer. Typically a device is a client and the issuer is a server. And we can see this as the device gets credentials from an issuer. So the linkability properties are fulfilled using the device becoming a member of the issuer group. Then once this device obtains credentials it can sign messages with respect to this base name string in a way that uh the linkability properties are uh fulfilled the linkability properties that we talked in the previous light are fulfilled. So then the verify operation essentially means that you can check whether a signature is valid for the given message um base name. And finally the link operation is which is especially important for us, is it allows to check whether two signatures have been known by the same member and the same base name. Now since this signature linkability is essential for our purposes, we actually need this link algorithm to be efficient. So let's take a look at how this linkability looks in practice. To achieve this linkability, signatures contain a pseudonym which can be seen as a linkability tag and this pseudonym is computed as a one-way function of the base name and the user private key. Of course the user private key is unknown to the server so it is known both to the issuer and the verifier. The way this pseudonym works is like if you see two pseudonyms, two equal pseudonyms, then it means for sure that the corresponding signatures were done by the same member and with respect to the same user. So if you see two pseudonyms, two equal pseudonyms. So this means that the link algorithm is efficient because the server just needs to store all the previously seen pseudonyms and then whenever a new message comes, just extract its pseudonyms and see if it has already been seen before. Now that we have explained how direct anonymous attestation works, let's see how to use it actually in practice to achieve the relimiting algorithm. So let's take a look at how direct anonymous attestation works. So let's see how direct anonymous attestation works. So if you see a line on this page we want to show the then the verifier which is a server will drop messages either if this base name has computed incorrectly according to the rules or if the pseudonym is repeated. So this would be the structure to achieve our rate limiting purposes. So it looks like a couple of four components. The first one is a message type which can be used to have different rules for different kinds of messages. The second one is a time period which is actually a time stamp truncated to an hour or a day depending on the need. The third one is a message digest which is an arbitrary function on the message and is used to introduce some message content into these rules. And the last is a count which is an integer between 1 and N and is meant, can be seen as a multiplier. So if you have a message and you want to use it as a multiplier you can give it a fixed message type, time period message dash and you can send up to N messages. So we found this base name structure to be expressive enough for our needs but it doesn't mean that this is the only possible structure to do this kind of rate limiting. Now revisiting the previous example that Konarch showed, the query logs. We could have a message that would look like this. First the search query, in this case booking, the landing URL and the time stamp. And we can see the results of our query logs. We can see the result of our query logs and we can see the would like, we could like to enforce the following rule. We only want one message per user per hour per normalized search query to be accepted by the server. To achieve this rule and following the previous base name structure, the base name would look like this. First we will have the message type which is constant in this case, query log type. Second one would be truncated time stamp to the hour. So instead of 656, just 6. The third one normalized query. The last one just 1 because in this case that's the only option. So essentially the strategy is to not let the user choose more than one base name for a normalized search query and for a given hour. Another example that we want to show you is this. This is an example of the message type. So the first thing that we might want to enforce is let's say we have a different kind of message which we only want to accept three messages per user per day. So for this kind of message which we could call three daily type, the base names would look like this. First the message type, then the date and then the message digest which in this case would be empty because the rule is independent of the message content. And then account which in this case could be chosen between 1 and 3. So a client at the start of the day would like to send a message then it would see that it can choose out of three base names and it would choose one at random. It would mark this base name as used and then in the next message that it would want to send it would pick from the two remaining base names etc. And essentially when it runs out of base names there is no way that the message quota is exceeded and there is no way that the user can send an additional message without being detected at the server side. Now if TPM was available like in all the devices, 100% of the devices, we could basically end the talk here and say okay, we leverage on the TPM because it runs this direct anonymous attestation protocol and if the TPM is not available physically in the device we showed how to use it to rate limit. But in practice this is not the case. First TPM is not available in all the devices, like it might be available in this laptop but in general it's not. And then even if it's available for example in our execution environment we want to run this rate limiting service in the client which is a browser extension. So even if the TPM might be available physically in the device we might not be able to access it. So at the end it's not realistic to assume that the TPM is available. So what we did is we implemented the direct anonymous attestation protocol but without the TPM. So software only. Now this opens the possibility for a new problem. Which is basically, okay, in the system we showed we protect against a single user from sending too many messages, right? So we kind of. Okay. For a given user this user has only a limited set of votes, let's say, to contribute in the system. But if we remove then the TPM then it could be quite easy for an attacker to create many identities and then obtain credentials for all of them and then essentially bypass the whole system. So note that this would not happen with a TPM because if we wouldn't force a TPM then an attacker would need to actually get hold of many TPMs. So this is a little bit more complicated. So let's talk about the TPMs devices which is not so easy. So at the end if we cannot limit the number of credentials given to attackers then the whole system will be useless. Now this has a name. It's called civil attacks and we actually need to prevent them. So the good thing is that we can pretty much focus on one operation of the system which is the join operations. This is the operation where the clients get credentials and the good thing is that it does not need to be anonymous. So this is because according to the protocol properties there is no way to link this join to any other of the user interactions with the server. So essentially the join is decoupled from all the other interactions. So since the joins do not need to be anonymized then we can leverage a standard techniques but just on this join operation. For example, a simple one would be just to rate limit on the user IP. We believe that will already put some protection. Then depending on the use case of this rate limiting system we might have e-mail user accounts, paid user accounts, subscriptions, so we might be able to use these for the join operations to give the credentials. Now as an extra measure we also rotate the issuer part. So here we have an additional public keys. This means that every time the issuer public keys are rotated all the credentials that the issuer has given are invalidated. So the clients need to join again. This is to avoid an attacker to potentially accumulating many credentials over time and using them with any extra effort. So at the end as a summary of this part we believe there are ways to mitigate these civil attacks and that the rate limiting is useful even without TPMs. Okay. So as a summary for the key parts of our system, first we rate limit joins using all available information that we have, user IP, email if it's available, etc. Then rotate issuer keys periodically and last use the direct anonymous attestation link ability for doing the actual rate limiting on the messages. Now we have to mention some possible de-anonymization attacks that we might be able to do. So the first one is the user ID. So this would be pretty much the same as the user ID but this would contain like a user ID. So this would pretty much be the same as the user ID. The first attack would be trying to make each user join a group where they are alone. So essentially each user would join a group which is unique for them. And then essentially this would, each signature, if this was the case, would contain like a user ID. So this would pretty much be the same as the user ID. So basically this would pretty much make it very easy for us to build user sessions. This is quite easy to detect because the user fetched the issuer public keys periodically and then the issuer would, sorry, the user would detect that the issuer is changing this issuer public keys when it should not and then basically could decide to ban the issuer and not send any message anymore or to report it or depending on the system. The second one is a very simple attack is a little bit more tricky and we call it denial of join is that the issuer has the power of deciding who gives, who it gives credentials to. So in the, in an extreme case the issuer could only give credentials to a single user and then since this, since only this user would be able to send messages it would be trivial to track this user, right? So this is a bit more tricky to detect from the client side because the clients would need to cooperate with each other in order to know that a single part of the population is not receiving credentials and then react upon it but in practice this is not so easy to implement. But in our concrete use case since we have the incentive of keep receiving data to run our services, we have more incentive on receiving data than on trying to track users. And since to track users we have to drop messages proportionally to the granularity that we want to track. So it's not reasonable for us to try to do this attack. Okay. So we thought it would be a good idea to compare our system with similar systems that are used in production. One is called the way this works is basically a user solves a token, sorry, a user solves a CAPTCHA and then receives end tokens that can redeem later to avoid solving more CAPTCHAs, right? So these tokens skip the CAPTCHA, the CAPTCHA puzzle. And these tokens can be redeemed anonymously. So we couldn't use this, even though we could use this in some specific use cases of our system, we cannot use it as a general solution for our needs. Because the main reason is that these tokens can be redeemed at any point of time in the future and we cannot frame it to relimit at specific time periods as we require. Then the second one is called Anonyze and is implemented in Brave browser. It essentially consists in the server being able to set up anonymous surveys for a subset of users in a way that allows us to do the same thing as only one user can vote once per, sorry, in a way that users can only vote once per survey. As far as I know, this is used for payments to decide the popularity of websites. We couldn't find a way to use it directly to achieve our needs because, again, because our trade limiting rules needed a little bit more of complexity. Like, you need it to be a little bit more complex. You need to have a lot of time to do it. It needed a time period. It needed for some measures to, like the query logs, to include part of the content to do the remit. So we couldn't find a way of using this. But still, the systems are similar to our, in some way. So for the implementation part, we implemented a paving based cryptographic protocol which is used, which is like a, you know, a paving based cryptography. It's defined in a FIDO, elliptic curve, direct anonymous attestation. And since it uses paving based cryptography, it's not so easy to find, or at least the choices for libraries are a bit reduced. Eventually we decided to use a library called Apache Milagro Crypto Library, which is in C. So we implemented the protocol in C using this library. And since our client runs in a web browser, we compiled it to WebAssembly and built, we built a web assembly. So we wrote bindings to JavaScript for that. And then for the server side, we used the same C implementation but wrote native bindings for NodeJS as our server. Now the benchmarks, especially the most important operation is the server verify because these actually influences how many messages per second can the server process. So right now it's four milliseconds. So this means we can process 250 messages per second per CPU core. Even though this is not blazingly fast, we believe that it's fast enough to be used in practice, to be used in production. So this system, like not the whole system is open source yet. Like the server side is not open source. But the cryptographic code is open source. So this is a very, very, very, very, very, very fast implementation of the direct normalization, it is, as well as the client part in this repository. So thanks for listening.