This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| computing:dnshijacks [2026/09/06 16:02] – oemb1905 | computing:dnshijacks [2026/09/08 04:37] (current) – oemb1905 | ||
|---|---|---|---|
| Line 11: | Line 11: | ||
| ------------------------------------------- | ------------------------------------------- | ||
| - | This tutorial is for owner' | + | This tutorial is for owner' |
| {{ : | {{ : | ||
| - | After your statics are set, the next task is to stop the cameras or OIT devices from directly querying external DNS servers. Most devices that do this directly contact the upstream DNS IP on either port 53 or port 853. It is true that 853 can be used for DoT - but that's not what we are stopping right now. Here, we are stopping alternate port direct udp DNS queries which can also use 853. To stop outgoing packets on 53 and 853, we use openWRT' | + | After your statics are set, the next task is to stop the cameras or IoT devices from directly querying external DNS servers. Most devices that do this directly contact the upstream DNS IP on either port 53 or port 853. It is true that 853 can be used for DoT - but that's not what we are stopping right now. Here, we are stopping alternate port direct udp DNS queries which can also use 853. To stop outgoing packets on 53 and 853, we use openWRT' |
| * Name: Camera1 | * Name: Camera1 | ||
| * Restrict to address family: ipv4 #use what your devices use | * Restrict to address family: ipv4 #use what your devices use | ||
| * Protocol: TCP + UDP | * Protocol: TCP + UDP | ||
| - | * Source zone: res #pick your zone/ | + | * Source zone: res #pick your zone/ |
| * External port: 53 | * External port: 53 | ||
| * Destination zone: Any | * Destination zone: Any | ||
| Line 43: | Line 43: | ||
| * Action: Drop #or Reject | * Action: Drop #or Reject | ||
| - | Once that's done, you should have a rule that looks something like this: | + | The rule above includes both port 443 and 853. The inclusion of 853 is not for DoH, rather, it is included as an extra pre-caution for DoT. It's harmless to include and just in case a port forward for 853 DoT fails to work, this drop rule ensures that cams / IoT devices can't contact any of these IPs for DoT. The DoH is covered by 443 and the IPs specified are just the most common (Google, Cloudflare, etc.). One can and should monitor this list and include others; consult online sources for a comprehensive list and/or dedicated repository. |
| {{ : | {{ : | ||
| - | Now that everything is setup, you need to ensure that there are no leaks. This is easily done with tcpdump on the router. There' | + | Now that everything is setup, you need to ensure that there are no leaks. This is easily done with tcpdump on the router. There' |
| tcpdump -ni br-lan.179 host 172.66.66.105 or host 172.66.66.106 or host 172.66.66.107 or host 172.66.66.108 | egrep '(\.53 |\.853 )' | tcpdump -ni br-lan.179 host 172.66.66.105 or host 172.66.66.106 or host 172.66.66.107 or host 172.66.66.108 | egrep '(\.53 |\.853 )' | ||
| | | ||
| - | This command above will pull out all 53 or 853 outgoing packets and you can see what upstream DNS the cams/OIT device is using. When I began this tutorial, I ran this command first and you could clearly confirm that online reports were correct and the Wyze v4 cams were sending outgoing udp/53 requests to 8.8.8.8 and 8.8.4.4, which are Google' | + | This command above will pull out all 53 or 853 outgoing packets and you can see what upstream DNS the cams/IoT device is using. When I began this tutorial, I ran this command first and you could clearly confirm that online reports were correct and the Wyze v4 cams were sending outgoing udp/53 requests to 8.8.8.8 and 8.8.4.4, which are Google' |
| tcpdump -ni eth1 '(udp port 53 or udp port 853)' and '( host 8.8.8.8 or host 8.8.4.4 )' | tcpdump -ni eth1 '(udp port 53 or udp port 853)' and '( host 8.8.8.8 or host 8.8.4.4 )' | ||
| tcpdump -ni eth1 ip6 and '(udp port 53 or udp port 853)' and '( host 2001: | tcpdump -ni eth1 ip6 and '(udp port 53 or udp port 853)' and '( host 2001: | ||
| - | To be clear, the above command is checking both 53 and 853 for plain text udp requests. Although rare, you can do this on port 853 but do not confuse that with DNS over TLS, which I tested next. To my surprise, I initially saw requests sneaking out. As it turns out, this was because I had wrongly set the destination zone on the hijack to the same zone as the origin. This, however, is wrong because obviously these external IPs are not within the source zone. So, I removed the destination zone and left it as " | + | To be clear, the above command is checking both 53 and 853 for plain text udp requests. Although rare, you can do this on port 853 but do not confuse that with DNS over TLS, which I tested next. To my surprise, I initially saw requests sneaking out. As it turns out, this was because I had wrongly set the destination zone on the hijack to the same zone as the origin. This, however, is wrong because obviously these external IPs are not within the source zone. So, I removed the destination zone and left it as " |
| tcpdump -ni eth1 tcp port 853 and '( host 8.8.8.8 or host 8.8.4.4 )' | tcpdump -ni eth1 tcp port 853 and '( host 8.8.8.8 or host 8.8.4.4 )' | ||
| Line 66: | Line 66: | ||
| tcpdump -ni eth1 ip6 and tcp port 443 and '( host 2001: | tcpdump -ni eth1 ip6 and tcp port 443 and '( host 2001: | ||
| | | ||
| - | If the cams/OIT devices are sending out DoH requests, these commands will spot those leaks. Since I had not seen the Wyze v4 cams ping anything besides Google in testing, I restricted the commands to Google' | + | If the cams/IoT devices are sending out DoH requests, these commands will spot those leaks. Since I had not seen the Wyze v4 cams ping anything besides Google in testing, I restricted the commands to Google' |
| tcpdump -ni eth1 tcp port 443 and '(host 8.8.8.8 or host 8.8.4.4 or host 1.1.1.1 or host 1.0.0.1 or host 9.9.9.9 or host 149.112.112.112 or host 94.140.14.14 or host 94.140.15.15 or host 208.67.222.222 or host 208.67.220.220 or host 185.228.168.9 or host 185.228.169.9)' | tcpdump -ni eth1 tcp port 443 and '(host 8.8.8.8 or host 8.8.4.4 or host 1.1.1.1 or host 1.0.0.1 or host 9.9.9.9 or host 149.112.112.112 or host 94.140.14.14 or host 94.140.15.15 or host 208.67.222.222 or host 208.67.220.220 or host 185.228.168.9 or host 185.228.169.9)' | ||
| tcpdump -ni eth1 ip6 and tcp port 443 and '(host 2001: | tcpdump -ni eth1 ip6 and tcp port 443 and '(host 2001: | ||
| - | Once everything is set up and you've confirmed you have no leaks, you can return to your pihole dashboard and start evaluating urls that the cameras/OIT devices are contacting. Prior to this, the dashboard was empty, but now that direct udp on 53/853, DoT on 853, and DoH on 443 are all either hijacked or dropped, you should see it fill up nicely. Here's a shot from each pihole, ns5 and ns6, after a few minutes. | + | Once everything is set up and you've confirmed you have no leaks, you can return to your pihole dashboard and start evaluating urls that the cameras/IoT devices are contacting. Prior to this, the dashboard was empty, but now that direct udp on 53/853, DoT on 853, and DoH on 443 are all either hijacked or dropped, you should see it fill up nicely. Here's a shot from each pihole, ns5 and ns6, after a few minutes. |
| {{ : | {{ : | ||
| {{ : | {{ : | ||
| - | For whatever reason, the cams are using FOUR timeservers! Also, despite turning off all cloud-based features, the Wyze cameras continually ping home to '' | + | For whatever reason, the cams are using FOUR timeservers! Also, despite turning off all cloud-based features, the Wyze cameras continually ping home to '' |
| {{ : | {{ : | ||
| - | So far, the piholes have not caught the v4s phoning home to any of these domains, but better safe than sorry. I also left four different tabs open in Terminator all night to confirm that nothing was sneaking out the wan interface that shouldn' | + | So far, the piholes have not caught the v4s phoning home to any of these domains, but better safe than sorry. I also left four different tabs open in Terminator all night to confirm that nothing was sneaking out the wan interface that shouldn' |
| ------------------------------------------- | ------------------------------------------- | ||
| - | == **Updates** == | + | === Updates |
| - | One can | + | * Installed conntrack on openWRT in order to confirm forwards and drops via kernel DRAFT |
| + | * forthcoming | ||
| - | --- // | + | The simplest command is to see what is happening on the '' |
| + | |||
| + | conntrack -L -f ipv4 | grep 172.66.66 | ||
| + | |||
| + | To confirm direct udp 53/853 hijacks: | ||
| + | |||
| + | conntrack -L -f ipv4 -p udp --orig-port-dst 53 | ||
| + | conntrack -L -f ipv4 -p udp --orig-port-dst 853 | ||
| + | conntrack -L -f ipv6 -p udp --orig-port-dst 53 | ||
| + | conntrack -L -f ipv6 -p udp --orig-port-dst 853 | ||
| + | |||
| + | To confirm hijacks of DoT: | ||
| + | |||
| + | conntrack -L -f ipv4 -p tcp --orig-port-dst 853 | ||
| + | conntrack -L -f ipv6 -p tcp --orig-port-dst 853 | ||
| + | |||
| + | To confirm drops of DoH requests: | ||
| + | |||
| + | conntrack -L -f ipv4 -p tcp --orig-port-dst 443 | grep -E ' | ||
| + | conntrack -L -f ipv6 -p tcp --orig-port-dst 443 | grep -Ei ' | ||
| + | |||
| + | Or, query the kernel directly: | ||
| + | |||
| + | grep -E ' | ||
| + | |||
| + | Also, one can layer 7 domain block these common DoH domains. This won't stop cams / IoT devices from using IPs, but it stops them from using domains: | ||
| + | |||
| + | < | ||
| + | `doh.dns.apple.com mask.icloud.com mask-h2.icloud.com dns.google dns.google.com google.dns dns64.dns.google cloudflare-dns.com mozilla.cloudflare-dns.com security.cloudflare-dns.com family.cloudflare-dns.com one.one.one.one 1dot1dot1dot1.cloudflare-dns.com dns.quad9.net dns10.quad9.net dns11.quad9.net dns.adguard.com dns-family.adguard.com dns.adguard-dns.com unfiltered.adguard-dns.com family.adguard-dns.com doh.opendns.com doh.familyshield.opendns.com doh.sandbox.opendns.com dns.nextdns.io firefox.dns.nextdns.io anycast.dns.nextdns.io dns.mullvad.net adblock.dns.mullvad.net base.dns.mullvad.net family.dns.mullvad.net unfiltered.dns.mullvad.net freedns.controld.com p0.freedns.controld.com p1.freedns.controld.com p2.freedns.controld.com p3.freedns.controld.com dns.sb doh.dns.sb doh.cleanbrowsing.org security-filter-dns.cleanbrowsing.org family-filter-dns.cleanbrowsing.org adult-filter-dns.cleanbrowsing.org dns.switch.ch doh.pi-dns.com doh.appliedprivacy.net odoh.cloudflare-dns.com` | ||
| + | </ | ||
| + | |||
| + | --- // | ||