SlideShare una empresa de Scribd logo
1 de 23
Descargar para leer sin conexión
A curious case of broken
DNS responses
Babak Farrokhi
RIPE 75
About me
● Unix SA (FreeBSD, Solaris, Linux) since 1996
● IP Networking since 1997
● FreeBSD Ports Team since 2004
● Enthusiastic coder
@farrokhi
Prologue
● When it comes to network, I always have trust issues
● Most people ignore those strange network behaviors
● Only a few people take the red pill and go down the rabbit
hole...
Observation
● Outgoing SMTP fails due to MX lookup failures
○ only certain domains (e.g. twitter.com)
● Local resolver returns “incorrect” response
● Public Resolver (e.g. Google) also returned incorrect
response
● I needed to look deeper into this
Down the rabbit hole...
Strange responses from public resolvers
This is not what I expected to get from a public resolver:
% dig +short -t A twitter.com @8.8.8.8
10.10.34.34
% dig +short -t A ripe.net @8.8.8.8
193.0.6.139
% dig -t MX twitter.com @8.8.8.8
;; Got bad packet: bad label type
45 bytes
40 10 81 80 00 01 00 01 00 00 00 00 07 74 77 69 @............twi
74 74 65 72 03 63 6f 6d 00 00 0c 00 01 c0 0c 00 tter.com........
0c 00 01 00 00 03 79 00 03 41 41 41 00 ......y..AAA.
Need to take a closer look
Not obvious at first glance, but time delta is strange...
% tcpdump -ttt -c2 -nqr ripe.pcap
reading from PCAP-NG file ripe.pcap
00:00:00.000000 IP 192.168.0.132.53425 > 8.8.8.8.53: UDP, length 27
00:00:00.138933 IP 8.8.8.8.53 > 192.168.0.132.53425: UDP, length 75
% tcpdump -ttt -c2 -nqr twitter.pcap
reading from PCAP-NG file twitter.pcap
00:00:00.000000 IP 192.168.0.132.58418 > 8.8.8.8.53: UDP, length 29
00:00:00.028077 IP 8.8.8.8.53 > 192.168.0.132.58418: UDP, length 45
dnsping - A new tool is born
● Started as a humble Python script to solve my own problem
● Not intended to re-invent the wheel
● Similar user experience as the legacy PING
% ./dnsping.py -s 8.8.8.8 -c3 ripe.net
dnsping.py DNS: 8.8.8.8:53, hostname: ripe.net, rdatatype: A
32 bytes from 8.8.8.8: seq=0 time=200.371 ms
32 bytes from 8.8.8.8: seq=1 time=217.320 ms
32 bytes from 8.8.8.8: seq=2 time=236.644 ms
--- 8.8.8.8 dnsping statistics ---
3 requests transmitted, 3 responses received, 0% lost
min=200.371 ms, avg=218.112 ms, max=236.644 ms, stddev=18.149 ms
ICMP vs DNS Response Times
% ping -q -c10 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
--- 8.8.8.8 ping statistics ---
10 packets transmitted, 10 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 124.237/155.044/227.499/31.464 ms
% ./dnsping.py -q -s 8.8.8.8 -c3 twitter.com
dnsping.py DNS: 8.8.8.8:53, hostname: twitter.com, rdatatype: A
--- 8.8.8.8 dnsping statistics ---
3 requests transmitted, 3 responses received, 0% lost
min=12.934 ms, avg=21.355 ms, max=29.425 ms, stddev=8.251 ms
First anomaly
● Different domain names being treated differently
● A rogue name server impersonating as Google Resolver
● The rogue name server is close to me (given response
times)
● Where is it? And how can I find out?
dnstraceroute: Traceroute tool for DNS protocol
● Similar to legacy traceroute, but for DNS protocol
● Send out actual DNS queries and expect a response
● Using TTL trick to map the journey
● Could not use legacy traceroute with UDP probes
○ The traffic redirection is based on DNS “payload”
Real vs Rogue DNS Servers
% ./dnstraceroute.py -s 8.8.8.8 ripe.net
dnstraceroute.py DNS: 8.8.8.8:53, hostname: ripe.net,
rdatatype: A
1 192.168.0.1 (192.168.0.1) 3.912 ms
2 *
3 192.168.10.105 (192.168.10.105) 15.792 ms
4 172.17.2.1 (172.17.2.1) 17.063 ms
5 172.17.2.9 (172.17.2.9) 11.245 ms
6 172.19.18.5 (172.19.18.5) 24.862 ms
7 172.19.17.2 (172.19.17.2) 18.972 ms
8 10.201.177.41 (10.201.177.41) 13.261 ms
9 10.10.53.190 (10.10.53.190) 14.240 ms
10 185.100.209.117 (185.100.209.117) 176.592 ms
11 *
12 de-cix.fra.google.com (80.81.192.108) 152.757 ms
13 108.170.251.193 (108.170.251.193) 90.347 ms
14 google-public-dns-a.google.com (8.8.8.8) 185.401 ms
% ./dnstraceroute.py -s 8.8.8.8 twitter.com
dnstraceroute.py DNS: 8.8.8.8:53, hostname:
twitter.com, rdatatype: A
1 192.168.0.1 (192.168.0.1) 3.160 ms
2 *
3 192.168.10.105 (192.168.10.105) 5.985 ms
4 172.17.2.1 (172.17.2.1) 8.535 ms
5 172.17.2.9 (172.17.2.9) 20.617 ms
6 172.19.18.5 (172.19.18.5) 7.823 ms
7 *
8 *
9 google-public-dns-a.google.com (8.8.8.8) 19.557 ms
Back to the case of broken MX
● Rogue nameserver also returns “broken” responses
● Only to certain type of queries (e.g. MX)
% dig -t MX twitter.com @8.8.8.8
;; Got bad packet: bad label type
45 bytes
40 10 81 80 00 01 00 01 00 00 00 00 07 74 77 69 @............twi
74 74 65 72 03 63 6f 6d 00 00 0c 00 01 c0 0c 00 tter.com........
0c 00 01 00 00 03 79 00 03 41 41 41 00 ......y..AAA.
Looking at packets again...
● Response to MX request is malformed
○ Server responded with PTR response
○ RDLENGTH is 3 but RDATA field contains 4 bytes
■ Additional byte was always NULL
■ Seems like a bug in code
● Queried top 10,000 domain names [1], received 139
broken responses [2]
Uncovering the rouge resolver address
● Query TXT record from maxmind.test-ipv6.com
● It tells you the public address of your resolver
○ The address should belong to Google (AS15169)
○ Anything else means MITM
● Using RIPE Atlas to see if this is a regular practice
% dig +short -t TXT maxmind.test-ipv6.com @8.8.4.4
"ip='74.125.74.14' as='15169' isp='Google' country='FI'"
Is it just me? Let's ask RIPE Atlas
● 500 Probes worldwide - 484 Replied (DNS/UDP/IPv4)
○ 475 Good (Req. from Google address space) ~98%
○ 9 Bad (Req. from non-Google address space) ~2%
● Same 500 probes - 484 Replied (DNS/TCP/IPv4)
○ 479 Good ~99%
○ 5 Bad ~1%
The logic behind DNS traffic redirection
What is the motivation?
There are mainly two reasons:
1. Privacy protection (The Good)
○ Prevent sending request to use have your end-point IP
address as its source address
○ Filter out malwares looking for their C&C
2. DNS based service redirection (The Evil)
○ Restrict your access
○ Redirect your traffic
Countermeasures
● Force local resolver to use TCP
● DNSCrypt (dnscrypt.org)
○ OpenDNS supports it, desktop clients available
● DNS over TLS/DTLS (RFC 7858 and 8094)
○ DNS Privacy Project (dnsprivacy.org) offers tutorials, tools,
recommendations and test servers
● DNSSEC
○ From top 100 domain names only 2 of them are signed [3]
○ What if the rogue nameserver does not validate DNSSEC?
Final words
● Don’t trust a public DNS resolver, use your own
○ There ain't no such thing as a free lunch (TANSTAAFL)
○ Stub resolvers are easy to setup and use (e.g. Stubby)
● Don’t trust your upstream, encrypt as much as possible
○ DNS contains important information
○ As per RFC7258: “Pervasive Monitoring Is an Attack”
Tools of the trade
● dnsping, dnstraceroute and dnseval are part of “dnsdiag
toolkit” on GitHub [4]
○ Looking for feedback and ideas from community
● Combining with other tools (e.g. RIPE Atlas) to perform
more complex behavior analysis
● Suggestion: dnstraceroute in RIPE Atlas probes?
Questions?
Resources
[1] https://github.com/opendns/public-domain-lists
[2] https://gist.github.com/farrokhi/0b56ae06813391be9164
[3] https://gist.github.com/farrokhi/1d9de9df5877aaf9c42fc14412a4b0f8
[4] https://github.com/farrokhi/dnsdiag
Also my articles on RIPE Labs discussion the same issue:
● https://labs.ripe.net/Members/babak_farrokhi

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

Resolution,forward backward chaining
Resolution,forward backward chainingResolution,forward backward chaining
Resolution,forward backward chaining
 
libpinyin
libpinyinlibpinyin
libpinyin
 
Clique problem step_by_step
Clique problem step_by_stepClique problem step_by_step
Clique problem step_by_step
 
Cs8792 cns - unit iv
Cs8792   cns - unit ivCs8792   cns - unit iv
Cs8792 cns - unit iv
 
Technical Seminar.pptx
Technical Seminar.pptxTechnical Seminar.pptx
Technical Seminar.pptx
 
Unix Cheat Sheet
Unix Cheat SheetUnix Cheat Sheet
Unix Cheat Sheet
 
Extendible hashing
Extendible hashingExtendible hashing
Extendible hashing
 
SHA512.pptx
SHA512.pptxSHA512.pptx
SHA512.pptx
 
Modbus communication with 1769 sm2
Modbus communication with 1769 sm2Modbus communication with 1769 sm2
Modbus communication with 1769 sm2
 
tmux
tmuxtmux
tmux
 
CRYPTOGRAPHY & NETWORK SECURITY
CRYPTOGRAPHY & NETWORK SECURITYCRYPTOGRAPHY & NETWORK SECURITY
CRYPTOGRAPHY & NETWORK SECURITY
 
Clang: More than just a C/C++ Compiler
Clang: More than just a C/C++ CompilerClang: More than just a C/C++ Compiler
Clang: More than just a C/C++ Compiler
 
Ch02...1
Ch02...1Ch02...1
Ch02...1
 
Design and Simulation Triple-DES
Design and Simulation Triple-DESDesign and Simulation Triple-DES
Design and Simulation Triple-DES
 
Blowfish Cryptosystem
Blowfish Cryptosystem Blowfish Cryptosystem
Blowfish Cryptosystem
 
Os lab manual
Os lab manualOs lab manual
Os lab manual
 
Part-1 : Mastering microcontroller with embedded driver development
Part-1 : Mastering microcontroller with embedded driver development Part-1 : Mastering microcontroller with embedded driver development
Part-1 : Mastering microcontroller with embedded driver development
 
C basics quiz part 1_solution
C basics quiz part 1_solutionC basics quiz part 1_solution
C basics quiz part 1_solution
 
AI Greedy & A* Informed Search Strategies by Example
AI Greedy & A* Informed Search Strategies by ExampleAI Greedy & A* Informed Search Strategies by Example
AI Greedy & A* Informed Search Strategies by Example
 
Cgroups in android
Cgroups in androidCgroups in android
Cgroups in android
 

Similar a A curious case of broken dns responses - RIPE75

A curious case of broken DNS responses (Coloclue Presents - Nov 2019)
A curious case of broken DNS responses (Coloclue Presents - Nov 2019)A curious case of broken DNS responses (Coloclue Presents - Nov 2019)
A curious case of broken DNS responses (Coloclue Presents - Nov 2019)Babak Farrokhi
 
Building an Automated Behavioral Malware Analysis Environment using Free and ...
Building an Automated Behavioral Malware Analysis Environment using Free and ...Building an Automated Behavioral Malware Analysis Environment using Free and ...
Building an Automated Behavioral Malware Analysis Environment using Free and ...Jim Clausing
 
Encrypted DNS research @ nic.at
Encrypted DNS research @ nic.atEncrypted DNS research @ nic.at
Encrypted DNS research @ nic.atAlex Mayrhofer
 
Handy Networking Tools and How to Use Them
Handy Networking Tools and How to Use ThemHandy Networking Tools and How to Use Them
Handy Networking Tools and How to Use ThemSneha Inguva
 
DNS Survival Guide
DNS Survival GuideDNS Survival Guide
DNS Survival GuideAPNIC
 
DNS Survival Guide.
DNS Survival Guide.DNS Survival Guide.
DNS Survival Guide.Qrator Labs
 
DNSSEC Tutorial, by Champika Wijayatunga [APNIC 38]
DNSSEC Tutorial, by Champika Wijayatunga [APNIC 38]DNSSEC Tutorial, by Champika Wijayatunga [APNIC 38]
DNSSEC Tutorial, by Champika Wijayatunga [APNIC 38]APNIC
 
Dns protocol design attacks and security
Dns protocol design attacks and securityDns protocol design attacks and security
Dns protocol design attacks and securityMichael Earls
 
dns.workshop.hsgr
dns.workshop.hsgrdns.workshop.hsgr
dns.workshop.hsgrebalaskas
 
Building OpenDNS Stats
Building OpenDNS StatsBuilding OpenDNS Stats
Building OpenDNS StatsGeorge Ang
 
Resolution for a Faster Site
Resolution for a Faster SiteResolution for a Faster Site
Resolution for a Faster SiteIdo Safruti
 
Short Introduction to IPv6
Short Introduction to IPv6Short Introduction to IPv6
Short Introduction to IPv6Martin Schütte
 
How to send DNS over anything encrypted
How to send DNS over anything encryptedHow to send DNS over anything encrypted
How to send DNS over anything encryptedMen and Mice
 
Servers and Processes: Behavior and Analysis
Servers and Processes: Behavior and AnalysisServers and Processes: Behavior and Analysis
Servers and Processes: Behavior and Analysisdreamwidth
 
Hacker Halted 2014 - Why Botnet Takedowns Never Work, Unless It’s a SmackDown!
Hacker Halted 2014 - Why Botnet Takedowns Never Work, Unless It’s a SmackDown!Hacker Halted 2014 - Why Botnet Takedowns Never Work, Unless It’s a SmackDown!
Hacker Halted 2014 - Why Botnet Takedowns Never Work, Unless It’s a SmackDown!EC-Council
 
What Goes In Must Come Out: Egress-Assess and Data Exfiltration
What Goes In Must Come Out: Egress-Assess and Data ExfiltrationWhat Goes In Must Come Out: Egress-Assess and Data Exfiltration
What Goes In Must Come Out: Egress-Assess and Data ExfiltrationCTruncer
 
Network State Awareness & Troubleshooting
Network State Awareness & TroubleshootingNetwork State Awareness & Troubleshooting
Network State Awareness & TroubleshootingAPNIC
 

Similar a A curious case of broken dns responses - RIPE75 (20)

A curious case of broken DNS responses (Coloclue Presents - Nov 2019)
A curious case of broken DNS responses (Coloclue Presents - Nov 2019)A curious case of broken DNS responses (Coloclue Presents - Nov 2019)
A curious case of broken DNS responses (Coloclue Presents - Nov 2019)
 
Building an Automated Behavioral Malware Analysis Environment using Free and ...
Building an Automated Behavioral Malware Analysis Environment using Free and ...Building an Automated Behavioral Malware Analysis Environment using Free and ...
Building an Automated Behavioral Malware Analysis Environment using Free and ...
 
Encrypted DNS research @ nic.at
Encrypted DNS research @ nic.atEncrypted DNS research @ nic.at
Encrypted DNS research @ nic.at
 
Handy Networking Tools and How to Use Them
Handy Networking Tools and How to Use ThemHandy Networking Tools and How to Use Them
Handy Networking Tools and How to Use Them
 
DNS Survival Guide
DNS Survival GuideDNS Survival Guide
DNS Survival Guide
 
DNS Survival Guide.
DNS Survival Guide.DNS Survival Guide.
DNS Survival Guide.
 
DNSSEC Tutorial, by Champika Wijayatunga [APNIC 38]
DNSSEC Tutorial, by Champika Wijayatunga [APNIC 38]DNSSEC Tutorial, by Champika Wijayatunga [APNIC 38]
DNSSEC Tutorial, by Champika Wijayatunga [APNIC 38]
 
Dns protocol design attacks and security
Dns protocol design attacks and securityDns protocol design attacks and security
Dns protocol design attacks and security
 
dns.workshop.hsgr
dns.workshop.hsgrdns.workshop.hsgr
dns.workshop.hsgr
 
Building OpenDNS Stats
Building OpenDNS StatsBuilding OpenDNS Stats
Building OpenDNS Stats
 
6 app-tcp
6 app-tcp6 app-tcp
6 app-tcp
 
Resolution for a Faster Site
Resolution for a Faster SiteResolution for a Faster Site
Resolution for a Faster Site
 
Penetration Testing Boot CAMP
Penetration Testing Boot CAMPPenetration Testing Boot CAMP
Penetration Testing Boot CAMP
 
Short Introduction to IPv6
Short Introduction to IPv6Short Introduction to IPv6
Short Introduction to IPv6
 
How to send DNS over anything encrypted
How to send DNS over anything encryptedHow to send DNS over anything encrypted
How to send DNS over anything encrypted
 
Servers and Processes: Behavior and Analysis
Servers and Processes: Behavior and AnalysisServers and Processes: Behavior and Analysis
Servers and Processes: Behavior and Analysis
 
Network commands
Network commandsNetwork commands
Network commands
 
Hacker Halted 2014 - Why Botnet Takedowns Never Work, Unless It’s a SmackDown!
Hacker Halted 2014 - Why Botnet Takedowns Never Work, Unless It’s a SmackDown!Hacker Halted 2014 - Why Botnet Takedowns Never Work, Unless It’s a SmackDown!
Hacker Halted 2014 - Why Botnet Takedowns Never Work, Unless It’s a SmackDown!
 
What Goes In Must Come Out: Egress-Assess and Data Exfiltration
What Goes In Must Come Out: Egress-Assess and Data ExfiltrationWhat Goes In Must Come Out: Egress-Assess and Data Exfiltration
What Goes In Must Come Out: Egress-Assess and Data Exfiltration
 
Network State Awareness & Troubleshooting
Network State Awareness & TroubleshootingNetwork State Awareness & Troubleshooting
Network State Awareness & Troubleshooting
 

Último

Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersDamian Radcliffe
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Servicesexy call girls service in goa
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...Neha Pandey
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Call Girls in Nagpur High Profile
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGAPNIC
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...tanu pandey
 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girladitipandeya
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebJames Anderson
 
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...aditipandeya
 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...APNIC
 
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445ruhi
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...SofiyaSharma5
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...Diya Sharma
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Standkumarajju5765
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Delhi Call girls
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsThierry TROUIN ☁
 

Último (20)

Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 
Call Girls In Noida 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In Noida 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICECall Girls In Noida 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In Noida 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
 
Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOG
 
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
 
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
 
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
 
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with Flows
 

A curious case of broken dns responses - RIPE75

  • 1. A curious case of broken DNS responses Babak Farrokhi RIPE 75
  • 2. About me ● Unix SA (FreeBSD, Solaris, Linux) since 1996 ● IP Networking since 1997 ● FreeBSD Ports Team since 2004 ● Enthusiastic coder @farrokhi
  • 3. Prologue ● When it comes to network, I always have trust issues ● Most people ignore those strange network behaviors ● Only a few people take the red pill and go down the rabbit hole...
  • 4. Observation ● Outgoing SMTP fails due to MX lookup failures ○ only certain domains (e.g. twitter.com) ● Local resolver returns “incorrect” response ● Public Resolver (e.g. Google) also returned incorrect response ● I needed to look deeper into this
  • 5. Down the rabbit hole...
  • 6. Strange responses from public resolvers This is not what I expected to get from a public resolver: % dig +short -t A twitter.com @8.8.8.8 10.10.34.34 % dig +short -t A ripe.net @8.8.8.8 193.0.6.139 % dig -t MX twitter.com @8.8.8.8 ;; Got bad packet: bad label type 45 bytes 40 10 81 80 00 01 00 01 00 00 00 00 07 74 77 69 @............twi 74 74 65 72 03 63 6f 6d 00 00 0c 00 01 c0 0c 00 tter.com........ 0c 00 01 00 00 03 79 00 03 41 41 41 00 ......y..AAA.
  • 7. Need to take a closer look Not obvious at first glance, but time delta is strange... % tcpdump -ttt -c2 -nqr ripe.pcap reading from PCAP-NG file ripe.pcap 00:00:00.000000 IP 192.168.0.132.53425 > 8.8.8.8.53: UDP, length 27 00:00:00.138933 IP 8.8.8.8.53 > 192.168.0.132.53425: UDP, length 75 % tcpdump -ttt -c2 -nqr twitter.pcap reading from PCAP-NG file twitter.pcap 00:00:00.000000 IP 192.168.0.132.58418 > 8.8.8.8.53: UDP, length 29 00:00:00.028077 IP 8.8.8.8.53 > 192.168.0.132.58418: UDP, length 45
  • 8. dnsping - A new tool is born ● Started as a humble Python script to solve my own problem ● Not intended to re-invent the wheel ● Similar user experience as the legacy PING % ./dnsping.py -s 8.8.8.8 -c3 ripe.net dnsping.py DNS: 8.8.8.8:53, hostname: ripe.net, rdatatype: A 32 bytes from 8.8.8.8: seq=0 time=200.371 ms 32 bytes from 8.8.8.8: seq=1 time=217.320 ms 32 bytes from 8.8.8.8: seq=2 time=236.644 ms --- 8.8.8.8 dnsping statistics --- 3 requests transmitted, 3 responses received, 0% lost min=200.371 ms, avg=218.112 ms, max=236.644 ms, stddev=18.149 ms
  • 9. ICMP vs DNS Response Times % ping -q -c10 8.8.8.8 PING 8.8.8.8 (8.8.8.8): 56 data bytes --- 8.8.8.8 ping statistics --- 10 packets transmitted, 10 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 124.237/155.044/227.499/31.464 ms % ./dnsping.py -q -s 8.8.8.8 -c3 twitter.com dnsping.py DNS: 8.8.8.8:53, hostname: twitter.com, rdatatype: A --- 8.8.8.8 dnsping statistics --- 3 requests transmitted, 3 responses received, 0% lost min=12.934 ms, avg=21.355 ms, max=29.425 ms, stddev=8.251 ms
  • 10. First anomaly ● Different domain names being treated differently ● A rogue name server impersonating as Google Resolver ● The rogue name server is close to me (given response times) ● Where is it? And how can I find out?
  • 11. dnstraceroute: Traceroute tool for DNS protocol ● Similar to legacy traceroute, but for DNS protocol ● Send out actual DNS queries and expect a response ● Using TTL trick to map the journey ● Could not use legacy traceroute with UDP probes ○ The traffic redirection is based on DNS “payload”
  • 12. Real vs Rogue DNS Servers % ./dnstraceroute.py -s 8.8.8.8 ripe.net dnstraceroute.py DNS: 8.8.8.8:53, hostname: ripe.net, rdatatype: A 1 192.168.0.1 (192.168.0.1) 3.912 ms 2 * 3 192.168.10.105 (192.168.10.105) 15.792 ms 4 172.17.2.1 (172.17.2.1) 17.063 ms 5 172.17.2.9 (172.17.2.9) 11.245 ms 6 172.19.18.5 (172.19.18.5) 24.862 ms 7 172.19.17.2 (172.19.17.2) 18.972 ms 8 10.201.177.41 (10.201.177.41) 13.261 ms 9 10.10.53.190 (10.10.53.190) 14.240 ms 10 185.100.209.117 (185.100.209.117) 176.592 ms 11 * 12 de-cix.fra.google.com (80.81.192.108) 152.757 ms 13 108.170.251.193 (108.170.251.193) 90.347 ms 14 google-public-dns-a.google.com (8.8.8.8) 185.401 ms % ./dnstraceroute.py -s 8.8.8.8 twitter.com dnstraceroute.py DNS: 8.8.8.8:53, hostname: twitter.com, rdatatype: A 1 192.168.0.1 (192.168.0.1) 3.160 ms 2 * 3 192.168.10.105 (192.168.10.105) 5.985 ms 4 172.17.2.1 (172.17.2.1) 8.535 ms 5 172.17.2.9 (172.17.2.9) 20.617 ms 6 172.19.18.5 (172.19.18.5) 7.823 ms 7 * 8 * 9 google-public-dns-a.google.com (8.8.8.8) 19.557 ms
  • 13. Back to the case of broken MX ● Rogue nameserver also returns “broken” responses ● Only to certain type of queries (e.g. MX) % dig -t MX twitter.com @8.8.8.8 ;; Got bad packet: bad label type 45 bytes 40 10 81 80 00 01 00 01 00 00 00 00 07 74 77 69 @............twi 74 74 65 72 03 63 6f 6d 00 00 0c 00 01 c0 0c 00 tter.com........ 0c 00 01 00 00 03 79 00 03 41 41 41 00 ......y..AAA.
  • 14. Looking at packets again... ● Response to MX request is malformed ○ Server responded with PTR response ○ RDLENGTH is 3 but RDATA field contains 4 bytes ■ Additional byte was always NULL ■ Seems like a bug in code ● Queried top 10,000 domain names [1], received 139 broken responses [2]
  • 15. Uncovering the rouge resolver address ● Query TXT record from maxmind.test-ipv6.com ● It tells you the public address of your resolver ○ The address should belong to Google (AS15169) ○ Anything else means MITM ● Using RIPE Atlas to see if this is a regular practice % dig +short -t TXT maxmind.test-ipv6.com @8.8.4.4 "ip='74.125.74.14' as='15169' isp='Google' country='FI'"
  • 16. Is it just me? Let's ask RIPE Atlas ● 500 Probes worldwide - 484 Replied (DNS/UDP/IPv4) ○ 475 Good (Req. from Google address space) ~98% ○ 9 Bad (Req. from non-Google address space) ~2% ● Same 500 probes - 484 Replied (DNS/TCP/IPv4) ○ 479 Good ~99% ○ 5 Bad ~1%
  • 17. The logic behind DNS traffic redirection
  • 18. What is the motivation? There are mainly two reasons: 1. Privacy protection (The Good) ○ Prevent sending request to use have your end-point IP address as its source address ○ Filter out malwares looking for their C&C 2. DNS based service redirection (The Evil) ○ Restrict your access ○ Redirect your traffic
  • 19. Countermeasures ● Force local resolver to use TCP ● DNSCrypt (dnscrypt.org) ○ OpenDNS supports it, desktop clients available ● DNS over TLS/DTLS (RFC 7858 and 8094) ○ DNS Privacy Project (dnsprivacy.org) offers tutorials, tools, recommendations and test servers ● DNSSEC ○ From top 100 domain names only 2 of them are signed [3] ○ What if the rogue nameserver does not validate DNSSEC?
  • 20. Final words ● Don’t trust a public DNS resolver, use your own ○ There ain't no such thing as a free lunch (TANSTAAFL) ○ Stub resolvers are easy to setup and use (e.g. Stubby) ● Don’t trust your upstream, encrypt as much as possible ○ DNS contains important information ○ As per RFC7258: “Pervasive Monitoring Is an Attack”
  • 21. Tools of the trade ● dnsping, dnstraceroute and dnseval are part of “dnsdiag toolkit” on GitHub [4] ○ Looking for feedback and ideas from community ● Combining with other tools (e.g. RIPE Atlas) to perform more complex behavior analysis ● Suggestion: dnstraceroute in RIPE Atlas probes?
  • 23. Resources [1] https://github.com/opendns/public-domain-lists [2] https://gist.github.com/farrokhi/0b56ae06813391be9164 [3] https://gist.github.com/farrokhi/1d9de9df5877aaf9c42fc14412a4b0f8 [4] https://github.com/farrokhi/dnsdiag Also my articles on RIPE Labs discussion the same issue: ● https://labs.ripe.net/Members/babak_farrokhi