This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| computing:dnshijacks [2026/09/06 02:56] – oemb1905 | computing:dnshijacks [2026/09/08 04:37] (current) – oemb1905 | ||
|---|---|---|---|
| Line 11: | Line 11: | ||
| ------------------------------------------- | ------------------------------------------- | ||
| + | This tutorial is for owner' | ||
| - | **1. Static DHCP leases** | + | {{ : |
| - | LuCI → Network → DHCP and DNS → Static Leases. Establish statics for each camera | + | After your statics are set, the next task is to stop the cameras or IoT devices from directly querying external |
| - | {{ :computing:dhcp.png? | + | * Name: Camera1 |
| + | * Restrict to address family: ipv4 #use what your devices use | ||
| + | * Protocol: TCP + UDP | ||
| + | * Source zone: res #pick your zone/ | ||
| + | * External port: 53 | ||
| + | * Destination zone: Any | ||
| + | * Internal IP address: 172.66.66.150 (ns5.haacksnetworking.org) #redirects traffic to my DNS server, a pihole + unbound | ||
| + | * Internal port: 53 | ||
| + | * Advanced Settings | ||
| + | * Source MAC address: 80: | ||
| - | **2. Port 53/853 intercept for direct udp on either | + | Once this is done, duplicate the rule and change the external port to 853. If your devices listen |
| - | LuCI → Network → Firewall → Port Forwards / Incoming. | + | {{ : |
| - | < | + | In the openWRT tutorial linked at the top, you will see that I use two nameservers for each vlan/ |
| - | - Name: Camera1 | + | |
| - | - Restrict to address family: IPv4 only | + | |
| - | - Protocol: TCP + UDP | + | |
| - | - Source zone: res | + | |
| - | - External port: 53 | + | |
| - | - Destination zone: res | + | |
| - | - Internal IP address: 172.66.66.150 (ns5.haacksnetworking.org) | + | |
| - | - Internal port: 53 | + | |
| - | Advanced Settings | + | * Name: `Camera DoH` |
| - | - Source MAC address: | + | * Family: IPv4 and IPv6 |
| - | 80:48:2C:44:C7:7D | + | |
| - | | + | * Specify the MACs: 80:48:2C:41:69:FF 80: |
| - | | + | * To: zone `wan` |
| - | | + | * IPs to block: 1.1.1.1 1.0.0.1 8.8.8.8 8.8.4.4 9.9.9.9 149.112.112.112 94.140.14.14 94.140.15.15 208.67.222.222 208.67.220.220 185.228.168.9 185.228.169.9 76.76.2.0 76.76.10.0 45.90.28.0 45.90.30.0 2001: |
| - | </ | + | * Ports: 443 853 |
| + | * Action: Drop #or Reject | ||
| - | {{ : | + | 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. Once that's done, you should have a rule that looks something like this: |
| - | I decided to give the first two cams/OIT devices back to ns5 and the other two cams/OIT devices back to ns6. | + | {{ : |
| - | **3. DoH / DoT drop** | + | Now that everything is setup, you need to ensure that there are no leaks. This is easily done with tcpdump on the router. There' |
| - | LuCI → Network → Firewall → Traffic Rules. | + | 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/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 |
| - | - Name: `Camera DoH` | + | |
| - | - Family: IPv4 and IPv6 | + | |
| - | - From: zone `res` | + | |
| - | - Specify the MACs: | + | |
| - | 80:48: | + | |
| - | 80: | + | |
| - | 80: | + | |
| - | 80:48:2C:46:0E:C4 | + | |
| - | - To: zone `wan` | + | 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 |
| - | # Specify | + | |
| - | 1.1.1.1 | + | tcpdump -ni eth1 tcp port 853 and '( host 8.8.8.8 |
| - | 1.0.0.1 | + | |
| - | 8.8.8.8 | + | |
| - | 8.8.4.4 | + | |
| - | 9.9.9.9 | + | |
| - | 149.112.112.112 | + | |
| - | 94.140.14.14 | + | |
| - | 94.140.15.15 | + | |
| - | 208.67.222.222 | + | |
| - | 208.67.220.220 | + | |
| - | 185.228.168.9 | + | |
| - | 185.228.169.9 | + | |
| - | 76.76.2.0 | + | |
| - | 76.76.10.0 | + | |
| - | 45.90.28.0 | + | |
| - | 45.90.30.0 | + | |
| - | - Ports: `443`, `853` | + | I only ran these commands for port 853 because it is impossible to do DoT on port 53. After rebooting the devices a few times and waiting five minutes, I confirmed that there were no DoT requests sneaking out. I had not seen any during initial testing, nor did online sources state that v4 cams were known to do this, but it's harmless to set the logic and better safe than sorry. Now that those leaks were stopped and/or confirmed not happening, it was time to test DoH. Similarly, there were no reports online that Wyze cams using DoH, but there' |
| - | - Action: Drop | + | |
| - | </code> | + | |
| - | {{ :computing:doh.png? | + | tcpdump -ni eth1 tcp port 443 and '( host 8.8.8.8 or host 8.8.4.4 )' |
| + | tcpdump -ni eth1 ip6 and tcp port 443 and '( host 2001:4860:4860::8888 or host 2001: | ||
| + | |||
| + | 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' | ||
| - | Then, once these are setup, confirm using tcpdump | + | |
| + | | ||
| - | tcpdump -ni eth1 udp port 53 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 )' | + | Once everything is set up and you've confirmed you have no leaks, you can return to your pihole dashboard |
| - | tcpdump -ni eth1 '(tcp port 443 or tcp port 853 or udp port 853)' | + | |
| - | tcpdump -ni eth1 ip6 and udp port 53 and '( host 2001: | + | |
| - | tcpdump -ni eth1 ip6 and '(tcp port 443 or tcp port 853 or udp port 853)' and '( host 2001: | + | |
| - | Or, run all at once: | + | {{ :computing: |
| - | < | + | {{ :computing:160.png? |
| - | tcpdump -ni eth1 ' | + | |
| - | ( | + | |
| - | udp port 53 or | + | |
| - | tcp port 443 or | + | |
| - | tcp port 853 or | + | |
| - | udp port 853 | + | |
| - | ) 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 2001:4860:4860::8888 or host 2001: | + | |
| - | host 2606: | + | |
| - | host 2620: | + | |
| - | ) | + | |
| - | ' | + | |
| - | </ | + | |
| - | Or, to just check the cameras | + | For whatever reason, the cams are using FOUR timeservers! Also, despite turning off all cloud-based features, the Wyze cameras |
| + | {{ : | ||
| - | tcpdump -i 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 -n | + | 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' |
| - | Or, just check outbound 53 / 853, direct udp: | + | ------------------------------------------- |
| - | tcpdump -i 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 -n | egrep '(\.53 |\.853 )' | + | === Updates === |
| - | + | ||
| - | Or, check 443 and 853 while stripping the okay stun/turn they need for the app: | + | |
| - | | + | |
| - | + | * forthcoming | |
| - | After catching some leaks due to destination zone being set on 53/853 direct udp, revised this command | + | |
| - | < | + | The simplest command is to see what is happening on the '' |
| - | tcpdump -ni eth1 -vvv -tttt ' | + | |
| - | (host 172.66.66.105 or host 172.66.66.106 or host 172.66.66.107 or host 172.66.66.108) | + | |
| - | and not ( | + | |
| - | udp port 123 or | + | |
| - | (udp portrange 10000-65535 and not udp port 53 and not udp port 853) | + | |
| - | ) | + | |
| - | ' | + | |
| - | </code> | + | |
| - | You have to run tcpdump and bird's eye look at the pihole dashboard initially. You will suddenly see that the direct DNS udp/53 it runs to 8.8.8.8 and 8.8.4.4 that are widely reported are now being intercepted. You confirm on tcpdump by checking the wan outgoing ... to see if anything gets by. You can tell on the piholes because initially you won't see any domains, but as soon as you set up the forwards correctly, you will get a slew of domains popping off: | + | conntrack -L -f ipv4 | grep 172.66.66 |
| - | {{ : | + | To confirm |
| - | {{ :computing: | + | |
| - | For whatever reason, the cams are using FOUR timeservers. I left the .gov one and blocked the rest. No issues. You block those in the domain section | + | 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 | ||
| - | {{ :computing: | + | 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: | ||
| - | Alright, this is an improved version of my prior setup, dedicated to Bender. | + | conntrack -L -f ipv4 -p tcp --orig-port-dst 443 | grep -E '8\.8\.8\.8|8\.8\.4\.4\.' |
| + | conntrack -L -f ipv6 -p tcp --orig-port-dst 443 | grep -Ei ' | ||
| + | |||
| + | Or, query the kernel directly: | ||
| - | Notes: | + | grep -E 'dport=53 |dport=853 |dport=443 |
| - | * Noticed that openWRT was missing some direct outgoing due to des zone being set, removed | + | |
| - | * Added '' | + | 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` | ||
| + | </ | ||
| - | --- // | + | --- // |