SlideShare a Scribd company logo
1 of 22
Download to read offline
Securing DNS records from takeovers
Chandrapal Badshah
About Me
● Chandrapal Badshah
● Security Engineer
● Pentest, Automation, Read books
● Philosophy & Stoicism
● Manage @HackwithGithub on Twitter
What is a DNS record ?
A DNS record is a mapping of human-friendly name to IP addresses *.
Like a key value pair where the key is always a human-friendly name and the
value is either an IP address / another human-friendly name
A DNS server (called Name Server) is simply a database that has hosts these DNS
records.
Types of DNS records
Multiple types of DNS records:
● A Record : Maps to IPv4 address
● CNAME Record : Maps to another DNS record
Types of DNS records
● AAAA Record : Maps to IPv6 address
● MX Record : Maps to mail server responsible for accepting email messages
● NS Record : Maps to authoritative DNS server of a website
and many more ...
Introduction to DNS record takeovers
● Dangling DNS records are just out-of-date records that may have served its
purpose in the past
● In simple terms, dangling DNS record is a valid DNS record pointing to an
invalid resource.
● Takeover is just the exploitation of dangling DNS records
Types of takeovers
Out of all the DNS record types in use, 4 are known to be vulnerable:
● CNAME record
● A record
● MX record
● NS record
CNAME Takeovers
● Try to gain control over the resource that the CNAME record is pointing to.
● Most common among subdomain takeovers
CNAME Takeovers
CNAME Takeovers
CNAME Takeovers
● Most widely exploited attack vector
○ Easy to judge if a CNAME record is vulnerable (because of some identifiers)
○ Most BBP consider this as Medium to High severity bug
○ Detection can be completely automated and easy $$$ if found
○ Lots of SaaS vendors without proper verifications
● One noteworthy repo is https://github.com/EdOverflow/can-i-take-over-xyz
● Common reasons for this:
○ SaaS providers allow to register/reuse same resource name
○ Expired domain
○ Non-existent domain due to typo in CNAME record
A Takeovers
● Try to gain access to the IP address pointed by the A record
● More common than dangling CNAME records but less exploited
○ No easy way to distinguish if an IP is available to takeover / just behind a firewall / was
already assigned to some other cloud user
○ Less probability of finding it in your BBP scope
○ Depends on the cloud provider
● Can be exploited for malware distribution / malvertising
● Unlike CNAME records, one subdomain can point to multiple A records
MX Takeovers
● Try to gain access to the resource the MX record is pointing to
● Comparatively low impact than other takeovers
○ MX records only used to receive emails
○ Usually > 1 MX record for domain
○ Priority of the MX record matters
○ Not every subdomain will have MX records
● The impact
○ Email fraud (can be used in phishing emails)
○ Intellectual Property disclosure
NS Takeovers
● Try to gain access to NS records of a domain
● The least probable compared to other methods
○ More than one NS record used for domains
○ Seldom used for subdomains
○ If a NS record is not properly setup, the subdomains don’t work (no place for typos)
● High impact as NS takeover makes you authoritative DNS server
○ Depends on number of configured NS records
Impact of DNS record takeover
● A & CNAME record takeover
○ Phishing / ask for login credentials
○ Malware distribution
○ Can register to services where verification is TXT file upload
○ Chain other vulnerabilities to takeover user accounts and other sensitive information
○ Can issue SSL certificate for domains (from SSL providers using ACMEv1)
● MX record takeover
○ Receive emails (Intellectual property disclosure)
○ Email fraud
● NS record takeover
○ Complete control on (sub)domain’s DNS
How to protect from takeovers ?
● Need People, Process and Technology
● People & Process
○ Have a centralized place for all your domain registrations & DNS records
● Technology
○ Get list of all public IPs
○ Get list of custom domains / subdomains created by Cloud Provider / SaaS services
○ Get DNS records (A, CNAME, MX and NS) that you own
○ If there are any DNS records not pointing to IPs / DNS records you own, note it
○ If the noted DNS record are not whitelisted, report it
○ Have a periodic check of the whitelisted DNS records
How to protect from takeovers ?
all_ips = []
all_resources = []
dns_records = {}
whitelisted = {}
for each record in dns_records:
for each resource in dns_records[record]:
if resource not in all_ips
and not in all_resources
and not in whitelisted:
report({ record : resource })
Example : How to protect from takeovers ?
● Mandates employees to use AWS Route53 which company owns
● Security team gets a list of all AWS Services they use that which creates
custom domains
○ AWS Cloudfront
○ AWS Elastic Load Balancer
○ AWS S3 buckets
● Security team writes an audit script which runs every day to fetch all
non-whitelisted DNS records pointing to 3rd party
● Security team is being vigilant instead of being a blocker
DEMO
How to protect from takeovers in complex env ?
● When using multiple regions within same cloud provider or using different
cloud provider the method remains the same
● Get all IPs and DNS records (across all regions & cloud accounts) and check if
the DNS record is pointing to a third party
Thank you
Any Questions ?
Blog : https://badshah.io/remove-domain-takeover-bug-class/
POC : https://gitlab.com/bnchandrapal/dns-takeover-mitigation-poc
What am I working on now ?
Follow on Twitter to get more updates on:
● Mobile App Security Pipeline (Android & iOS)
● SAST

More Related Content

What's hot

Estructura De Dominios Y Active Directory
Estructura De Dominios Y Active DirectoryEstructura De Dominios Y Active Directory
Estructura De Dominios Y Active Directory
karivip
 

What's hot (20)

Web application vulnerabilities
Web application vulnerabilitiesWeb application vulnerabilities
Web application vulnerabilities
 
Waf bypassing Techniques
Waf bypassing TechniquesWaf bypassing Techniques
Waf bypassing Techniques
 
SQLMAP Tool Usage - A Heads Up
SQLMAP Tool Usage - A  Heads UpSQLMAP Tool Usage - A  Heads Up
SQLMAP Tool Usage - A Heads Up
 
DNS Security
DNS SecurityDNS Security
DNS Security
 
DNS - Domain Name System
DNS - Domain Name SystemDNS - Domain Name System
DNS - Domain Name System
 
Dns(Domain name system)
Dns(Domain name system)Dns(Domain name system)
Dns(Domain name system)
 
Improving notes addressing experience with recent contacts
Improving notes addressing experience with recent contactsImproving notes addressing experience with recent contacts
Improving notes addressing experience with recent contacts
 
Automating Network Infrastructure : Ansible
Automating Network Infrastructure : AnsibleAutomating Network Infrastructure : Ansible
Automating Network Infrastructure : Ansible
 
DDoS - Distributed Denial of Service
DDoS - Distributed Denial of ServiceDDoS - Distributed Denial of Service
DDoS - Distributed Denial of Service
 
Domain name service
Domain name serviceDomain name service
Domain name service
 
Threat Hunting Web Shells Using Splunk
Threat Hunting Web Shells Using SplunkThreat Hunting Web Shells Using Splunk
Threat Hunting Web Shells Using Splunk
 
June OpenNTF Webinar - Domino V12 Certification Manager
June OpenNTF Webinar - Domino V12 Certification ManagerJune OpenNTF Webinar - Domino V12 Certification Manager
June OpenNTF Webinar - Domino V12 Certification Manager
 
Dns
DnsDns
Dns
 
No Easy Breach DerbyCon 2016
No Easy Breach DerbyCon 2016No Easy Breach DerbyCon 2016
No Easy Breach DerbyCon 2016
 
IBM Domino / IBM Notes Performance Tuning
IBM Domino / IBM Notes Performance Tuning IBM Domino / IBM Notes Performance Tuning
IBM Domino / IBM Notes Performance Tuning
 
RNUG - HCL Notes V11 Performance Boost
RNUG - HCL Notes V11 Performance BoostRNUG - HCL Notes V11 Performance Boost
RNUG - HCL Notes V11 Performance Boost
 
Dns security
Dns securityDns security
Dns security
 
DNSSEC Validation Tutorial
DNSSEC Validation TutorialDNSSEC Validation Tutorial
DNSSEC Validation Tutorial
 
Estructura De Dominios Y Active Directory
Estructura De Dominios Y Active DirectoryEstructura De Dominios Y Active Directory
Estructura De Dominios Y Active Directory
 
Reconnaissance - For pentesting and user awareness
Reconnaissance - For pentesting and user awarenessReconnaissance - For pentesting and user awareness
Reconnaissance - For pentesting and user awareness
 

Similar to Securing dns records from subdomain takeover

Similar to Securing dns records from subdomain takeover (20)

Understanding DNS Security
Understanding DNS SecurityUnderstanding DNS Security
Understanding DNS Security
 
DNS in IR: Collection, Analysis and Response
DNS in IR: Collection, Analysis and ResponseDNS in IR: Collection, Analysis and Response
DNS in IR: Collection, Analysis and Response
 
What You Need to Know - Domain Name System (DNS)
What You Need to Know - Domain Name System (DNS)What You Need to Know - Domain Name System (DNS)
What You Need to Know - Domain Name System (DNS)
 
DNS Over HTTPS by Michael Casadevall
DNS Over HTTPS by Michael CasadevallDNS Over HTTPS by Michael Casadevall
DNS Over HTTPS by Michael Casadevall
 
Designate: An Overview
Designate: An OverviewDesignate: An Overview
Designate: An Overview
 
CNIT 40: 5: Prevention, protection, and mitigation of DNS service disruption
CNIT 40: 5: Prevention, protection, and mitigation of DNS service disruptionCNIT 40: 5: Prevention, protection, and mitigation of DNS service disruption
CNIT 40: 5: Prevention, protection, and mitigation of DNS service disruption
 
Google Cloud DNS
Google Cloud DNSGoogle Cloud DNS
Google Cloud DNS
 
CNIT 40: 5: Prevention, protection, and mitigation of DNS service disruption
CNIT 40: 5: Prevention, protection, and mitigation of DNS service disruptionCNIT 40: 5: Prevention, protection, and mitigation of DNS service disruption
CNIT 40: 5: Prevention, protection, and mitigation of DNS service disruption
 
IGF 2023: DNS Privacy
IGF 2023: DNS PrivacyIGF 2023: DNS Privacy
IGF 2023: DNS Privacy
 
Monitoring DNS Records and Servers
Monitoring DNS Records and ServersMonitoring DNS Records and Servers
Monitoring DNS Records and Servers
 
Introduction DNSSec
Introduction DNSSecIntroduction DNSSec
Introduction DNSSec
 
Detecting dns-tunneling-34152
Detecting dns-tunneling-34152Detecting dns-tunneling-34152
Detecting dns-tunneling-34152
 
DomainNameSystem
DomainNameSystemDomainNameSystem
DomainNameSystem
 
7 understanding DNS
7 understanding DNS7 understanding DNS
7 understanding DNS
 
Monitoring for DNS Security
Monitoring for DNS SecurityMonitoring for DNS Security
Monitoring for DNS Security
 
Subdomain Enumeration
Subdomain EnumerationSubdomain Enumeration
Subdomain Enumeration
 
How DNS works and How to secure it: An Introduction
How DNS works and How to secure it: An IntroductionHow DNS works and How to secure it: An Introduction
How DNS works and How to secure it: An Introduction
 
DNS Fundamentals Presentation_PANDI-2022.pdf
DNS Fundamentals Presentation_PANDI-2022.pdfDNS Fundamentals Presentation_PANDI-2022.pdf
DNS Fundamentals Presentation_PANDI-2022.pdf
 
Running a Robust DNS Infrastructure with CloudFlare Virtual DNS
Running a Robust DNS Infrastructure with CloudFlare Virtual DNSRunning a Robust DNS Infrastructure with CloudFlare Virtual DNS
Running a Robust DNS Infrastructure with CloudFlare Virtual DNS
 
Infoblox - turning DNS from security target to security tool
Infoblox - turning DNS from security target to security toolInfoblox - turning DNS from security target to security tool
Infoblox - turning DNS from security target to security tool
 

More from n|u - The Open Security Community

More from n|u - The Open Security Community (20)

Hardware security testing 101 (Null - Delhi Chapter)
Hardware security testing 101 (Null - Delhi Chapter)Hardware security testing 101 (Null - Delhi Chapter)
Hardware security testing 101 (Null - Delhi Chapter)
 
Osint primer
Osint primerOsint primer
Osint primer
 
SSRF exploit the trust relationship
SSRF exploit the trust relationshipSSRF exploit the trust relationship
SSRF exploit the trust relationship
 
Nmap basics
Nmap basicsNmap basics
Nmap basics
 
Metasploit primary
Metasploit primaryMetasploit primary
Metasploit primary
 
Api security-testing
Api security-testingApi security-testing
Api security-testing
 
Introduction to TLS 1.3
Introduction to TLS 1.3Introduction to TLS 1.3
Introduction to TLS 1.3
 
Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...
Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...
Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...
 
Talking About SSRF,CRLF
Talking About SSRF,CRLFTalking About SSRF,CRLF
Talking About SSRF,CRLF
 
Building active directory lab for red teaming
Building active directory lab for red teamingBuilding active directory lab for red teaming
Building active directory lab for red teaming
 
Owning a company through their logs
Owning a company through their logsOwning a company through their logs
Owning a company through their logs
 
Introduction to shodan
Introduction to shodanIntroduction to shodan
Introduction to shodan
 
Cloud security
Cloud security Cloud security
Cloud security
 
Detecting persistence in windows
Detecting persistence in windowsDetecting persistence in windows
Detecting persistence in windows
 
Frida - Objection Tool Usage
Frida - Objection Tool UsageFrida - Objection Tool Usage
Frida - Objection Tool Usage
 
OSQuery - Monitoring System Process
OSQuery - Monitoring System ProcessOSQuery - Monitoring System Process
OSQuery - Monitoring System Process
 
DevSecOps Jenkins Pipeline -Security
DevSecOps Jenkins Pipeline -SecurityDevSecOps Jenkins Pipeline -Security
DevSecOps Jenkins Pipeline -Security
 
Extensible markup language attacks
Extensible markup language attacksExtensible markup language attacks
Extensible markup language attacks
 
Linux for hackers
Linux for hackersLinux for hackers
Linux for hackers
 
Android Pentesting
Android PentestingAndroid Pentesting
Android Pentesting
 

Recently uploaded

Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
SanaAli374401
 

Recently uploaded (20)

Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 

Securing dns records from subdomain takeover

  • 1. Securing DNS records from takeovers Chandrapal Badshah
  • 2. About Me ● Chandrapal Badshah ● Security Engineer ● Pentest, Automation, Read books ● Philosophy & Stoicism ● Manage @HackwithGithub on Twitter
  • 3. What is a DNS record ? A DNS record is a mapping of human-friendly name to IP addresses *. Like a key value pair where the key is always a human-friendly name and the value is either an IP address / another human-friendly name A DNS server (called Name Server) is simply a database that has hosts these DNS records.
  • 4. Types of DNS records Multiple types of DNS records: ● A Record : Maps to IPv4 address ● CNAME Record : Maps to another DNS record
  • 5. Types of DNS records ● AAAA Record : Maps to IPv6 address ● MX Record : Maps to mail server responsible for accepting email messages ● NS Record : Maps to authoritative DNS server of a website and many more ...
  • 6. Introduction to DNS record takeovers ● Dangling DNS records are just out-of-date records that may have served its purpose in the past ● In simple terms, dangling DNS record is a valid DNS record pointing to an invalid resource. ● Takeover is just the exploitation of dangling DNS records
  • 7. Types of takeovers Out of all the DNS record types in use, 4 are known to be vulnerable: ● CNAME record ● A record ● MX record ● NS record
  • 8. CNAME Takeovers ● Try to gain control over the resource that the CNAME record is pointing to. ● Most common among subdomain takeovers
  • 11. CNAME Takeovers ● Most widely exploited attack vector ○ Easy to judge if a CNAME record is vulnerable (because of some identifiers) ○ Most BBP consider this as Medium to High severity bug ○ Detection can be completely automated and easy $$$ if found ○ Lots of SaaS vendors without proper verifications ● One noteworthy repo is https://github.com/EdOverflow/can-i-take-over-xyz ● Common reasons for this: ○ SaaS providers allow to register/reuse same resource name ○ Expired domain ○ Non-existent domain due to typo in CNAME record
  • 12. A Takeovers ● Try to gain access to the IP address pointed by the A record ● More common than dangling CNAME records but less exploited ○ No easy way to distinguish if an IP is available to takeover / just behind a firewall / was already assigned to some other cloud user ○ Less probability of finding it in your BBP scope ○ Depends on the cloud provider ● Can be exploited for malware distribution / malvertising ● Unlike CNAME records, one subdomain can point to multiple A records
  • 13. MX Takeovers ● Try to gain access to the resource the MX record is pointing to ● Comparatively low impact than other takeovers ○ MX records only used to receive emails ○ Usually > 1 MX record for domain ○ Priority of the MX record matters ○ Not every subdomain will have MX records ● The impact ○ Email fraud (can be used in phishing emails) ○ Intellectual Property disclosure
  • 14. NS Takeovers ● Try to gain access to NS records of a domain ● The least probable compared to other methods ○ More than one NS record used for domains ○ Seldom used for subdomains ○ If a NS record is not properly setup, the subdomains don’t work (no place for typos) ● High impact as NS takeover makes you authoritative DNS server ○ Depends on number of configured NS records
  • 15. Impact of DNS record takeover ● A & CNAME record takeover ○ Phishing / ask for login credentials ○ Malware distribution ○ Can register to services where verification is TXT file upload ○ Chain other vulnerabilities to takeover user accounts and other sensitive information ○ Can issue SSL certificate for domains (from SSL providers using ACMEv1) ● MX record takeover ○ Receive emails (Intellectual property disclosure) ○ Email fraud ● NS record takeover ○ Complete control on (sub)domain’s DNS
  • 16. How to protect from takeovers ? ● Need People, Process and Technology ● People & Process ○ Have a centralized place for all your domain registrations & DNS records ● Technology ○ Get list of all public IPs ○ Get list of custom domains / subdomains created by Cloud Provider / SaaS services ○ Get DNS records (A, CNAME, MX and NS) that you own ○ If there are any DNS records not pointing to IPs / DNS records you own, note it ○ If the noted DNS record are not whitelisted, report it ○ Have a periodic check of the whitelisted DNS records
  • 17. How to protect from takeovers ? all_ips = [] all_resources = [] dns_records = {} whitelisted = {} for each record in dns_records: for each resource in dns_records[record]: if resource not in all_ips and not in all_resources and not in whitelisted: report({ record : resource })
  • 18. Example : How to protect from takeovers ? ● Mandates employees to use AWS Route53 which company owns ● Security team gets a list of all AWS Services they use that which creates custom domains ○ AWS Cloudfront ○ AWS Elastic Load Balancer ○ AWS S3 buckets ● Security team writes an audit script which runs every day to fetch all non-whitelisted DNS records pointing to 3rd party ● Security team is being vigilant instead of being a blocker
  • 19. DEMO
  • 20. How to protect from takeovers in complex env ? ● When using multiple regions within same cloud provider or using different cloud provider the method remains the same ● Get all IPs and DNS records (across all regions & cloud accounts) and check if the DNS record is pointing to a third party
  • 21. Thank you Any Questions ? Blog : https://badshah.io/remove-domain-takeover-bug-class/ POC : https://gitlab.com/bnchandrapal/dns-takeover-mitigation-poc
  • 22. What am I working on now ? Follow on Twitter to get more updates on: ● Mobile App Security Pipeline (Android & iOS) ● SAST