OPNsense Forum

English Forums => Zenarmor (Sensei) => Topic started by: Fawkesguy on March 21, 2021, 02:58:17 am

Title: "Block DNS Tunneling"
Post by: Fawkesguy on March 21, 2021, 02:58:17 am
Anyone know when we might see this feature implemented?

Title: Re: "Block DNS Tunneling"
Post by: mimugmail on March 21, 2021, 06:40:57 am
I'd guess never since DoT and DoH
Title: Re: "Block DNS Tunneling"
Post by: chemlud on March 21, 2021, 11:41:33 am
Hmm, for DoT you simply block anything on port 853, but for DoH you need a list of DNS servers (which will hardly be complete and always up to date).

So: basically the DoH protocol killed DNS "security"/surveilance (choose which side you're on ;-) )
Title: Re: "Block DNS Tunneling"
Post by: Supermule on March 21, 2021, 11:44:04 am
Disable port 853 and launch a MITM using Unbound and only access via  port 53.

Force your clients to use root DNS via unbound and your fine.
Title: Re: "Block DNS Tunneling"
Post by: chemlud on March 21, 2021, 11:56:00 am
Disable port 853 and launch a MITM using Unbound and only access via  port 53.

Force your clients to use root DNS via unbound and your fine.

MITM using unbound? How should that prevent DNS-over-HTTPS?
Title: Re: "Block DNS Tunneling"
Post by: Greelan on March 21, 2021, 12:11:36 pm
DNS tunneling is a potential issue even with normal DNS, if what the OP means is using the DNS protocol to pass malicious data in DNS responses. I guess Suricata could help with that by providing alerts for or blocking potentially malicious domains
Title: Re: "Block DNS Tunneling"
Post by: Supermule on March 21, 2021, 01:01:23 pm
Disable port 853 and launch a MITM using Unbound and only access via  port 53.

Force your clients to use root DNS via unbound and your fine.

MITM using unbound? How should that prevent DNS-over-HTTPS?

Do we agree that using Unbound as a DNS resolver and the clients using it, will reveal the DNS requests and therefore beeing able to block the dangerous ones??

Your HTTPS DNS request still needs a GW and a resolver.
Title: Re: "Block DNS Tunneling"
Post by: Fawkesguy on March 21, 2021, 04:48:51 pm
I'd guess never since DoT and DoH

Then I wonder why they put these in the GUI?

(https://i.gyazo.com/0536f0d7901c31dd5f2d4f71049e6d54.png)
Title: Re: "Block DNS Tunneling"
Post by: chemlud on March 21, 2021, 05:22:58 pm
Your HTTPS DNS request still needs a GW and a resolver.

Hmm, how do you want to pick out a DNS request from your port 443 traffic? You would have to block all DNS-over-HTTPS servers, which will be hard to maintain...
Title: Re: "Block DNS Tunneling"
Post by: chemlud on March 21, 2021, 05:27:01 pm
I'd guess never since DoT and DoH

Then I wonder why they put these in the GUI?

(https://i.gyazo.com/0536f0d7901c31dd5f2d4f71049e6d54.png)

That's fawke news ;-p
Title: Re: "Block DNS Tunneling"
Post by: Fawkesguy on March 21, 2021, 06:03:59 pm
That's fawke news ;-p

LOL, probably!  It seems impossible, but since the developers included it in the GUI, I figured I'd ask.   :)
Title: Re: "Block DNS Tunneling"
Post by: Greelan on March 21, 2021, 08:18:06 pm
They are Sensei menu items. Ask the Sensei guys (they also spend time here)
Title: Re: "Block DNS Tunneling"
Post by: mimugmail on March 22, 2021, 11:05:52 am
Yeah, what I meant was doing this with open source in a stable manner. Blocking 853 doesn't help when you have a VPS and using a different port. Also a growing list of public DoH servers in not trustworthy since you can host your DNScrypt server in a VPS.
Title: Re: "Block DNS Tunneling"
Post by: mb on March 22, 2021, 08:00:02 pm
Quite a productive discussion here. Thanks to all who contributed.

There are two types of "tunnelling" involving DNS; both of which are a topic of interest since they might be used for tunnelling malicious traffic:

1. Tunnelling of Internet traffic over DNS protocol
2. Tunnelling of DNS protocol over HTTPS protocol

Former: attackers disguise their traffic as if it was a legitimate DNS traffic. Latter, they disguise their DNS traffic over HTTPS so that network detection/prevention mechanisms do not have visibility over their DNS activity.

With TLS 1.3, where the SNI information can also be encrypted, DNS visibility had become important; however, with DoH, this visibility is also lost, as Michael mentioned, they can easily launch their DoH over a $5/mo VPS.

The "Block DNS Tunnels" option in the Sensei Security menu was meant to solve the first type, meaning detecting Internet traffic which is disguised as DNS traffic. We've introduced an implementation which is dealing with this. If you see "Non-standard DNS traffic" in your Sensei Live Session Logs (Connection Details / Tags) -> , this is a powerful indication of such activity. This feature is still under development; and still needs further testing before we announce the public availability).

Having said that, based on our discussions with Sensei users/customers; We've seen that the latter has become more of  a pressing problem. A malware communicating with its C&C via DoH and TLS 1.3 + SNI encryption can easily bypass all detection mechanisms. No matter which big brand you are using. This is an industry problem right now.

So we've also moved our focus to the second type.

What is our approach to this problem:

Our methodology can be summarized as "Rise from where you fell": gaining visibility where we lost it originally.
Technically speaking, we want to provide the user with the ability to:

1. create acceptable use policies with regard to DoH protocol
2. enforce all DNS traffic over his/her own DoH/DoT system.
3. gain visibility over encrypted/cleartext traffic which is destined for unknown/new/low-reputation sites (TLS inspection capability)

All of the items are being actively worked on right now. We hope to roll them out this year.
Title: Re: "Block DNS Tunneling"
Post by: Fawkesguy on March 22, 2021, 09:19:57 pm
Thank you for that very thorough reply.  The ability to block DoH will be great, when it becomes available.   :)
Title: Re: "Block DNS Tunneling"
Post by: mb on March 23, 2021, 10:14:36 pm
@Fawkesguy - my pleasure.

You already have that option now. It blocks our list of DoH systems. Just block "DNS over HTTPS" application under Network Management Category under App Controls.

For custom DoH systems, we'll be employing aforementioned mechanisms.
Title: Re: "Block DNS Tunneling"
Post by: allebone on April 09, 2021, 03:12:07 am
I tested with the firefox built in dns over https option and this policy blocks it in sensei already: