How to block DNS queries with only 1 config file

Hello everyone, this is IRISnoir from Hackingarise. Bringing to you another tutorial. Today, I will discuss about DNS query blocking.

But first, if you don’t know what DNS is or what they even mean, you should take a look at this. Also read this too if you want to understand what I’m babbling about.

Now, Malwares can use this to their advantage if you don’t know how to self secure. Luckily, this is why I am here, as a friend, to help you.

Now, what you need to do is to edit this configuration file:
/etc/hosts
Yes. This bad boy right here.

But before that, the requirements must meet:
– R0OT privilege
– Mounted READ-WRITE on /SYSTEM
– A text editor (Captain obvious)
And that’s about it. But missing any of these will lead to failure.

First, getting Root privilege is relatively easy.
Next, mounting read-write is with this command:
mount -o rw,remount /system
If you want to mount it back to read-only then use:
mount -o ro,remount /system

You need root and /system mounted read-write in order to edit this file.

If the requirements meet, you can edit the file:
Use your text editor on /etc/hosts

And no, not /data/data/com.termux/files/usr/etc

After opening the editor, you can see:
127.0.0.1 localhost
What you wanna do to secure yourself from bad places is to add:
0.0.0.0 example.com

Now, for example, example.com is a bad, bad place that will do something malicious to you if you enter it. You can do this to secure yourself from it. When you accidentally press it with your fat fingers, it won’t do anything or give a virus.

The /etc/hosts file will always be read before a DNS query is made. The system will personally conduct it. If a DNS query is approved, you can view the site and vice versa, but if it is denied, the site will look like it’s not even alive and up and you will be presumed dead to them.

System: NEXT!
youtube.com: Can I come in?
System: SURE, HAVE A NICE DAY WITH OUR USER.

System: NEXT!
serveo.net: Can I come in?
System: ENTRY DENIED, GET LOST!

I hope that you find this useful. If you do, why not share it with your friends. Remember, stay safe and ethical as we are NOT responsible for any of your malicious acts.

pentester

Leave a Reply

Your email address will not be published. Required fields are marked *