Research Assistant - LUMS

Mar 2019 - Aug 2021


As a Research Assistant at LUMS, I worked with Dr. Ihsan Qazi and Dr. Zartash Uzmi to create Advention; a tool capable of serving geographically and linguistically relevant ads to the user when Tor is employed as a censorship circumvention tool.

The project consisted of three major parts; increasing the number of geographically and liguistically relevant ads shown to the user, exploring techniques to reduce latency and page load time on tor, and combining these techniques to create Advention.

Improving Ad relevance

I observed that while ad servers use a lot of different variables to serve personalized ads the user, the most important of them is the user's location. I also leveraged the fact that an ad in user's language is more likely to be clicked by the user than an ad which is in a language that user does not understand. So the first step in improving ad relevance is to pick Tor circuits that exit from the user's own country. However, this greatly limits the number of available exit nodes, and in many cases reduces them to zero. To circumvent this problem, I augmented the Tor exit locations with countries that share the user's language.

This solution works well for languages that are spoken in multiple countries, like English, Spanish and French, but may fail for languages that are spoken in only one country or only in countries that do not have an available Tor exit node. Therefore, I augmented the relay list with nodes from countries that have English as the official language as a fallback option. The reason for choosing English as a fallback option is that the Tor exit relay distribution is skewed towards the US and it ensures that there would be an exit node available for the user.

Reducing Page Load Time

I studied the prior work done to reduce latency on Tor to develop a solution to pick low latency Tor circuits. LasTor, for instance, minimizes the geographical distance between the user's location and the destination location. However, it fails to take into account the bandwidth available on Tor relays. The work only explores round trip times but does not measure actual page loads. In my own experimentation, I found LasTor to perform worse than Tor, hence, a different solution was needed.

To solve the latency problem, I borrowed the idea from Mitzenmacher's paper, Power of Two Choices in Randomized Load Balancing. By creating d Tor circuits and picking the one with the lowest round trip time, I managed to reduce the average page load time by up to 70%.


We see a maximum improvement in page load time with d=3 and get diminishing returns beyond that.

Creating Advention

Advention combines the two ideas and further improves on them by selectively whitelisting ad domains using Proxy Auto-Config (PAC) files. By doing this, we allow the browser to fetch the page through Tor, circumventing censorship, while serving ads from the direct, unproxied path. The benefits are two fold; firstly, the ads are from user's region and in user's language, which improves the ad click through rate. Secondly, since the ads are not being fetched over Tor, the Tor circuit has to transmit less data, resulting in further improvement in page load time.


With Advention, we see a median 2.5x reduction in page load time over Tor.

Ads, Tor and GDPR

If the user ends up exiting from a GDPR compliant region, the websites tend to behave in one of the following ways

  • Add a small consent notice banner at the bottom of the page.
  • Display a blocking popup asking for consent which blocks page load until the consent notice is accepted.

In these cases, many websites do not load ads until the consent notice is accepted. Some may not even load the website content until the notice is accepted. To circumvent this problem, Advention launches the browser session with the I don't care about cookies extension which automatically accepts these notices. The extension is used by nearly a million people, which indicates that a lot of people do not actually care about these consent notices.

Back to Experience