Project Report On Dns Forensics: Submitted in Fulfillment For The Award of
Project Report On Dns Forensics: Submitted in Fulfillment For The Award of
On
DNS FORENSICS
Presented By:
1. INTRODUCTION
1.1. What is DNS Forensics 8
1.2. DNS Query can Reveal 8
1.3. About The Project 9
2. Motivation 10
3. Methodology 11
4. Types of DNS Attacks
4.1. Man In The Middle Attacks 12
4.2. Denial of Service Attack (DoS) 13
4.3. Distributed Denial of Service Attack (DDoS Attack) 14
4.3.1. Types of DDoS Attacks 15
4.4. Cache Poisoning 16
4.5. NX Domain Attack 17
4.6. DNS Tunneling 18
4.7. DNS Amplification 19
4.8. DNS Reflection Attack 20
4.9. DNS Hijacking 21
5. IMPLEMENTATION
5.1. DNS Traffic analysis Using Network Forensics Tool 22
5.2. DNS Message Format 23
5.3. DNS Packet Analysis 24
5.4. Bind Logging Configuration 25
5.4.1. Configuration Of DNS Logs 25
5.5. Advantages Of DNS Logs 26
6. Analysis Using DNS Tools
6.1. PassiveDNS 27
6.2. DNSParse 31
6.3. CaptureDNS 34
6.4. DNStop 36
6.5. Elk Stack 40
7. Conclusion 42
8. Reference 42
List of Figures Page No
Figure 1: Man In The Middle Attack 12
Figure 2: Denial of service Attack (DoS) 13
Figure 3: Distributed Denail of Service Attack(DDos Attack) 14
Figure 4: Cache Poisonin 16
Figure 5: NX Domain Attack 17
Figure 6: DNS Tunneling 18
Figure 7: DNS Amplification 19
Figure 8: DNS Reflection Attack 20
Figure 9: DNS Hijacking 21
Figure 10: Traffic Analysis 22
Figure 11: DNS Message Format 23
Figure 12: DNS Packet Analysis 24
Figure 13: PassiveDNS Log status 29
Figure 14: DNS Logs (Passive) 30
Figure 15: DNS Logs (Parse) 33
Figure 16: DNS Logs (Capture) 35
Figure 17: To View the Queries 37
Figure 18: To View TLD query name 37
Figure 19: The TLD and SLD name 38
Figure 20: Showing most queries asking to records 38
Figure 21: Shows the destination IP Address 39
Figure 22: Show the source IP Address 39
Figure 23: ELK (result output-1) 40
Figure 24: ELK (result output-2) 41
Figure 25: ELK (result output-3) 41
ABSTRACT:-
In Networking Level Forensics, Domain Name Service (DNS) is a
rich source of information. This Project describes a new approach to
DNS data for forensic purposes. We purpose a new technique that
leverages semantic and natural processing tools in order to analyze
large volumes of DNS data.
Domain Name System (DNS) turns Domain names into IP
addresses, which browsers use to load internet pages. Every device
connected to the internet has its own IP address, which is used by
other devices to locate the website. DNS maintains a table where
domain names are mapped with IP addresses. While some
individuals use DNS and domain names for legitimate purposes,
Others are more interested in the shadowy aspects of the Internet,
building DDOS botnets, disseminating viruses and malware, setting
up phishing domains, sending SPAM or just starting any number of
unlawful online services.
As DNS is a core and prevalent component of the internet, it is both
a prime target for attack and a key source of information. The risks
and the benefits are therefore from the distributed/delegated nature
of the system, and its disparate implementations and standards.
This readily allows for local collections of data, and delegated
control, but also local influencing of results and sites.
Many Cyber Security experts/professionals (from both governmental
and commercial agencies) are employed to hunt down the
cybercriminals, examining numerous internet services to obtain data
and trace their movements. But even in the sphere of cyber security,
not all researchers concentrate on digital forensics analysis of DNS
and domain services and all of their data.
In this project we have to explore cyber-criminal activities done by
hackers as well as infection and activity tracking in malware traffic
analysis through DNS logs/records/traffic etc.
1.INTRODUCTION:-
1.1 What is DNS Forensics: -
DNS has an important role in how end users in an enterprise
connect to the internet. Each connection made to a domain by the
client devices is recorded in the DNS logs. Inspecting DNS traffic
between client devices and a local recursive resolver could reveal a
wealth of information for forensic analysis.
Network Forensics is a science that centers on the discovery and
retrieval of information surrounding a cybercrime within a networked
environment. Common forensic activities include the capture,
recording and analysis of events that occurred on a network in order
to establishthe source of cyber-attacks.
Network forensics can be particularly useful in cases of network
leakage, data theft or suspicious network traffic. It focuses
predominantly on the investigation and analysis of traffic in a
network that is suspected to be compromised by cybercriminals.
The DNS logs are important for identifying and even preventing
someof the attacks listed in this project are as follows:-
Working:-
Working:-
Working:-
Working:-
DNS tunneling involves abuse of the underlying DNS protocol.
Instead of using DNS requests and replies to perform legitimate IP
address lookups, malware uses it to implement a command and
control channel with its handler. DNS's flexibility makes it a good
choice for data exfiltration; however, it has its limits.
Working-
Identification Flag
Number of question records Number of answer records
Number of authoritative records Number of additional records
Question Sections(Name type for Field Query)
print-severity yes;
severity info;
};
channel auth_servers_log {
print-time yes;
print-category yes;
print-severity yes;
severity info;
};
channel dnssec_log {
file "/var/named/log/dnssec" versions 3 size 20m;
print-time yes;
print-category yes;
print-severity yes;
severity info;
};
channel zone_transfers_log {
file "/var/named/log/zone_transfers" versions 3 size 20m;
print-time yes;
print-category yes;
print-severity yes;
severity info;
};
channel queries_log {
file "/var/named/log/ queries" versions 3 size 600m;
print-time yes;
print-category yes;
print-severity yes;
severity info;
};
26
6. Analysis Using DNS Tools: -
We have identified following list of tools that can be used to perform DNS
forensics and identify threats on DNS servers:
6.1 PassiveDNS
About: -
A tool to collect DNS records passively to aid Incident handling,
Network Security Monitoring (NSM) and general digital forensics.
Passive DNS sniffs traffic from an interface or reads a Pcap-file and
outputs the DNS-server answers to a log file. Passive DNS can
cache/aggregate duplicate DNS answers in-memory, limiting the amount of
data in the log file without losing the essence in the DNS answer.
With passive DNS data, you can reference past DNS record values to
uncover potential security incidents or discover malicious networks. For
example, when a DNS record changes, the previous value is not saved.
Without passive DNS, it is difficult to identify the prior DNS records for a
malicious site.
27
Installation Process in Centos 8: -
# dnf -y groupinstall "Development tools"
cd passivedns/
#autoreconf –install
# ./configure
# make
# make install
# passivedns –h
Run:-
28
How to use the tool:
Typical usages:
Search for domain or IP history when working on an incident.
Example:Company has malware talking to facebook.com.
At current time, the domain is resolving to say 185.89.218.12 You search
your Flowdata and find the clients talking to that IP and remediate. You
look at the Flowdata, and you discover that the dateand time the clients first
talked to that IP, and concludes that as thetime of infection...
But using Passive DNS data, querying the domain, we get followinghistory:
29
Fig-14 (DNS Logs)
30
6.2 Tool: -DNSParse
About: -
It is another tool for anaylsis DNS traffic, its work on analysis DNS data in
live network as well save DNS data in pacp file format. A pcap file of DNS
data is provided as input by dns parse, which outputs a comprehensive,
easily parsable, human-readable of the same data.It is useful in network
monitoring from it (send the data to Kibana ,graylags or similar).
There is most common carrying protocols are supported, as well as packet
de duplication.
// Download zip file of dns_parse from open source site and install
# wgethttps://github.com/pflarr/dns_parse/archive/refs/heads/master.zip
# gitclonehttps://github.com/pflarr/dns_parse/archive/refs/heads/master.zip
# unzip master.zip
cd dns_parse-master
# make
# make install
31
# dns_parse |more
// To see the traffic for particular dns server:-
# tcpdump -i enp0s3(Interface name) -s 65535(Total Ports) –w fname(
file name) host (dns server ip addr.)
32
Output:-
33
6.3 CaptureDNS:-
About:-
A simple tool to capture and show DNS queries. It saves DNS data in pcap
file as human readable format. It also used in Real-time analysis DNS traffic
network, it shows the domain name and its ip address, also useful in DNS
monitoring.
34
Output:-
35
6.4 DNStop:-
About:-
• Source IP addresses
• Destination IP addresses
• Query types
• Response codes
• Top level domains
• Second level domains
• Third level domains
Both IPv4 and IPv6 addresses are supported by dnstop.
Dnstop offers a variety of filters to aid in the discovery of particularly
unwanted DNS requests. Only the queries listed below will be shown by
dnstop, according to the filters:
Installing using: - Apt-get Install Dnstop
36
While running dnstop, hit 1 key to view first level query names (TLDs):
37
You can easily find out showing most query asking to
records (A,AAAA, PTR) by hinting t key: -
38
Hit s to view DNS source IP address:
You have to save a file with something like tcpdump, and then dnstop will
read it. DNSTOP cannot save files itself.
tcpdump -w dump.pcap -c
1000 port 53then you can
read that file like this dnstop -l
3 dump.pcap
39
6.5 ELK STACK
ELK is a combination of Elasticsearch, logstash and kibana.
40
Fig-24 (ELK RESULT OUTPUT-2)
41
7. Conclusion:-
8. Reference:-
DNSparse - https://github.com/robertdavidgraham/dnsparse
CaptureDNS - https://github.com/lilydjwg/capture-dns
PassiveDNS - https://github.com/gamelinux/passivedns
DNSTop - https://github.com/verisign/dnstop/blob/master/dnstop.c
DNS Amplification- -
https://github.com/rodarima/lsi/blob/master/p2/dnsdrdos.c
42