wiki:doc/CAPTCHAMonitor

Cloudflare CAPTCHA Monitoring

The Cloudflare CAPTCHA Monitoring project aims to track how often Cloudflare fronted webpages return CAPTCHAs to Tor clients. The project aims to achieve this by fetching webpages via both Tor and other mainstream web browsers and comparing the results. The tests are repeated periodically to find the patterns over time. Collected metadata, metrics, and results are analyzed and displayed on a dashboard to understand how Cloudflare manipulates internet traffic and affects people's access to the internet.

Code

The codebase is in development right now, and it is currently located in this GitHub repository.

Documentation

You also find the documentation in this Read the Docs page.

Dataset

The data collected so far can be found in this dashboard. The data is not in a downloadable format right now, but the link will be added here once it is available.

Detailed description

By design, Cloudflare is developed to alter the traffic between the web servers and internet users. Cloudflare modifies the internet traffic to protect the Cloudflare fronted web servers from various attacks from users with malicious intentions. Even though this seems like a practice with good faith on the surface to protect servers, it harms millions of users more than doing good. Cloudflare makes decisions to block or not to block users based on multiple factors such as visitor's IP address, resources requested, request payload and frequency, and customer-defined firewall rules (1). They don't share the specifics of their decision-making mechanism since it keeps changing over time, and it is not open-source. However, this doesn't stop us from experimenting with the algorithm and understanding how it decides to block/not block users.

Cloudflare mentions that ​IP address​ based rules have the highest hierarchy, and it is followed by Firewall Rules​, ​Zone(URL) Lockdown,​ ​User Agent Blocking​, and ​Web Application Firewall (2). Thus, Cloudflare clearly states in their documentation that they do consider the user's ​IP addresses​ and their web browser's ​User Agent​ while deciding to block a user. Unfortunately, Cloudflare algorithms trigger all red flags when these two parameters (IP address and user agent) are matching to a typical Tor user. This is an easy thing to do for Cloudflare because Tor Browser uses the one fingerprint for all philosophy, and the list of Tor exit nodes is publicly available. The Cloudflare CTO himself, explains that they fetch the list of Tor exit nodes and assign a reputation to the nodes here in trac ​ticket:18361#comment:23​ to block certain users.

Currently, there are a few research projects (like ​Khattak et al.​ and Singh et al.​) on the Tor user blocking practices, but there is no public tool and/or database collecting data regularly on Cloudflare's Tor user blocking practices, to the best of my knowledge. Thus, this project aims to develop tools to monitor this issue and create a database for public usage. Eventually, once there is enough data accumulated, this tool is aimed to function as a data source for the Tor Metrics project. It was also observed that a lot of users struggle with reliably reproducing the Cloudflare behavior to report in their tickets since there are too many variables involving the process. Thus, this project can be used as a standardized toolset to reproduce Cloudflare's behavior since many of the variables are controlled within the project. The collected data might serve as a reference point to the measurements done by the individual users.

Expected long-term impact

  • Creating an up to date and reliable data source for further research on the topic
  • Integrating the collected data to ​Tor Metrics
  • Reducing and relaxing the Cloudflare's CAPTCHA policies
  • Helping Tor users browse the internet without sacrificing privacy and getting discriminated

Approach

  1. Having Cloudflare fronted websites (captcha.wtf and exit11.online) to simulate various configurations that can be done by the Cloudflare users
  2. Periodically fetching these websites via Tor and other mainstream web browsers that are not using Tor
  3. Recording if a CAPTCHA is returned during the website fetches and other additional predefined metrics
  4. Visualizing the results in a dashboard (dashboard.captcha.wtf) and analyzing the collected data
  5. Tracking and making the dataset & the results publicly available

Here is a diagram that explains the approach in detail:

https://trac.torproject.org/projects/tor/raw-attachment/wiki/doc/CAPTCHAMonitor/CAPTCHA_Monitoring_Project_Diagram.png

Metrics to track

Here are some of the questions that the project will try to answer by tracking related metrics to these questions. Some of these questions are trying to find answers to the questions asked and issues reported by the community.

  1. Does Cloudflare treat IPv4 and IPv6 addresses differently? 33010#comment:2
  2. How does the HTTP request headers affect Cloudflare's decision-making mechanism? 33010#comment:4
    1. Is there a difference between using the actual Tor Browser itself and tor-browser-selenium​ in terms of the HTTP headers?
    2. How does Cloudflare react differently if the browser doesn't support alt-svc headers? 32915
  3. How do different browsers with different User Agents get affected? 33010#comment:2, 32924, 31404
    1. Is there a difference between using a web browser or fetching web pages via cURL or other HTTP libraries?
    2. What about different versions of the Tor Browser? Does Cloudflare behave differently to different versions of the same browser?
    3. How does Cloudflare react to browsers with and without JavaScript enabled? 31404
  4. What kind of per browser session tracking and blocking is actually happening? 18361
  5. How does having pre-existing cookies for other websites affect Cloudflare's behavior? 18361#comment:7, 23840#comment:26
  6. How do different security levels of Cloudflare (3) affect the blocking mechanism? 33010#comment:5
    1. Do some of the Cloudflare security levels block users immediately without presenting a CAPTCHA challenge at all?
  7. How does the time of the day affect the Cloudflare's blocking mechanism? Does it matter the day of the week or the time of the day? 33010#comment:15
  8. How often does Cloudflare's blocking mechanism change/update itself?
  9. How do specific exit nodes get affected by Cloudflare's blocking practices?
    1. Does the size/age/location of the exit node play a role? 33010#comment:15
    2. Is it always the same Tor exit nodes that get blocked?
  10. How well does Cloudflare keep track of the new or old Tor exit nodes?
    1. How frequently Cloudflare updates its Tor exit node list?
  11. What fraction of the Tor exit nodes get affected by Cloudflare's blocking practices? 33010, 23840#comment:22
  12. What is the chance of a Tor client getting affected by Cloudflare's blocking practices when choosing a Tor exit node? 33010
  13. Is there a difference between websites that load resources from third-party resources and websites that contain all resources on the origin server? 33010#comment:6
    1. How do users of websites get affected if the main website is not fronted by Cloudflare, but some of the resources are fetched from a Cloudflare fronted web server? 33010#comment:6, 15450
  14. Is there a difference if the origin server has an SSL certificate or not?
    1. Does the blocking change if the SSL certificate is issued by Cloudflare or by another entity?
  15. If browsers that should not face CAPTCHA face CAPTCHA, why does this happen?
  16. How do the observed patterns in the results change over time? 33010
  17. Is whether you get a CAPTCHA much more probabilistic and transient? 33010

Related trac tickets

The original ticket initiated this project can be found here: #33010

  • #18361 - Issues with corporate censorship and mass surveillance
  • #23840 - Google's reCAPTCHA fails 100%
  • #24351 - Block Global Active Adversary Cloudflare; The Great Cloudwall?
  • #31404 - Unsolvable reCAPTCHAs
  • #32915 - Cloudflare alt-svc failures cause spurious "DNS resolution error" in Tor Browser

Roadmap

  • [X] Create Cloudflare fronted websites
    • [X] IPv4 and IPv6 only domains (as suggested by ticket:33010#comment:2)
    • captcha.wtf -> IPv4 only
    • exit11.online -> IPv6 only
  • [X] Build a simple website fetcher to collect data
    • [X] Check for the existance of the "Cloudflare" string in the returned website (as suggested by ticket:33010#comment:25)
  • [X] Create a simple dashboard for displaying collected data
  • [ ] Make the dataset downloadable
  • [ ] Have a working minimum viable product
  • [ ] Integrate Tor Stem
  • [ ] Integrate more web browsers and their older versions
  • [ ] Integrate Cloudflare API not to change Cloudflare settings (of the websites) manually
  • [ ] Optimize the data storage format
  • [ ] Write tests
  • [ ] Enhance the available visualizations on the dashboard
  • [ ] Submit a report the Tor Research Safety Board
  • [ ] Brainstorm the integration with OONI people
  • [ ] Brainstorm the integration with Tor Metrics people
  • [ ] Create an API for people to fetch data easily
  • [ ] Create an API for running the system on the user-provided websites

Tasks

Results (1 - 10 of 11)

1 2
Ticket Summary Component Status Owner Priority Severity Created Modified Reviewer Reporter
#34294 Integrate ​Tor Stem Metrics/Ideas new metrics-team High Normal 5 days ago 5 days ago woswos
#34287 Make the dataset accessible and downloadable Metrics/Ideas new metrics-team Medium Normal 5 days ago 5 days ago woswos
#34288 Integrate more web browsers/fetchers and their older versions Metrics/Ideas new metrics-team Medium Normal 5 days ago 5 days ago woswos
#34289 Integrate Cloudflare API not to change Cloudflare settings manually Metrics/Ideas new metrics-team Medium Normal 5 days ago 5 days ago woswos
#34295 Develop a module for parsing and modifying the HTTP headers Metrics/Ideas new metrics-team Medium Normal 5 days ago 5 days ago woswos
#34296 Develop a mechanism for disabling/enabling cookie, JavaScript, etc. functionality of the web browsers Metrics/Ideas new metrics-team Medium Normal 5 days ago 5 days ago woswos
#34290 Enhance the available visualizations on the dashboard Metrics/Ideas new metrics-team Low Normal 5 days ago 5 days ago woswos
#34297 Explore different options other than crontab to have a flexible scheduling system Metrics/Ideas new metrics-team Low Normal 5 days ago 5 days ago woswos
#34291 Create an API for enabling 3rd party interactions with the system Metrics/Ideas new metrics-team Very Low Normal 5 days ago 5 days ago woswos
#34292 Create an API for people to fetch data easily Metrics/Ideas new metrics-team Very Low Normal 5 days ago 5 days ago woswos
1 2

Development

GeKo & arma are the mentors of this project, and currently, I'm (woswos) the only developer of this project. I develop this project as a part of the Google Summer of Code program.

Contact

If you have any questions, concerns, feedback, etc. you can reach me on the #tor-dev or #tor-project channels on IRC. My IRC handle is woswos, and if you need help with connecting to IRC, you can follow this tutorial.

You can also email me at <barkin(at)nyu(dot)edu>

Contributing and Reporting Bugs

I use the trac tickets to keep track of the issues and the project. You can use ticket #33010 and its child tickets to follow the development and share your contributions and bugs. You will need to use the project's GitHub repository for code contributions.

References

(1) https://web.archive.org/web/20200328165212/https://support.cloudflare.com/hc/en-us/articles/205177068-How-does-Cloudflare-work-
(2) https://web.archive.org/web/20200328143759/https://support.cloudflare.com/hc/en-us/articles/115002059131-Understanding-your-site-protection-options.
(3) https://web.archive.org/web/20200328183738/https://support.cloudflare.com/hc/en-us/articles/200170056-Understanding-the-Cloudflare-Security-Level

Last modified 2 days ago Last modified on May 25, 2020, 2:26:48 PM

Attachments (1)

Download all attachments as: .zip