This project explores timing-based correlation attacks on a local Tor network using simulated traffic. The goal is to evaluate how timing patterns can be used to deanonymize users under different traffic behaviors.
This repository was created as a final project for an university course to explore low-level traffic correlation vulnerabilities in Tor. It demonstrates how even without content, timing alone can reveal links between clients and servers. This includes:
- Setting up a local Tor network with Chutney including two clients, several relays and a hidden tor service running on a server
- Simulating client-server communication using various traffic types (regular, burst, parallel, random)
- Capturing these conversations as
.pcapfiles at client and server - Analyzing and comparing traffic via normalized cross-correlation
- Visualizing attack effectiveness across traffic types
- Interpreting results and drawing a conclusion
To generate the .pcap files used in this analysis:
- Set up a local Tor network using Chutney
- Run the included traffic generation scripts for different traffic patterns
- Capture traffic on the client and server interfaces
- Store the resulting
.pcapfiles under folders liketor_regular/,tor_burst/, etc.
or: - Download provided sampless
For full setup details and instructions, see
TRAFFIC_GEN.md
run:
python3 analyze_scripts/analyze_correlation_metrics.pyThis script:
- Loads
.pcapfiles from specified folders ( in client/server pairs) - Extracts timestamps using tshark
- Computes normalized cross-correlation and max lag
- Saves results to results/<traffic_type>_correlation_results.csv
run:
python analyze_scripts/plot_correlation_results.pyThis script:
- Loads all previously generated
.csvresults - Plots correlation scores by traffic type
tor-timing-correlation/
├── data/ # Sample .pcap files
├── results/ # Output plots and correlation scores
├── analyze_scripts/ # Python scripts for traffic analysis & plotting
├── traffic_scripts/ # Python scripts to create the traffic and instructions
├── requirements.txt # Python dependencies
├── README.md # You're here
└── ANALYSIS.md # Results and interpretationInstall with:
pip install -r requirements.txtYou must have tshark installed (the command-line version of Wireshark), as it's used to extract packet timestamps from .pcap files.
- On Linux:
sudo apt install tshark- On macOS (via Homebrew):
brew install wiresharkYou may also need to run:
sudo dpkg-reconfigure wireshark-common
sudo usermod -aG wireshark $USERThen restart your session to capture without sudo.
If you want to generate your own data tcpdump is needed to capture the traffic
This project is for educational and ethical research only. All experiments were conducted in a fully contained virtual environment and did not interact with the live Tor network.
MIT License — see LICENSE for details.