DIT is a DTLS MitM proxy implemented in Python 3. It can intercept, manipulate and suppress datagrams between two DTLS endpoints and supports psk-based and certificate-based authentication schemes (RSA + ECC).

Overview

DIT - DTLS Interception Tool

DIT is a MitM proxy tool to intercept DTLS traffic.

It can intercept, manipulate and/or suppress DTLS datagrams between two DTLS endpoints. To achieve this, the machine DIT is running on has to be put in a MitM position with tools like arpspoof. DIT has been built with Python 3.8, utilizes scapy and python-mbedtls to process datagrams and supports a wide variety of cipher suites. It can handle PSK-based and certificate-based (RSA + ECC) authentication schemes and has been built and tested on Debian-based Linux operating systems like Ubuntu or Kali Linux.

DIT has been built to analyze traffic between IoT devices but can intercept any DTLS traffic in a local network. It has been tested and evaluated with OpenSSL and devices from the IKEA TRÅDFRI and Philips Hue series. DIT can print the decrypted datagram payload to stdout or write it into a logfile. The tool can be configured via CLI arguments or via a configuration file (./config/dit_config.yaml).

1. Installation

DIT works with raw sockets and needs to run with root privileges. You can install DIT by simply cloning the repository and installing the dependencies listed in requirements.txt with elevated privileges.

git clone https://github.com/CountablyInfinite/dit
pip3 install -r requirements.txt

2. Getting started

2.1 Verifying the installation

After cloning and installing the dependencies you can run the following command with elevated privileges to see if DIT has been installed successfully:

./dit.py -h
**************************
*   ___    ___   _____   *
*  |   \  |_ _| |_   _|  *
*  | |) |  | |    | |    *
*  |___/  |___|   |_|    *
*                        *
* DTLS INTERCEPTION TOOL *
*                        *
**************************

usage: ./dit.py [optional arguments] start

check configuration stored in ./config/dit_config.yaml before running DIT. 
edit the file or use optional command line arguments to override the default configuration. 
DIT needs root privileges and custom iptable rules to work properly.

run DIT:
  start                 run DIT with the current settings (args override config file settings)

target configuration:
  -isi , --iot_srv_ip   iot server ip address (listening service) to be intercepted (config file: 192.168.183.129)
  -isp , --iot_srv_po   iot server port to be intercepted. (config file: 1337)
  -ici , --iot_cli_ip   iot client ip address to be intercepted. (config file: 192.168.183.128)

interface configuration:
  -eif , --ex_if_name   external interface name (e.g. "eth0") to listen for incoming connections. (config file: ens33)
  -lif , --lh_if_name   local interface name (e.g. "lo") to communicate with local services. (config file: lo)

psk configuration:
  -cid , --cli_id       client identity to configure server and client handler with. (config file: Client_identity)
  -psk , --pre_sh_key   pre-shared key to configure server and client handler with. (config file: DIT_secret)
  --ciphers  [ ...]     list of ciphers to use, separated by spaces. (config file: None)

certificate configuration:
  -cer, --use_cert      [FLAG] use certificates as a method of authentication (instead of a psk). (config file: False)
  -ks , --key_size      length of the RSA/ECC key in bits. (config file: 2048)
  -ecc, --use_ecc       [FLAG] use 521 bit ECC instead of RSA to generate a key pair. disables --key_size. (config file: False)

local services configuration:
  -lci , --lh_cli_ip    local ip address to start a client handler (DTLS server) on. (config file: 127.0.0.1)
  -lcp , --lh_cli_po    local port to start a client handler (DTLS server listener) on. (config file: 1338)
  -lsi , --lh_srv_ip    local ip address to connect a server handler (DTLS client) to. (config file: 127.0.0.1)
  -lsp , --lh_srv_po    local port to connect a server handler (DTLS client) to. (config file: 1339)

miscellaneous:
  -ibl, --icmp_block    [FLAG] automatically create an iptables rule to suppress icmp 'destination unreachable' messages
  -o , --output_file    append intercepted unencrypted messages to an output file
  -v, --verbose         [FLAG] increase verbosity to DEBUG level
  -h, --help            [FLAG] show this help text and exit

examples:
./dit.py -isi 192.168.0.1 -isp 1337 -ici 192.168.0.2 --ciphers TLS-PSK-WITH-AES-128-CCM-8 TLS-PSK-WITH-CHACHA20-POLY1305-SHA256 -psk DIT_secret start
./dit.py --iot_srv_ip 192.168.0.1 --iot_cli_ip 192.168.0.2 --use_cert --key_size 3072 --ciphers TLS-RSA-WITH-AES-128-GCM-SHA256 --verbose start
./dit.py -isi 192.168.0.1 -ici 192.168.0.2 --use_cert -ecc --output_file logfile.log --verbose start

this tool has been created for the purposes of academic research. 
use responsibly and only when explicitly authorized.

2.2 Prerequisite

2.2.1 Elevated privileges

DIT uses raw sockets and therefore needs to run with elevated (root) privileges.

2.2.2 iptables rule

DIT builds four proxy layers with scapy that are communicating between the external interface and the DTLS services running on localhost. To suppress upcoming "Destination unreachable" errors - that cause DIT to halt with an error - a custom iptables rule is necessary. You can generate it with the following command:

iptables -I OUTPUT -d localhost-ip -p icmp --icmp-type destination-unreachable -j DROP

The iptable rules can be set/unset automatically by using the --icmp_block argument when starting DIT.

./dit.py --icmp_block start

2.2.3 MitM position

For DIT to work it has to be run from a MitM position. A MitM position can be achieved in many ways, one of them is by using the tool arpspoof (part of the dsniff tool suite). To gain a MitM position in a local network between the clients 192.168.0.1 and 192.168.0.2 you can use the following command:

arpspoof -i ens33 -t 192.168.0.1 -r 192.168.0.2

2.3 Configuring DIT

DIT can be configured via CLI arguments or via a configuration file (./config/dit_config.yaml). CLI arguments override settings stored in the configuration file. When calling ./dit.py -h - as depicted in section 2.1 - DIT prints out the current configuration that has been read from the configuration file.

2.3.1 ./config/dit_config.yaml

DIT comes with a default configuration you'll need to adapt before running an attack.

cat ./config/dit_config.yaml 
# configure spoofing/sniffing targets
targets:  
  iot_srv_ip: 192.168.183.129
  iot_srv_po: 1337
  iot_cli_ip: 192.168.183.128
  ciphers:
    # if no ciphers are configured, DIT will offer all ciphersuites available with mbedTLS
    #- TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA384
    #- TLS-PSK-WITH-AES-128-CCM-8
    #- TLS-RSA-WITH-AES-128-GCM-SHA256

# configure interface names
interfaces:
  ex_if_name: ens33
  lh_if_name: lo

# configure psk options
psk:
  cli_id: Client_identity
  pre_sh_key: DIT_secret

# configure certificate options
certificate:
  # default is RSA. "use_ecc" arg enables ECC and disables key_size
  use_cert: False
  key_size: 2048
  use_ecc: False

# configure local dtls services
local_services:
  lh_cli_ip: 127.0.0.1
  lh_cli_po: 1338
  lh_srv_ip: 127.0.0.1
  lh_srv_po: 1339

targets:

  • iot_srv_ip: IP address of the dtls server
  • iot_srv_po: Port the dtls server is listening on
  • iot_cli_ip: IP address of the dtls client
  • ciphers: List of cipher suites (using the OpenSSL format) DIT will offer/support when establishing the connections. When no suites are configured DIT offers/supports all cipher suites available with mbedTLS.

interfaces:

  • ex_if_name: Name of the external interface DIT will operate on.
  • lh_if_name: Name of the internal interface DIT will operate on. Local DTLS server and client services will operate on this interface.

psk:

  • cli_id: Client identy to be used when accepting / establishing DTLS connections. (Default key is 'Client_identity')
  • pr_sh_key: PSK to be used when accepting / establishing DTLS connections. (ASCII encoded)

certificate:

  • use_cert: Boolean value. Activates the usage of RSA certificates. DIT automatically creates and uses a corresponding certificate with "key_size" Bits in length.
  • key_size: Length of the RSA key in bits.
  • use_ecc: Boolean value. Activates the usege of ECC certificates. Only works when "use_cert" is set. Deactivates "key_size".

local services:

  • lh_cli_ip: IP address of the localhost interface the dtls client is running on. (typically 127.0.0.1)
  • lh_cli_po: Port the local client instance is accepting traffic on. (needn't be changed in a typical setup)
  • lh_srv_ip: IP address of the localhost interface the dtls server is running on. (typically 127.0.0.1)
  • lh_srv_po: Port the local server instance is accepting traffic on. (needn't be changed in a typical setup)

2.3.2 Command Line Arguments

DIT can be configured via Command Line Arguments. The arguments are listed and described when calling ./dit.py -h - as shown in section 2.1. Command Line Arguments override settings stored in the configuration file and are a fast way to adapt/test settings without changing the config file.

3. Use cases / Evaluation

Refer to https://github.com/CountablyInfinite/dit/tree/master/doc

A Multi-modal Model Chinese Spell Checker Released on ACL2021.

ReaLiSe ReaLiSe is a multi-modal Chinese spell checking model. This the office code for the paper Read, Listen, and See: Leveraging Multimodal Informa

DaDa 106 Dec 29, 2022
Source code for From Stars to Subgraphs

GNNAsKernel Official code for From Stars to Subgraphs: Uplifting Any GNN with Local Structure Awareness Visualizations GNN-AK(+) GNN-AK(+) with Subgra

44 Dec 19, 2022
Lightweight mmm - Lightweight (Bayesian) Media Mix Model

Lightweight (Bayesian) Media Mix Model This is not an official Google product. L

Google 342 Jan 03, 2023
MacroTools provides a library of tools for working with Julia code and expressions.

MacroTools.jl MacroTools provides a library of tools for working with Julia code and expressions. This includes a powerful template-matching system an

FluxML 278 Dec 11, 2022
This is the official implementation for the paper "(Almost) Free Incentivized Exploration from Decentralized Learning Agents" in NeurIPS 2021.

Observe then Incentivize Experiments This is the code used for the paper "(Almost) Free Incentivized Exploration from Decentralized Learning Agents",

Cong Shen Research Group 0 Mar 08, 2022
Additional code for Stable-baselines3 to load and upload models from the Hub.

Hugging Face x Stable-baselines3 A library to load and upload Stable-baselines3 models from the Hub. Installation With pip Examples [Todo: add colab t

Hugging Face 34 Dec 10, 2022
A MNIST-like fashion product database. Benchmark

Fashion-MNIST Table of Contents Why we made Fashion-MNIST Get the Data Usage Benchmark Visualization Contributing Contact Citing Fashion-MNIST License

Zalando Research 10.5k Jan 08, 2023
Submission to Twitter's algorithmic bias bounty challenge

Twitter Ethics Challenge: Pixel Perfect Submission to Twitter's algorithmic bias bounty challenge, by Travis Hoppe (@metasemantic). Abstract We build

Travis Hoppe 4 Aug 19, 2022
Source code for our paper "Do Not Trust Prediction Scores for Membership Inference Attacks"

Do Not Trust Prediction Scores for Membership Inference Attacks Abstract: Membership inference attacks (MIAs) aim to determine whether a specific samp

<a href=[email protected]"> 3 Oct 25, 2022
AI grand challenge 2020 Repo (Speech Recognition Track)

KorBERT를 활용한 한국어 텍스트 기반 위협 상황인지(2020 인공지능 그랜드 챌린지) 본 프로젝트는 ETRI에서 제공된 한국어 korBERT 모델을 활용하여 폭력 기반 한국어 텍스트를 분류하는 다양한 분류 모델들을 제공합니다. 본 개발자들이 참여한 2020 인공지

Young-Seok Choi 23 Jan 25, 2022
The DL Streamer Pipeline Zoo is a catalog of optimized media and media analytics pipelines.

The DL Streamer Pipeline Zoo is a catalog of optimized media and media analytics pipelines. It includes tools for downloading pipelines and their dependencies and tools for measuring their performace

8 Dec 04, 2022
Multi-Scale Aligned Distillation for Low-Resolution Detection (CVPR2021)

MSAD Multi-Scale Aligned Distillation for Low-Resolution Detection Lu Qi*, Jason Kuen*, Jiuxiang Gu, Zhe Lin, Yi Wang, Yukang Chen, Yanwei Li, Jiaya J

DV Lab 115 Dec 23, 2022
Official Implement of CVPR 2021 paper “Cross-Modal Collaborative Representation Learning and a Large-Scale RGBT Benchmark for Crowd Counting”

RGBT Crowd Counting Lingbo Liu, Jiaqi Chen, Hefeng Wu, Guanbin Li, Chenglong Li, Liang Lin. "Cross-Modal Collaborative Representation Learning and a L

37 Dec 08, 2022
A platform to display the carbon neutralization information for researchers, decision-makers, and other participants in the community.

Welcome to Carbon Insight Carbon Insight is a platform aiming to display the carbon neutralization roadmap for researchers, decision-makers, and other

Microsoft 14 Oct 24, 2022
Weakly Supervised 3D Object Detection from Point Cloud with Only Image Level Annotation

SCCKTIM Weakly Supervised 3D Object Detection from Point Cloud with Only Image-Level Annotation Our code will be available soon. The class knowledge t

1 Nov 12, 2021
Code for technical report "An Improved Baseline for Sentence-level Relation Extraction".

RE_improved_baseline Code for technical report "An Improved Baseline for Sentence-level Relation Extraction". Requirements torch = 1.8.1 transformers

Wenxuan Zhou 74 Nov 29, 2022
pq is a jq-like Pickle file viewer

pq PQ is a jq-like viewer/processing tool for pickle files. howto # pq '' file.pkl {'other': 456, 'test': 123} # pq 'table' file.pkl |other|test| | 45

3 Mar 15, 2022
Özlem Taşkın 0 Feb 23, 2022
CTC segmentation python package

CTC segmentation CTC segmentation can be used to find utterances alignments within large audio files. This repository contains the ctc-segmentation py

Ludwig Kürzinger 217 Jan 04, 2023
Baseline inference Algorithm for the STOIC2021 challenge.

STOIC2021 Baseline Algorithm This codebase contains an example submission for the STOIC2021 COVID-19 AI Challenge. As a baseline algorithm, it impleme

Luuk Boulogne 10 Aug 08, 2022