• Stars
    star
    98
  • Rank 343,620 (Top 7 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 4 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Sending messages by hacking the DNS protocol. See website for demo server usage instructions

DoNotSend - hacking the DNS protocol

Works on Windows and Linux

The DNS protocol is conventionally used to ask for the IP address of a given website. Here it's used to send messages and retrieve other messages, instead of asking for a website IP address and retrieving its IP address.

Disclaimer

This tool can be used to send messages by exploiting a flaw in the DNS protocol, but it could be used (as someone pointed out in the reddit thread) to exfiltrate data from a network. I'm not responsible for any misuse of the project. Also note that it's most likely that your ISP is logging your DNS queries, thus it's not a 100% anonymous.

Setup

  • Python >= 3.7
  • Scapy >= 2.4
    • if it isn't installed alongside scapy:
      • libpcap
  • venv
    • Sometimes the wheel module is needed as well
apt install python3-venv
python3 -m venv venv/
source venv/bin/activate

pip3 install scapy
# if it fails because it couldn't build the wheel:
pip3 uninstall scapy && pip3 install wheel && pip3 install scapy

cd src
# nota: run as admin because it's binding on + sniffing port 53:
python3 server.py "interface" "host name"
# or you can start it with a configuration file:
python3 server.py config.ini
# if it complains about libpcap not installed, then:
apt install libpcap0.8-dev

client

We can include arbitrary data in the hostname which the server then can interpret and execute/relay. Thus we put our data in the qname section of the query, encoded using base32, without the padding (we can easily recalculate it).

The queries sent are TXT DNS queries, otherwise (because we answer with TXT DNS replies) the replies will get lost/deleted when transmitted by peers (yes you read correctly, Google can ask the DNS if it knows crafted-domain.my_dns.domain.example.com).

python3 client.py [my_dns.domain.example.com] "message here"

If no message is given, hello world is sent.

You can also use the client.sh version, relying only on dig, base32 and base64, instead of using scapy.

server

It receives queries and read the wanted "fake" hostname, decode the data put in the hostname as base32.

Then it replies through a DNS TXT reply, where the data is encoded as base64 without padding.

Running the server

cd src
# needs to run as root because it is binding port 53
python3 server.py [interface, for example eth0 on linux] [my_dns.domain.example.com]

Having other big DNS relay your queries and answers

In a few steps I was able to configure my NS provider to set myself up as my own DNS, to get to reply to the weird domains I need to communicate.

For this examples, let's say my server is named example.com.

  1. I added a A entry for dns.example.com, pointing to my server ip here
  2. In the DNS servers configuration, I already had ns1.provider.com, I added myself as a DNS server: dns.example.com, pointing to my server ip here
  3. Then, just wait a bit (can be as long as 48 hours) and you're good to go

Now I just have to tell my client scripts to use the domain dns.example.com to send messages to it and it works like a charm, even when asking Google about it!

Documentation

Code structure

More Repositories

1

TierListMaker

A client side tier list maker, without any ads
JavaScript
44
star
2

pataro

A generic and modular Roguelike game on top of libtcod - I'll be back soon, just need a break!
C++
25
star
3

project-E

A minimalistic Operating System relying on a basic bootloader and a small kernel capable of loading a given application
Assembly
11
star
4

Unamed-Endive

A special (French only) Pokรฉmon like game
C++
11
star
5

MyReadingList

A lightweight reading list handler
JavaScript
10
star
6

elranet

A Docker control (web) panel to manage containers easily
JavaScript
9
star
7

SmallGameLibrary

A small C++ game library relying on the SFML 2.5 -- going private
C++
8
star
8

OnlyCheese

The OnlyCheese official website
Vue
7
star
9

LoadingAnim

A simple C++ 14 class to display nice and beautiful loading animation in your SFML >= 2.4 game
C++
4
star
10

FlSub

Subsonic & Ampache Android client using Material 3
Dart
4
star
11

Kafe

Mirror for the Kafe project
C++
3
star
12

template_blog

A blog template using PHP, JS, and possibly MySQL. CSS already included. Take care to change the .htpasswd and .htaccess
PHP
3
star
13

new-cpp-project

CMake
2
star
14

yall

Yet Another Lisp Like
Scala
2
star
15

sh

A simple shell handling multiples environments at once
Python
2
star
16

discord-bot-template

A discordjs bot template
JavaScript
2
star
17

HashCode

Recurring utilities for the Google HashCode
Python
1
star
18

wsgi_test

Python
1
star
19

Pygame3D

Python
1
star
20

PyNetScripts

A collection of Python scripts to play with the network
Python
1
star
21

smoll-vm

just a smoll vm in c++14
C++
1
star
22

GUACAMOLE

Official repository for the map converter of Unamed - Endive (using tiled as a map editor, version 1.0.2)
Python
1
star
23

pygameDemo

Python
1
star
24

AdventOfCode2021

Nim
1
star
25

is-build-action

Composite action to build an InnoSetup Script (on a Windows job only)
Inno Setup
1
star
26

SuperFola

A special repository shown on my profile
Python
1
star
27

Bunker

Python
1
star
28

Hork

Reimplementation of Zork
HTML
1
star
29

UrWorld-Alpha-3.x

Repository for UrWorld Alpha 3.x
Python
1
star
30

Pygame-architecture-test

Python
1
star
31

lang-documentation

A template language documentation website based on a fake language
HTML
1
star
32

mcpanel

A live Minecraft webpanel
HTML
1
star
33

moins-de-neuf

C++
1
star
34

elasticsearch-scripts

Scripts to import/export data from/to the elasticsearch database of the IRHT (CNRS)
Python
1
star