Insecurity through Censorship: Vulnerabilities Caused by The Great Firewall

Shubham Shah (Co-founder and CTO · Assetnote), Michael Gianarakis (Co-founder and CEO · Assetnote)

BSides Canberra VII (2024) · Day 2 · Main Track

Overview

In a compelling presentation at BSides Canberra, Shubham Shah and Michael Gianarakis, co-founders of Assetnote, unveiled a pervasive and significant security vulnerability stemming directly from China's Great Firewall. Titled "Insecurity through Censorship: Vulnerabilities Caused by The Great Firewall," their talk detailed how the Chinese government's internet censorship infrastructure actively poisons DNS responses for millions of domains, creating a fertile ground for client-side attacks. This phenomenon, which they discovered and meticulously researched, exposes a critical flaw where state-level censorship inadvertently leads to widespread insecurity.

Watch on YouTube

Visual summary for Insecurity through Censorship: Vulnerabilities Caused by The Great Firewall by Shubham Shah, Michael Gianarakis
Visual summary for Insecurity through Censorship: Vulnerabilities Caused by The Great Firewall by Shubham Shah, Michael Gianarakis

Key moments

  1. 0:00 Introduction: DNS poisoning by Great Firewall
  2. 2:00 Discovery of widespread DNS poisoning issue
  3. 4:45 Keywords triggering poisoning; Cloudflare vulnerability
  4. 9:50 Exploiting Fastly CDN for arbitrary content demo
  5. 11:55 CPanel XSS exploitation on poisoned domains
  6. 15:30 The 'Why': Censorship objectives and sinkhole IPs
  7. 22:00 Hosting in China: ICP license and mitigation challenges
  8. 32:50 Q&A: Does DNS over HTTPS mitigate poisoning?

Insecurity through Censorship: Vulnerabilities Caused by The Great Firewall

Speakers: Shubham Shah (Co-founder and CTO, Assetnote), Michael Gianarakis (Co-founder and CEO, Assetnote)

Conference: BSides Canberra

YouTube: https://www.youtube.com/watch?v=Jb8KKozDhYQ

Overview

In a compelling presentation at BSides Canberra, Shubham Shah and Michael Gianarakis, co-founders of Assetnote, unveiled a pervasive and significant security vulnerability stemming directly from China's Great Firewall. Titled "Insecurity through Censorship: Vulnerabilities Caused by The Great Firewall," their talk detailed how the Chinese government's internet censorship infrastructure actively poisons DNS responses for millions of domains, creating a fertile ground for client-side attacks. This phenomenon, which they discovered and meticulously researched, exposes a critical flaw where state-level censorship inadvertently leads to widespread insecurity.

The core of the issue lies in the Great Firewall's manipulation of authoritative DNS responses for domains whose name servers are hosted within China. When DNS queries for certain keywords (often related to proxies, VPNs, or adult content) pass through this infrastructure, the legitimate IP address is replaced with a "sinkhole" IP from a vast and diverse pool of active, external networks. Shah and Gianarakis demonstrated how this redirection can be exploited by attackers to serve arbitrary content, conduct phishing campaigns, or execute cross-site scripting (XSS) attacks on unsuspecting users, effectively hijacking portions of legitimate domains.

This research not only uncovers a novel attack surface impacting an estimated 30 million .CN domains and many more globally, but it also prompts a crucial discussion about the unintended security consequences of censorship. While the primary objective of the Great Firewall is control, its implementation has created a systemic vulnerability that puts Chinese citizens and international businesses operating in China at significant risk. The speakers highlighted the challenging dilemma faced by organizations forced to balance business imperatives in a large market with the severe security implications of operating within China's digital borders.

Background

▶ Watch: Introduction: DNS poisoning by Great Firewall (0:00)

To understand the intricacies of the DNS poisoning discovered by Assetnote, it's essential to first grasp the fundamental mechanics of the Domain Name System (DNS). In a simplified view, DNS resolution involves four main types of servers: Root Name Servers, which provide addresses for Top-Level Domain (TLD) servers; TLD Name Servers, which direct queries to authoritative name servers for specific domains; Authoritative Name Servers, which hold the definitive DNS records for a domain; and Recursive DNS Resolvers, which client computers query to navigate this hierarchy and obtain IP addresses. The critical point of compromise identified in this research lies at the authoritative name server level.

The discovery of this pervasive DNS poisoning began in 2021 when Assetnote, an attack surface management company that performs hundreds of millions of DNS resolutions daily, started observing highly unusual and inconsistent DNS results for domains with the .CN suffix. Initially, the team suspected issues like unreliable DNS resolution, inconsistent load balancing, or resolver problems. However, as the anomalous behavior persisted and began to appear on domains without the .CN suffix, pointing to seemingly random IP addresses, it became clear that a more sophisticated and nefarious mechanism was at play. This led them to investigate the responses from authoritative name servers directly.

Through systematic debugging, Shah and Gianarakis determined that the poisoning was occurring at the source of truth for DNS records. They found that specific keywords embedded within a subdomain or query were consistently triggering these manipulated responses. For instance, a query containing webproxy.id would reliably yield poisoned results, whereas a similar query without the keyword would resolve normally. This "greedy" filtering mechanism was so broad that it even affected entirely non-existent domains if the triggering keyword was present. This indicated a pattern-matching or regex-like filtering system, rather than a targeted block of specific legitimate domains. Crucially, this issue was not isolated to a single DNS provider; it affected major services like Alibaba DNS and even Cloudflare, as long as their authoritative name servers were hosted within China. The researchers collaborated with another independent researcher, Eric, who had identified a similar issue and shared a list of keywords, confirming the widespread nature of the problem.

Key Findings

▶ Watch: Keywords triggering poisoning; Cloudflare vulnerability (4:45)

The research by Shubham Shah and Michael Gianarakis brought to light several critical findings that underscore the widespread impact and unique nature of this DNS poisoning:

  1. Systemic DNS Poisoning for China-Hosted Name Servers: The most significant finding is that any domain utilizing an authoritative name server hosted within China is susceptible to DNS poisoning. This is not limited to .CN domains but extends to any domain, regardless of its TLD, whose DNS resolution infrastructure is physically located inside China's internet boundaries.
  2. Vast Scale of Affected Domains: The impact is enormous, with approximately 30 million domains within the .CN country code Top-Level Domain (cCTLD) alone being vulnerable. Given that name servers can be hosted in China for non-.CN domains, the total number of affected domains is likely even higher.
  3. Keyword-Triggered Manipulation: The DNS poisoning is not random but is specifically triggered by a large and evolving list of keywords. These keywords often relate to content typically censored by the Great Firewall, such as proxies, VPNs, and certain adult or political terms. The filtering mechanism is "greedy," meaning it can trigger even for non-existent domains if a keyword is present in the query.
  4. Redirection to Diverse, Active Sinkhole IPs: Instead of blocking resolution or redirecting to a non-functional IP address, the poisoned DNS responses consistently point to a diverse range of active IP addresses globally. This extensive list includes large Content Delivery Networks (CDNs) like Fastly, major cloud platforms, social media networks (e.g., Twitter, Meta), and various other hosting providers. This diversity is a crucial element that enables the exploitation scenarios demonstrated by Assetnote.
  5. Censorship as the Primary Driver: While the exact internal workings of the Great Firewall remain a "black box," the overwhelming evidence, particularly the nature of the triggering keywords, strongly suggests that the DNS poisoning is an unintended consequence of China's extensive internet censorship efforts. The mechanism appears designed to broadly block access to undesirable content, but its implementation creates exploitable vulnerabilities.
  6. Unintended Security Risks for Users and Businesses: The primary victims of this insecurity are users accessing these domains, particularly Chinese citizens and companies operating within China. However, non-Chinese entities and users in regions like Southeast Asia, who often rely on Chinese-hosted name servers (e.g., through Alibaba Cloud), are also adversely affected, expanding the global reach of the problem.

These findings collectively reveal a complex interplay between state-level censorship, internet infrastructure, and cybersecurity, leading to widespread and difficult-to-mitigate vulnerabilities.

Technical Deep Dive

▶ Watch: CPanel XSS exploitation on poisoned domains (11:55)

The technical heart of this discovery lies in the Great Firewall's DNS poisoning mechanism, which specifically targets authoritative name servers located within China. When a DNS query for a domain (e.g., example.cn) is made, and its authoritative name server resides in China, the query passes through the Great Firewall. If this query, or more specifically, the requested subdomain, contains certain "blacklisted" keywords, the Great Firewall intervenes. Instead of forwarding the query to the legitimate authoritative server or returning the correct IP address, it injects a falsified DNS response.

This falsified response, as observed by Assetnote, does not simply return a non-existent or blocked IP. Instead, it directs the client to an IP address from a vast and diverse pool of sinkhole IPs. The speakers confirmed that this pool includes hundreds of networks, ranging from major Content Delivery Networks (CDNs) like Fastly, cloud providers, and even IP ranges belonging to social media giants like Twitter and Meta, as well as various other hosting providers. The diversity and active nature of these sinkhole IPs are critical to the subsequent exploitation. The researchers noted that the filtering mechanism appears to be "greedy," akin to a broad regular expression, as it triggers the poisoning even for non-existent subdomains containing the keywords. This suggests an intent to broadly block any mention of censored terms, rather than targeting specific malicious domains.

The list of keywords triggering this poisoning is extensive and includes terms often associated with circumvention tools or forbidden content, such as webproxy.id. The speakers highlighted that this list is likely dynamic and could be continuously updated by the Chinese authorities. The exact algorithm for selecting the sinkhole IP from the vast pool remains unclear; it appears somewhat random, though the speakers theorized it might favor organizations that own large blocks of IP space. This randomness, combined with the fact that these sinkhole IPs are for active, legitimate services, creates the window of opportunity for attackers.

A key observation was that this poisoning occurs regardless of the recursive DNS resolver used by the client. Whether a user queries their ISP's resolver, Google DNS, or even Cloudflare's 1.1.1.1, if the authoritative name server for the target domain is in China and the query contains a triggering keyword, the poisoned response will be returned. This underscores that the interception and manipulation occur at a network layer deeper than the recursive resolver, likely at the Great Firewall itself, which acts as a transparent proxy or interceptor for all DNS traffic entering and exiting China. The inability to obtain SSL certificates for these randomly assigned, rotating poisoned subdomains is a significant technical limitation for attackers, as it prevents the capture of Secure flagged cookies.

Demo / Proof of Concept

▶ Watch: The 'Why': Censorship objectives and sinkhole IPs (15:30)

Shubham Shah and Michael Gianarakis presented two compelling proof-of-concept (PoC) exploits that leverage this DNS poisoning to demonstrate practical client-side attacks. The fundamental concept behind both PoCs is the abuse of sinkhole IPs – the active, legitimate IP addresses that poisoned DNS queries resolve to.

PoC 1: Fastly CDN Infrastructure Takeover

The first demonstration focused on exploiting domains that are poisoned to resolve to a Fastly CDN IP address. Fastly, like many CDNs, returns a specific error message (e.g., "This domain is not registered") if a request is made to one of its IPs for a domain that isn't configured within its service. The attack vector leverages this behavior:

  1. Attacker Setup: The attacker registers a Fastly service and adds their victim domain (e.g., domain.cn) to their Fastly configuration. They then configure this service to serve arbitrary content (e.g., a malicious script, a phishing page) from their own server. For simplicity, TLS to the host was disabled in the demo.
  2. Client-Side Trigger: To trigger the poisoning, the attacker crafts a JavaScript payload. This payload generates a large number (e.g., 1000) of random subdomains, each incorporating one of the known DNS poisoning keywords (e.g., webproxy-randomstring.domain.cn).
  3. DNS Resolution and Exploitation: These random subdomains are then progressively loaded within <img> tags on an attacker-controlled webpage. When a user's browser attempts to resolve these image URLs, the DNS queries for subdomains containing the keyword will be poisoned by the Great Firewall. Some of these poisoned queries will resolve to a Fastly IP address. Because the attacker has pre-registered the victim domain (or a subdomain thereof) with their Fastly service, the Fastly CDN will then serve the attacker's arbitrary content to the victim's browser, appearing to originate from the legitimate domain.cn.
  4. Capabilities: This allows for arbitrary content loading, enabling highly convincing phishing pages, brand defacement, or the injection of malicious JavaScript. Critically, if the target domain's cookies are not marked with the Secure flag (meaning they can be transmitted over HTTP), the attacker's server-side code on Fastly can capture HTTP-only cookies, potentially leading to account takeover.

PoC 2: CPanel Reflected XSS Exploitation

The second PoC demonstrated exploiting a known vulnerability in CPanel, a widely used web hosting control panel, when a poisoned domain resolves to a CPanel-running IP. Assetnote's security research team had previously discovered a reflected XSS vulnerability in CPanel in 2023.

  1. Vulnerability Identification: The researchers identified that some of the sinkhole IP addresses were actively running CPanel instances vulnerable to a reflected XSS.
  2. Client-Side Trigger: Similar to the Fastly exploit, the attacker creates a JavaScript payload that generates a thousand random subdomains with a specific prefix containing a poisoning keyword.
  3. DNS Resolution and Exploitation: When the victim's browser attempts to resolve these subdomains (e.g., by loading them in <img> tags), some of the poisoned queries will resolve to an IP address hosting a vulnerable CPanel instance. If the XSS payload is crafted correctly to target this CPanel instance, the XSS will fire within the context of the victim's legitimate domain (e.g., domain.cn).
  4. Capabilities: This allows for client-side XSS attacks. While HttpOnly cookies are generally protected from client-side JavaScript, if a sensitive cookie lacks the HttpOnly flag, this XSS could still lead to account takeover. The speakers emphasized the extreme scale of this vulnerability, affecting potentially millions of domains.

Limitations of Exploitation

The speakers candidly discussed the limitations of these exploitation techniques:

  • Secure Flag Restriction: Neither technique can capture cookies marked with the Secure flag. This is because the poisoned subdomains resolve to different, often random, IP addresses each time, making it impractical for an attacker to obtain a valid SSL certificate for a poisoned subdomain. This prevents the establishment of an HTTPS connection necessary to transmit Secure cookies.
  • HttpOnly Flag (CPanel): The CPanel XSS exploit, being purely client-side, cannot access cookies marked with the HttpOnly flag.
  • HttpOnly Flag (Fastly): The Fastly exploit, however, can potentially log HttpOnly cookies if they are not also marked with the Secure flag, as the attacker's server-side code running on Fastly would receive them over HTTP.

Despite these limitations, the presented PoCs highlight a significant new attack surface, particularly for phishing, brand defacement, and account takeover if proper cookie security hygiene is not maintained. The sheer number of affected domains suggests that many more attack vectors exploiting the diverse sinkhole IP landscape are likely yet to be discovered.

Defensive Implications

▶ Watch: Q&A: Does DNS over HTTPS mitigate poisoning? (32:50)

The DNS poisoning caused by the Great Firewall presents a unique and challenging security problem, largely due to its origin in state-level infrastructure and regulatory requirements. Defenders face a complex balancing act between business objectives and security imperatives.

The most direct and effective mitigation is to host authoritative name servers outside of China. As the research confirmed, once a domain's authoritative name server is located outside the Great Firewall's reach, the DNS poisoning behavior ceases, and clients receive legitimate DNS responses. However, this is often not a practical or even permissible solution for many organizations. Chinese regulations, particularly the requirement for an Internet Content Provider (ICP) license, mandate that any entity wishing to host an internet presence in China must use a domain registered with a Chinese registrar, a server located inside China, and a hosting provider licensed by the Chinese government. This effectively forces companies, including major international players like Cloudflare, to host critical infrastructure like name servers within China, making them susceptible to the poisoning. Furthermore, hosting name servers outside China for Chinese web properties can lead to significant speed and reliability issues, degrading user experience for customers within China, which is a major business concern.

Given these constraints, organizations must focus on robust web security hygiene to mitigate the impact of potential exploitation:

  1. Enforce the Secure Flag on Cookies: All sensitive cookies should be marked with the Secure flag. This ensures that cookies are only transmitted over HTTPS connections. Since attackers cannot easily obtain SSL certificates for the dynamically assigned poisoned subdomains, this flag prevents the capture of sensitive cookies even if arbitrary content is served over HTTP.
  2. Enforce the HttpOnly Flag on Cookies: For cookies that do not need to be accessed by client-side JavaScript, the HttpOnly flag should be used. This prevents JavaScript-based attacks, such as the CPanel XSS demonstrated, from accessing and stealing these cookies. While the Fastly exploit could still capture HttpOnly cookies if they lack the Secure flag, combining both Secure and HttpOnly offers the strongest protection.

Even with these hygiene measures, the risks of brand defacement and phishing remain. An attacker can still serve arbitrary content or a convincing phishing page from a poisoned subdomain of an official company domain, potentially damaging reputation and tricking users.

Ultimately, the speakers emphasized that given the difficulty of outright mitigation due to geopolitical and regulatory realities, raising awareness is a crucial defensive step. Educating security teams, business leaders, and even customers about this unique attack vector can help organizations better understand their risk profile and implement the best possible safeguards within their operational constraints. The issue underscores that security vulnerabilities can arise not just from technical flaws but also from the intersection of technology with state policy and censorship.

Key Takeaways

  • Widespread DNS Poisoning: China's Great Firewall actively poisons DNS responses for domains whose authoritative name servers are hosted within China, affecting an estimated 30 million .CN domains and many others globally.
  • Keyword-Triggered Manipulation: This poisoning is triggered by specific keywords (e.g., webproxy.id) related to censored content, leading to a "greedy" filtering mechanism that redirects even non-existent domains.
  • Exploitable Sinkhole IPs: Poisoned DNS queries resolve to a diverse range of active, legitimate IP addresses (sinkholes) across CDNs (Fastly), cloud platforms, and social media networks, creating a unique attack surface.
  • Practical Client-Side Attacks: Attackers can exploit this by registering services on CDN infrastructure (e.g., Fastly) to serve arbitrary malicious content or by leveraging known vulnerabilities (e.g., CPanel XSS) on sinkholed IPs, leading to phishing, brand defacement, and potential account takeover.
  • Challenging Mitigation: Due to strict Chinese ICP licensing requirements, moving name servers out of China (the most effective mitigation) is often impractical for businesses operating there, forcing a reliance on other defensive strategies.
  • Crucial Web Security Hygiene: Implementing robust web security practices, specifically enforcing Secure and HttpOnly flags on all sensitive cookies, is critical to limit the impact and prevent cookie theft from these DNS poisoning attacks.

About the Speaker(s)

Shubham Shah is the Co-founder and Chief Technology Officer (CTO) of Assetnote, an attack surface management company. His work at Assetnote involves deep technical research into discovering novel vulnerabilities and understanding complex internet infrastructure, which directly led to the discovery and analysis of the Great Firewall's DNS poisoning.

Michael Gianarakis is the Co-founder and Chief Executive Officer (CEO) of Assetnote. His expertise in leading the company's strategic direction and understanding the broader implications of security vulnerabilities complements Shah's technical insights. Together, they bring a comprehensive perspective on how such widespread issues impact businesses and global internet security. Their company's focus on attack surface management provided the ideal context for uncovering this pervasive and subtle form of DNS manipulation.

Reviews

  • Dr. Zero (Offensive Security Researcher) — MUST SEE ★★★★★
  • Heather Calloway (CISO) — MUST SEE ★★★★★

→ Top-rated talks at BSides Canberra VII (2024)

All talks from BSides Canberra VII (2024)