My Dahua NVR5432 was hacked last week!

MakeItRain

Pulling my weight
Aug 7, 2017
405
218
It finally happened but I'm not sure how it happened because I consider myself somewhat a bit savvy with networking. It took 5 years before a breach occurred. The intruder had four admin accounts created:
"hackedBy", so and so. They also deleted all my 'user' accounts with basic privilege. They left the admin account. The password is strong on that. All cameras are working fine and they did not blank them. I am running V4.00 Build 2019-08-09 firmware.

I always use OpenVPN when I'm outside (hotels, coffee shops) to connect back home.

1. Google Fiber (Google Wifi router/puck)
- No port forwarding enabled other than port 1194 - to a Raspberry Pi for OpenVPN.

2. OpenVPN server (running on Raspberry Pi).
Raspberry Pi requires a SSH private key to login (Otherwise, all login rejected).

3. NVR dual-NIC. One subnet on NIC1 is connected to the same subnet as the Raspberry Pi and the rest of the home network. NIC2 is for the cameras. I specifically forced the NVR's gateway to point the Raspberry Pi. That way all traffic gets routed to the Rasberry Pi instead of the Google Wifi Gatway. But I think that is not safe, as I come to realize.

4. Yes, UPNP is disabled in Google Wifi Router. P2P also disabled in the NVR.

5. The Raspberry Pi then has IP Tables set up like this to drop ALL packets:
sudo iptables -A FORWARD -s 192.168.0.10 -p tcp -o eth0 -j DROP
sudo iptables -A FORWARD -s 192.168.0.10 -p udp -o eth0 -j DROP
sudo iptables -A FORWARD -s 192.168.0.10 -o eth0 -j DROP

So my only guess as to how they got in are the following:

1. Another IoT device connected as the same subnet allowed them to get into the NVR. So maybe my Alexa's are compromised.
2. There is malicious firmware in the NVR that disregards what the gateway IP is set at and regardless attempts to try all ranges within that subnet. When it finds one, it phones home with P2p re-opened.

Another thing I am observing now is my NVR firmware is probably compromised. When I reboot the system, it recalls the old static IP address from which I set it to, and the old gateway, and get this! It enables P2P!! Why???
 
You might also ask how did I discover this?

Well one night my NVR was rebooting 4 times. So they were trying to reboot it.

Then also they set max user connections from 128 to 0. So effectively, all my user level accounts were locked out (only admin account could get in). That’s when I knew something was fishy as I checked the logs to confirm these events.
 
key logger / trojan / malware on any computer (especially Windows)..

Milions people don't even know that theirs computers are infected..
I’m not going to dispute that. I run Windows 11 with BitLocker by default. malware is certainly a possibility but windows scan didn’t detect anything. I’ll try a stronger scanner.

what version of NVR?
what firmware it had?
They very early version or V4.0. Build 08/09/2019. Perhaps they used the login bypass hack? Sure.

NVR is Hardware 1.0
 
Man, this is 5 years old firmware..
It can have teens of bugs usable to break-in which were fixed in more recent firmware’s
Yeah. But what happened to the ipcamtalk philosophy of “Don’t update fw if you don’t have to or it’ll brick it?”
Lol
 
Yeah. But what happened to the ipcamtalk philosophy of “Don’t update fw if you don’t have to or it’ll brick it?”
Lol

That is for devices that don't have access to the internet.

Somehow yours is.

I am guessing in your attempt to add complexity to isolate it, it left a gapping hole to the internet that gave the NVR access to a backdoor exploit.
 
Yeah. But what happened to the ipcamtalk philosophy of “Don’t update fw if you don’t have to or it’ll brick it?”
Lol


it's wrong philosophy..
the implications of a hack/data theft are greater than the mega rare implications of a firmware/software upgrade bricking the device or causing a regression.

of course in Your case, when you have 5 years old firmware on device, this can be more serious.
but this problem is created by Your negligence.
 
  • Like
Reactions: looktall
ps. openvpn (and openssl on which it is based) have long history of serious bugs, which can be used to break-in into server..
And You have open port to it...

I recommend migrating to wireguard.
Due to the simplicity of implementation (less than 10k lines of very clean and fresh source code with all used algorithms vs 500k+70k in openssl + openvpn case with 20+ years in code history) it has a much lower chance of finding holes that can be exploited for hacking..

it has also a much better VPN performance, which can be good for rasp-pi.. and nicer clients...
 
  • Like
Reactions: bigredfish