DNS leak is quite a significant issue to complete anonymous yourself on TOR.
The idea is simple, since TOR doesn’t support UDP, if you are attacking a machine over TOR, you are running the risk that you query the DNS with your real IP while attacking the machine over TOR. A simple time base mapping between the DNS and your server log can identify your real IP. It is really so risky.
Luckily TOR has a Tor-resolve comes to secure.
We need to add the following lines in /etc/tor/torrc
DNSPort 53 AutomapHostsOnResolve 1
Next, we have to config the Linux to use 127.0.0.1 port 53 as the DNS Server instead of the one applied by DHCP in /etc/resolv.conf
Set the Firefox to use this DNS instead of the client default one
open about:config set network.proxy.socks_remote_dns to true.