COOKIEGRAPH: Measuring and Countering First-Party Tracking Cookies

Shaoor Munir, Sandra Deepthy Siby, Umar Iqbal, Steven Englehardt, Zubair Shafiq, Carmela Troncoso · DOI

Abstract

As mainstream browsers phase out third-party cookies, advertisers are pivoting to "ghostwritten" first-party cookies to maintain cross-site surveillance. This paper introduces CookieGraph, a machine-learning framework that uses graph-based behavioral analysis to detect these tracking cookies with 90.18% accuracy. By focusing on data provenance and flow rather than content, CookieGraph effectively identifies tracking behavior while avoiding the website breakage common with traditional blocking methods.

Introduction

The "privacy arms race" has reached a critical juncture. Browsers like Safari and Firefox now block third-party (3P) cookies by default, and Google Chrome is following suit. However, trackers have found a significant loophole: using first-party (1P) cookies—storage set on the domain the user is actually visiting.

The challenge is that 1P cookies are a "double-edged sword." While they are used for tracking, they are also essential for core website features like Single Sign-On (SSO) or shopping carts. Indiscriminate blocking "breaks the internet." Existing tools like CookieBlock rely on cookie names or values, which are easily manipulated by trackers to evade detection. CookieGraph seeks to distinguish between functional and tracking 1P cookies based on their behavioral signatures.

Methodology: Graph-Based Behavioral Analysis

CookieGraph moves away from content-based detection toward provenance and data flow analysis. The system builds a graph of a webpage's execution using an instrumented version of Firefox.

  1. Graph Construction: Nodes represent HTML elements, scripts, network requests, and storage (cookies/localStorage). Edges represent interactions, such as a script reading a cookie or a network request exfiltrating a cookie value to a tracking endpoint.
  2. Feature Extraction: Instead of analyzing strings (e.g., "uid=123"), CookieGraph examines structural features (e.g., how many scripts interact with a cookie) and flow features (e.g., whether a cookie value is sent to multiple different domains).
  3. Machine Learning: A Random Forest classifier is trained on these graph-based features. Because it focuses on the flow of data, it is inherently robust against trackers who rename cookies to look like functional ones (e.g., renaming _ga to session_id).
Figure 1: CookieGraph constructs execution graphs to track the flow of identifiers across different contexts to identify cross-site tracking behavior.

Key Insights and Measurement Study

The authors conducted a massive crawl of 200,000 websites to measure the real-world prevalence of 1P tracking. Several key insights emerged:

  • 3P Blocking is Ineffective: Blocking 3P cookies only reduced the exfiltration of identifiers by about 10%. Trackers simply shifted their identifiers into 1P cookies.
  • The "Ghostwriting" Phenomenon: A staggering 96.61% of 1P tracking cookies are actually set by 3P scripts embedded in the page. Even though the cookie belongs to the site owner's domain, a 3P script (from Google, Facebook, etc.) is the entity controlling the data.
  • Identity Graphs: Trackers use persistent IDs in 1P cookies to link users across devices, combining deterministic identifiers (like hashed emails) with probabilistic fingerprinting.

Results and Performance

CookieGraph achieved 90.18% accuracy, outperforming the previous state-of-the-art (CookieBlock) by over 17%.

Evasion Resistance and Stability

When simulating an adversary who randomly renames cookies, CookieBlock’s accuracy plummeted by nearly 16%, while CookieGraph remained fully robust. Furthermore, CookieGraph caused zero major breakage on tested SSO sites because it accurately identified those specific cookies as functional rather than tracking-oriented.

Prevalence

1P tracking cookies were found on 89.86% of the top-million websites. The most common offenders include Google Analytics, DoubleClick, and other major ad-tech providers.

Figure 2: Prevalence of major tracking domains across the top-million websites, highlighting the dominance of Google and other major ad-tech providers.

Conclusion

CookieGraph demonstrates that behavioral analysis of data flows is a superior method for preserving privacy without sacrificing website functionality. While currently optimized for offline analysis and filter list generation, future work aims to reduce computational overhead for real-time browser integration and to address more sophisticated tracking techniques like link decoration.

Summary updated

BibTeX
@inproceedings{munir2023cookiegraph,
  author = {Shaoor Munir and Sandra Deepthy Siby and Umar Iqbal and Steven Englehardt and Zubair Shafiq and Carmela Troncoso},
  title = {{COOKIEGRAPH: Measuring and Countering First-Party Tracking Cookies}},
  booktitle = {CCS},
  year = {2023},
  doi = {10.1145/3576915.3616586},
}
Figure