Last Updated: 2017-10-02 07:48:19 UTC
by Xavier Mertens (Version: 1)
Sometimes when you need to investigate a security incident or to check for suspicious activity, you become frustrated because the online resource that you’re trying to reach has already been cleaned. We cannot blame system administrators and webmasters who are just doing their job. If some servers or websites remains compromised for weeks, others are very quickly restored/patched/cleaned to get rid of the malicious content. It’s the same for domain names. Domains registered only for malicious purposes can be suspended to prevent further attacks. If the domain is not suspended, the offending DNS record is simply removed.
That’s not easy to start an investigation so I asked him more details. He replied with the complete details how he landed on this page but, in the meantime, the offending content was removed and the DNS record removed:
$ host www.aniqugimexico.org Host www.aniqugimexico.org not found: 3(NXDOMAIN)
When you’re investigating, the good reflex is to collect all the data and log them! (See my previous diary about full packet capture). You can find back the IP address of the offending website:
Just change your local /etc/hosts file in your analysis environment and you're good to go! If you're lucky, the website is still delivering the malicious content. Another very good source of information is to use Passive DNS services like virustotal.com, dnsdumpster.com or passive total.com. If the traffic generated by the victim was captured, you can try to extract the suspicious code from the PCAP files or from any proxy solution.
They are plenty of passive DNS services and checking all of them can be time-consuming and boring. Hopefully, we can automate the lookups using a Ruby gem available on GitHub: passivedns-client. You can also build your own passive DNS database with the tool passivedns which will collect DNS traffic from an interface (live sniffing) or by reading PCAP files. Other NSM solutions like Bro also collect all the DNS traffic.
Xavier Mertens (@xme)
ISC Handler - Freelance Security Consultant