Skip to content
ZK
ZAIN KHALIL KHAN
PORTFOLIO
All projects

Interactive build

DNS Sentinel | Tunnelling & DGA Detection

DNS telemetry analyser that scores queries on label entropy, label length, NXDOMAIN response rate, and per-zone query volume to separate domain-generation algorithms and DNS tunnelling from ordinary resolution, with tunable thresholds.

Live demo readyDNS Security + Exfiltration
DNS SecurityExfiltrationEntropy AnalysisThreat DetectionNetwork SecurityAnomaly DetectionCase study / interactive demo

Case study

From problem to working system

Problem

DNS telemetry analyser that scores queries on label entropy, label length, NXDOMAIN response rate, and per-zone query volume to separate domain-generation algorithms and DNS tunnelling from ordinary resolution, with tunable thresholds.

My role

Security engineer and full-stack developer

Solution

DNS telemetry analyser that scores queries on label entropy, label length, NXDOMAIN response rate, and per-zone query volume to separate domain-generation algorithms and DNS tunnelling from ordinary resolution, with tunable thresholds.

Architecture

The implementation combines the following technologies and system concerns.

DNS SecurityExfiltrationEntropy AnalysisThreat DetectionNetwork SecurityAnomaly Detection

How it was built

  • Computed Shannon entropy per character over the leftmost label, which is the signal that separates generated domains from human-registered ones.
  • Detected data encoded into query names by label length and base64 alphabet conformance, the mechanics of DNS tunnelling.
  • Used NXDOMAIN rate as a DGA indicator, since an algorithm cycling candidate domains fails to resolve most of them.
  • Separated tunnelling from beaconing by per-zone query volume, because the same entropy signal means different things at 6 queries and at 1,800.

Security decisions

No project-specific security control is documented in the current project record. The case study avoids claiming controls that were not verified.

Major challenges

  • Computed Shannon entropy per character over the leftmost label, which is the signal that separates generated domains from human-registered ones.
  • Detected data encoded into query names by label length and base64 alphabet conformance, the mechanics of DNS tunnelling.
  • Used NXDOMAIN rate as a DGA indicator, since an algorithm cycling candidate domains fails to resolve most of them.

Verified evidence

Results and measurable impact

  • Computed Shannon entropy per character over the leftmost label, which is the signal that separates generated domains from human-registered ones.

Screenshots and access

Product view

Interactive Demo

A scoped, fully functional recreation of this project's core feature runs below, live in your browser. Reset it, resize it, or expand it to full screen.

DNS Sentinel

Security platform

DNS SentinelWorkspace5 updates
DNS Sentinel · Exfiltration & DGAshare of queries crossing the alert threshold
5 flagged

DNS is the channel that is almost never blocked, which makes it the channel of choice for beaconing and exfiltration. Each query is scored on per-character entropy of the leftmost label, label length, NXDOMAIN rate, and query volume to one zone, then thresholds are tuned to trade recall against alert volume.

Queries scored

9

Flagged

5

suspicious or malicious

False positives

0

benign traffic flagged

Missed

0

malicious not flagged

Label entropy per query, highest firstthreshold 3.4 bits/char

Clean separation at this tuning: every malicious query is flagged and no benign query is.

Query scoring9 scored
aGVsbG8gd29ybGQgZXhmaWx0cmF0aW9u.tunnel.example.commalicioustunnel100
4.33 bits/char · 32 chars · 1840 queries

entropy 4.33 bits/char over the 3.4 threshold

leftmost label is 32 characters, consistent with encoded payload

1840 queries to one zone, consistent with tunnelling rather than lookup

label matches base64 alphabet end to end

d3d3LmV4YW1wbGUuY29tL3NlY3JldA.tunnel.example.commalicioustunnel100
4.19 bits/char · 30 chars · 1620 queries

entropy 4.19 bits/char over the 3.4 threshold

leftmost label is 30 characters, consistent with encoded payload

1620 queries to one zone, consistent with tunnelling rather than lookup

label matches base64 alphabet end to end

kq3v9z7yfhdm2p1x.infomaliciousdga60
4.00 bits/char · 16 chars · 6 queries

entropy 4.00 bits/char over the 3.4 threshold

NXDOMAIN response, typical of a DGA cycling unregistered candidates

x7bqm2wzlp4knt8r.bizmaliciousdga60
4.00 bits/char · 16 chars · 4 queries

entropy 4.00 bits/char over the 3.4 threshold

NXDOMAIN response, typical of a DGA cycling unregistered candidates

zzq1p8mnvbxkw2ld.topmaliciousdga60
3.88 bits/char · 16 chars · 3 queries

entropy 3.88 bits/char over the 3.4 threshold

NXDOMAIN response, typical of a DGA cycling unregistered candidates

cdn.jsdelivr.netbenignbenign0
1.58 bits/char · 3 chars · 412 queries

No signal crossed a threshold at this tuning.

login.microsoftonline.combenignbenign0
2.32 bits/char · 5 chars · 980 queries

No signal crossed a threshold at this tuning.

api.github.combenignbenign0
1.58 bits/char · 3 chars · 233 queries

No signal crossed a threshold at this tuning.

telemetry.internal.corpbenignbenign0
2.42 bits/char · 9 chars · 88 queries

No signal crossed a threshold at this tuning.

Zain Khalil Khan