CensorLab

A Testbed for Censorship Experimentation

Jade Sheffey§ Amir Houmansadr§

§ University of Massachusetts Amherst

CensorLab lets circumvention developers test their tools against the censor strategies of the past, present, and future. By proactively censoring their own protocols, developers can build stronger threat models and harden their tools before a real censor finds the weakness.

What you can emulate

Layered filtering

Packets flow through Ethernet, ARP, IPv4/IPv6, ICMP, TCP and UDP layers, each with its own allow and block lists. IP lists take CIDR subnets.

Programmable censors

Write per-connection logic in Python, or in CensorLang, a small DSL that is type- and bounds-checked when it loads.

ML classifiers

Load ONNX models and call them from your censor to emulate data-driven traffic classification that no censor has deployed yet.

Protocol-aware

Strict parsers for DNS, TLS ClientHellos reassembled across segments and records, and decrypted QUIC Initials (v1 and v2).

Real censor actions

Drop, inject TCP RSTs, forge DNS responses, delay, rewrite TTLs, or buffer IPv4 fragments the way TSPU middleboxes do.

Three deployment modes

Intercept live traffic with netfilter queues, run inline as a transparent bridge between two interfaces, or replay a PCAP offline.

A censor in a few lines

demos/http_blocking/http.py resets HTTP connections that mention .org

def process(packet):
    tcp = packet.tcp
    if tcp and 80 in [tcp.src, tcp.dst]:
        if b".org" in packet.payload:
            return "reset"

Run it in Docker, no toolchain required

git clone https://github.com/SPIN-UMass/censorlab.git
cd censorlab && git submodule update --init
bash docker/censorlab.sh -c demos/http_blocking/censor.toml nfq

Teaching censorship circumvention? Try our example homework assignment.

Abstract

Censorship and censorship circumvention are closely connected, and each is constantly making decisions in reaction to the other. When censors deploy a new Internet censorship technique, the anti-censorship community scrambles to find and develop circumvention strategies against the censor's new strategy, i.e., by targeting and exploiting specific vulnerabilities in the new censorship mechanism. We believe that over-reliance on such a reactive approach to circumvention has given the censors the upper hand in the censorship arms race, becoming a key reason for the inefficacy of in-the-wild circumvention systems. Therefore, we argue for a proactive approach to censorship research: the anti-censorship community should be able to proactively develop circumvention mechanisms against hypothetical or futuristic censorship strategies.

To facilitate proactive censorship research, we design and implement CensorLab, a generic platform for emulating Internet censorship scenarios. CensorLab aims to complement currently reactive circumvention research by efficiently emulating past, present, and hypothetical censorship strategies in realistic network environments. Specifically, CensorLab aims to (1) support all censorship mechanisms previously or currently deployed by real-world censors; (2) support the emulation of hypothetical (not-yet-deployed) censorship strategies including advanced data-driven censorship mechanisms (e.g., ML-based traffic classifiers); (3) provide an easy-to-use platform for researchers and practitioners enabling them to perform extensive experimentation; and (4) operate efficiently with minimal overhead. We have implemented CensorLab as a fully functional, flexible, and high-performance platform, and showcase how it can be used to emulate a wide range of censorship scenarios, from traditional IP blocking and keyword filtering to hypothetical ML-based censorship mechanisms.

Citation

@misc{sheffey2024censorlab,
  title         = {CensorLab: A Testbed for Censorship Experimentation},
  author        = {Sheffey, Jade and Houmansadr, Amir},
  year          = {2024},
  eprint        = {2412.16349},
  archivePrefix = {arXiv},
  url           = {https://arxiv.org/abs/2412.16349}
}