The recent distributed denial of service attack is said to have been caused by the Mirai botnet which basically turns IoT devices in attackers. One of the devices that is vulnerable is an IP camera that has a default username and password. While I don’t have that brand of camera, my cameras have accounts that I can’t remove and apparently one ONVIF account with a username/password that can’t be changed. I’m pretty good at securing my network from people coming in, but what about things going out? A lot of these IoT devices talk to a server for firmware updates or whatever. Since my IP cameras only need to talk to my server that is recording video, there is absolutely no need for them to connect to the Internet. I decided to see what I could do to isolate the traffic; this is something I’ve wanted to do for 3.5 years ever since I got a Cisco router that did VLANs, but couldn’t figure out a reason and didn’t have the knowledge to do it. However, times have changed.
In my case, I now have managed switches UniFi Switch 8 and the 16 port version as well as an EdgeRouter Lite. Using this equipment, I was easily able to separate out the camera traffic on a VLAN that has no access to the Internet. Here’s what I did:
- On the EdgeRouter Lite, setup a new VLAN. From the Dashboard, click on Add Interface and then Add VLAN.
- Setup the VLAN similar to the picture. The 1002 is the VLAN ID. Select the Interface for your LAN port. Enter the IP address for this subnet.
- Click Save.
- Switch to the Firewall/NAT tab. Select Firewall Policies.
- Click Add Ruleset.
- Set it up similar to this picture.
. Repeat for CAMERAS_OUT and CAMERAS_LOCAL (in is for data coming from the camera subnet, out is for data going to the camera subnet, and local is data to and from the router.
- After the rules are saved, select Actions to the right of the IN rule. Choose Interfaces.
- Select the VLAN (ethernet port + VLAN ID) and the direction. Click on Save Ruleset. Then close the dialog.
- Repeat the above steps for the OUT and LOCAL rulesets.
- IN and OUT are now complete; basically we have just made all traffic from this new VLAN never goto the Internet or receive data from the Internet.
- To the right of the LOCAL ruleset, click on Actions and select Edit Ruleset.
- Click Add New Rule.
- Enter NTP for the description and select Accept. Select UDP for the Protocol.
- Click on Destination. Enter 123 for the port.
- Click Save.
- Create a new rule for DNS using UDP port 53.
- Create a new rule for DHCP using UDP port 67.
- Click Services at the top of the Edge Router interface.
- Click Add DHCP Server.
- Set it up like in this picture.
- After setting up the DHCP server, you may want to Configure Static Map to assign specific IP addresses for each MAC address.
- Before leaving this area, click on DNS and add the VLAN as a Listen Interface and click Save.
- Now move over the UniFi Controller.
- Goto Settings and choose Networks.
- Click Create New Network. Set it up similar to this picture.
- Click save.
- Goto Devices and select the UniFi Switch. Click Ports and locate a port with a camera. Click the Pencil.
- Change the VLAN to the Cameras VLAN. Click save.
- Power cycle that port and the device will come up on the new VLAN.
- On my Mac (the machine recording video), go into Network settings, click the gear and select Manage Virtual Interfaces.
- Click the + button and select New VLAN.
- Enter the VLAN ID for the Tag and give it a name.
- Click Create and then click Done.
- Select the new interface, select Configure IPv4 Manually. Alternatively you can use DHCP.
- Re-configure your security software (in my case SecuritySpy) with the new IP addresses.
- I also changed the NTP address in the cameras to be 10.0.2.1 as the router will now block all traffic trying to go outside. The EdgeRouter Lite happens to be running an NTP server which is quite convenient.
Yes, there are a lot of steps here, but this makes me feel a bit safer. Without a managed switch and a router that can handle VLANs, this would be difficult, if not impossible. Unfortunately most people won’t be able to do this and their IoT devices will be targets. I have no idea how we’re going to solve the problem of IoT devices getting hacked, used to launch hacks, or generally cause havoc on the Internet.
Please let me know if I missed anything or there are any mistakes.