Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
[Facebook Bug Bounty] Dangling DNS Records on! - $500

Dangling DNS Records on! - $500

Read the proper write-up here:!

Vulnerability Discovery

In this GitHub Gist, I have included my script (, which I used in discovering this vulnerability.

The script performs sub-domain enumeration over the domain using assetfinder, subfinder, sublist3r and amass, and then checks for sub-domains which are further pointing to Amazon EC2 hostnames, and stores all of the results in multiple text files.

I didn't perform any form of manual work in discovering this vulnerability, and my workflow was fully automated with the help of Bash scripting using different tools.

After retrieving the results as mentioned earlier, you can simply perform a Nmap scan for all ports across the sub-domainss with Amazon EC2 hostnames, and if no ports are up, you can try reporting the vulnerability to the vendor (i.e. in this case, it's Facebook.).

Here's a sample Nmap command that you can use: nmap -sV -p- -O <hostname or IP>

In the script file ( that I have provided, I have only included the part of the script, which helped me in finding this vulnerability, which means I have removed the hostnames checking abilities for AWS Elastic Beanstalk and Amazon S3.

Report Highlights

Complete Details

A few months back, one of my friends found a Dangling DNS Record vulnerability in a sub-domain of, and he shared me his strategy on how he did that. So, today I decided to automate the process and look up for similar vulnerabilities across all of the in-scope domains of Facebook, and I found out one such issue in another sub-domain of; i.e.

The target sub-domain, is pointed to an Amazon EC2 instance hostname ( through CNAME records, and this hostname is based on top of one of the IP addresses (i.e. from Amazon AWS' pool of IP addresses.

There are three reasons why the Dangling DNS Record issue could be persistent in this case:

  1. Either the team from Facebook released this IP address from their list of allocated elastic IP addresses in their AWS account;
  2. OR, it wasn't even an elastic IP address, which means when the EC2 instance was shut down and started again, the IP address got changed (this is how EC2 IP addresses are assigned when an Elastic IP Address isn't assigned) and the team forgot to change the DNS records to the new hostname or IP address;
  3. OR, the team just allocated created the EC2 instance for certain purpose, created the CNAME records for that sub-domain pointing to the EC2 instance, and then shut down or terminated the EC2 instance later on, but forgot to change or remove the DNS records for the target sub-domain.

In AWS, anyone's EC2 instances might be assigned any of the IP addresses from their pool of IP addresses randomly based on their AWS region selection, and in this case, if any user in the ap-southeast-1 region tries creating an EC2 instance and he/she gets assigned this IP address, then the target sub-domain will be under the control of that user. Therefore, the target sub-domain as mentioned earlier is vulnerable to Dangling DNS Record.


Since the IP address is no longer associated with the EC2 instance for which the target sub-domain is meant to be pointed to and is now in the pool of available IP addresses in AWS, whenever this IP address gets assigned to anyone's EC2 instance in the ap-southeast-1 region, then that person will have full rights over anything to do or host on top of the vulnerable sub-domain at; i.e.


  • Users: N/A
  • Environment: N/A
  • Browser: Any web browser!
  • App version: N/A
  • OS: I am using Debian 10 (Buster), but you can use any OS available out there.
  • Description: is an in-scope asset of Facebook's Bug Bounty Program.

Reproduction Steps

Step 1. Perform DNS lookup on the target sub-domain:! You can use the "dig" command in your Linux terminal, and pass the sub-domain as the first argument, or you may even use the "+short" flag to just view the actual thing we need.

Sample Commands:

  1. dig
  2. dig +short

Step 2. When you perform DNS lookup on the target sub-domain, the results in the "ANSWER SECTION" would appear as below:


You can see the sub-domain is pointed to an EC2 instance hostname through CNAME records, and the hostname is further assigned to an IP address from the pool of AWS IP addresses (you can verify by performing: whois

Now, for checking whether the DNS records are dangling or not, you can perform a nmap scan like with this command: nmap -sV -p- -O

It will show that the host seems down, which means there is no valid host running on this IP address, hence verifying that the DNS records are dangling.

Mitigation/Remediation Actions

To mitigate this issue, one simple step that can be taken would be to change or remove the CNAME records from the target sub-domain.

Suggesting Materials or References


Thank You, and have a nice day!


Binit Ghimire

Reporting Timeline

  • Reported: Saturday, December 19, 2020 at 11:35 PM
  • Automated Response: Saturday, December 19, 2020 at 11:35 PM
  • First Response from the Team (successful reproduction): Tuesday, December 22, 2020 at 8:55 PM
  • My Response back to the Team: Tuesday, December 22, 2020 at 9:18 PM
  • Triaged (the team sent it to the appropriate product team): Wednesday, December 23, 2020 at 3:44 AM
  • My Response back to the Team: Wednesday, December 23, 2020 at 4:19 AM
  • Response from the Team (requesting to try taking over): Wednesday, January 6, 2021 at 1:13 AM
  • My Response back to the Team (explaining about random IP address allocation for Amazon EC2 instances from the AWS' pool of IP addresses): Wednesday, January 6, 2021 at 9:14 AM
  • My Response back to the Team: Wednesday, January 27, 2021 at 10:36 PM
  • Response from the Team: Thursday, February 11, 2021 at 4:45 AM
  • My Response back to the Team: Thursday, February 11, 2021 at 4:55 AM
  • Patched Response: Monday, March 1, 2021 at 8:00 PM
  • My Patched Confirmation: Wednesday, March 3, 2021 at 12:54 AM
  • Rewarded $500: Yesterday at 8:49 PM
  • My Response: Today at 11:49 AM

Further Notes

Please note that this isn't a sub-domain takeover vulnerability even though there is a possiblity for sub-domain takeover!

If you have any questions regarding the contents of this gist, please feel free to let me know through the comments!

## Subdomain Enumeration
echo "Checking with Assetfinder!";
assetfinder -subs-only >> ~/results/;
echo "Checking with Subfinder!";
subfinder -d -recursive -silent -all -t 500 -o ~/results/;
echo "Checking with Sublist3r!";
sublist3r -d -n -t 500 -o ~/results/;
echo "Checking with Amass!";
amass enum -passive -norecursive -noalts -d -o ~/results/;
## Subdomain Concatenation
cat ~/results/*.txt > ~/results/;
## Subdomain Enumeration Cleanup
rm -rf ~/results/;
## Subdomain Enumeration Results
sort -u ~/results/ -o ~/results/
## Amazon EC2 Checker
while IFS= read -r domain; do
if dig +short $domain | grep ec2; then echo $domain | tee -a ~/results/; fi;
done < ~/results/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment