UniFi - USG/UDM: Configuring Internet Security Settings


Overview


After reading this article users should gain the knowledge to be able to configure and maintain the IPS/IDS functionality on their UniFi networks. 

NOTES & REQUIREMENTS: 
Applicable to the following:
  • UniFi Network Controller software version 5.9+
  • UniFi Security Gateway platform firmware 4.4.18+
  • UniFi Dream Machine platform
The configuration in this article refers to settings found in the UniFi Network Controller's beta settings. These new settings can be enabled by clicking "Try New Settings" at the top of the "classic settings" menu list. new.settings.png

 


Table of Contents


  1. Introduction
  2. Network Diagram
  3. Intrusion Detection and Prevention
    1. Categories
    2. Whitelisting
    3. Signature Suppression 
  4. GeoIP Filtering
  5. DNS Filters 
    1. Filter Levels
  6. Deep Packet Inspection
    1. DPI Restrictions (Layer 7 Filters)
  7. Network Scanners
    1. Endpoint Scanner
    2. Internal Honeypot
      1. Honeypot Services
  8. Testing & Verification
  9. Privacy Statement
  10. Related Articles

Introduction


Back to Top

An intrusion prevention system (IPS) is an engine that identifies potentially malicious traffic based on signatures. The signatures contain known traffic patterns or instruction sequences used by malware. This type of signature-based engine can only detect anomalies based on known malicious traffic patterns.


Network Diagram


Back to Top

idsIps.png

 


Intrusion Detection and Prevention


Back to Top

To enable intrusion detection or intrusion prevention, navigate to the New Settings > Internet Security section of the UniFi Network controller. 

ATTENTION:
  • Enabling IDS or IPS will affect the maximum throughput on inter-VLAN and egress traffic.
    • USG: 85 Mbps*
    • USG-Pro: 250 Mbps*
    • USG-XG: 1 Gbps*
  • Enabling Smart Queues or DPI on top of IPS/IDS will also incur a further throughput penalty to maximum throughput.
  • UniFi Dream Machine throughput: 850 Mbps*
  • UniFi Dream Machine Pro: 3.5Gbps*

*Values are rough estimates and can vary depending on configuration.

Threat Management Modes

  • Intrusion Detection System: When set will automatically detect, and alert, but will not block potentially malicious traffic. 
  • Intrusion Prevention System: When set will automatically detect, alert, and block potentially malicious traffic. 

Firewall Restrictions

These restrictions can be found under New Settings > Internet Security > Advanced.

  • Restrict Access to ToR: When enabled will block access to The Onion Router. 
  • Restrict Access to Malicious IP Addresses: When enabled will block access to IP addresses or blocks of addresses that have been recognized as passing malicious traffic. 

System Sensitivity Levels

mceclip3.png

The "system sensitivity levels" are pre-defined levels of security categories that will be loaded into the threat management daemon. Each level increase requires more memory and CPU usage. Additionally the "custom" level is utilized when manually selection categories.

Categories

ATTENTION:
  • Due to the amount of available memory on the USG3 and UDM a limited selection of categories can be enabled.
  • Click below to see a full list of categories.

Categories and Their Definitions

Click Here to Expand the IPS/IDS Categories Section
  • Activex: Attacks and vulnerabilities(CVE, etc.) regarding ActiveX.
  • Attack Response: Responses indicative of intrusion—LMHost file download, certain banners, Metasploit Meterpreter kill command detected, etc. These are designed to catch the results of a successful attack. Things like "id=root", or error messages that indicate a compromise may have happened.
  • Botcc (Bot Command and Control)*: These are autogenerated from several sources of known and confirmed active Botnet and other Command and Control hosts. Updated daily, primary data source is Shadowserver.org. Bot command and control block rules generated from shadowserver.org, as well as spyeyetracker, palevotracker, and zeustracker. Port grouped rules offer higher fidelity with destination port modified in rule.
  • CIArmy: Collective Intelligence generated IP rules for blocking based upon www.cinsscore.com.
  • Compromised: This is a list of known compromised hosts, confirmed and updated daily as well. This set varied from a hundred to several hundred rules depending on the data sources. This is a compilation of several private but highly reliable data sources.
  • DNS*: Rules for attacks and vulnerabilities regarding DNS. Also the category for abuse of the service for things such as tunneling.
  • DOS: Denial of Service attempt detection. Intended to catch inbound DOS activity and outbound indications.
  • Dshield*: IP based rules for Dshield Identified attackers. Daily updated list of the DShield top attackers list. Also very reliable. More information can be found at http://www.dshield.org.
  • Exploit*: Exploits that are not covered in a specific service category. Rules to detect direct exploits. Generally, if you're looking for a Windows exploit, Veritas, etc, they'll be here. Things like SQL injection and the like, while they are exploits, have their own category.
  • FTP: Rules for attacks, exploits, and vulnerabilities regarding FTP. Also includes basic none malicious FTP activity for logging purposes, such as login, etc.
  • Games: Rules for the Identification of gaming traffic and attacks against those games. World of Warcraft, Starcraft, and other popular online games have sigs here. We don't intend to label these things evil, just that they're not appropriate for all environments.
  • ICMP: Rules for attacks and vulnerabilities regarding ICMP. Also included are rules detecting the basic activity of the protocol for logging purposes.
  • IMAP: Rules for the identification, as well as attacks and vulnerabilities regarding the IMAP protocol. Also included are rules detecting the basic activity of the protocol for logging purposes.
  • Malware*: Malware and Spyware related, no clear criminal intent. The threshold for inclusion in this set is typically some form of tracking that stops short of obvious criminal activity. This set was originally intended to be just spyware. That's enough to several rule categories really. The line between spyware and outright malicious bad stuff has blurred too much since we originally started this set. There is more than just spyware in here, but rest assured nothing in here is something you want running on your net or PC. There are URL hooks for known update schemed, User-Agent strings of known malware, and a load of others.
  • Misc.: Miscellaneous rules for those rules not covered in other categories.
  • Mobile Malware*: Specific to mobile platforms: Malware and Spyware related, no clear criminal intent.
  • Netbios: Rules for the identification, as well as attacks, exploits, and vulnerabilities regarding Netbios. Also included are rules detecting the basic activity of the protocol for logging purposes.
  • P2P*: Rules for the identification of Peer-to-Peer traffic and attacks against. Including torrents, edonkey, Bittorrent, Gnutella, Limewire, etc. We're not labeling these things malicious, just not appropriate for all networks and environments.
  • POP3: Rules for the identification, as well as attacks and vulnerabilities regarding the POP3 protocol. Also included are rules detecting the basic activity of the protocol for logging purposes.
  • RPC: RPC related attacks, vulnerabilities, and protocol detection. Also included are rules detecting the basic activity of the protocol for logging purposes.
  • Scan: Things to detect reconnaissance and probing. Nessus, Nikto, portscanning, etc. Early warning stuff.
  • Shellcode*: Remote shellcode detection. Remote shellcode is used when an attacker wants to target a vulnerable process running on another machine on a local network or intranet. If successfully executed, the shellcode can provide the attacker access to the target machine across the network. Remote shellcodes normally use standard TCP/IP socket connections to allow the attacker access to the shell on the target machine. Such shellcode can be categorized based on how this connection is set up: if the shellcode can establish this connection, it is called a "reverse shell" or a connect-back shellcode because the shellcode connects back to the attacker's machine.
  • SMTP: Rules for attacks, exploits, and vulnerabilities regarding SMTP. Also included are rules detecting the basic activity of the protocol for logging purposes.
  • SNMP: Rules for attacks, exploits, and vulnerabilities regarding SNMP. Also included are rules detecting the basic activity of the protocol for logging purposes.
  • SpamHaus*: This ruleset takes a daily list of known spammers and spam networks as researched by Spamhaus
  • SQL: Rules for attacks, exploits, and vulnerabilities regarding SQL. Also included are rules detecting the basic activity of the protocol for logging purposes.
  • TELNET: Rules for attacks and vulnerabilities regarding the TELNET service. Also included are rules detecting the basic activity of the protocol for logging purposes.
  • TFTP: Rules for attacks and vulnerabilities regarding the TFTP service. Also included are rules detecting the basic activity of the protocol for logging purposes.
  • TOR*: IP Based rules for the identification of traffic to and from TOR exit nodes.
  • Trojan: Malicious software that has clear criminal intent. Rules here detect malicious software that is in transit, active, infecting, attacking, updating, and whatever else we can detect on the wire. This is also a highly important ruleset to run if you have to choose.
  • User Agents*: User agent identification and detection.
  • VOIP: Rules for attacks and vulnerabilities regarding the VOIP environment. SIP, h.323, RTP, etc.
  • Web Client: Web client-side attacks and vulnerabilities.
  • Web Server: Rules for attacks and vulnerabilities against web servers.
  • Web Apps: Rules for very specific web applications.
  • WORM*: Traffic indicative of network-based worm activity

* Identifies categories that can be enabled on the USG3 and UDM (base model).  

The link to the PDF where these categories are described can be found here.

 

NOTE: The following configuration can be found in the Advanced tab of Internet Security.

Whitelisting

The whitelisting function of the IPS engine allows a UniFi Administrator to create a list of trusted IP's. The traffic, depending on the direction selected, will not get blocked to or from the identified IPs. 

In the screenshot below traffic to or from the subnet 100.64.0.0/16 will not be tracked by the IPS engine. 

mceclip3.png

Signature Suppression

The signature suppression function of the IPS engine allows a UniFi Administrator to mute the alerting on certain signatures. This will also disable blocking on traffic matching the designated suppression rule. 

mceclip2.png

  • Adding a signature suppression rule for all traffic will suppress the signature regardless of host IP. 
  • Adding a signature suppression rule with packet tracking based on traffic direction and by single IP, defined UniFi Network, or subnet of choice. 

GeoIP Filtering


Back to Top

NOTE: For GeoIP Filtering to work on the USG, hardware offloading must be enabled. When Threat Management is enabled (under Settings > Internet Security > Threat Management), hardware offloading is disabled. Only one of these two features can be enabled at a time on the USG.

Blocking

Blocking individual countries can be configured on the Threat Management Dashboard section of the controller. Blocking is as easy as navigating to the map, clicking on a country, and confirming by clicking "Block".

mceclip0.png

Unblocking

Unblocking a country can be by performed on the Threat Management Dashboard by navigating to the left side of the map on the Overview tab. A list of blocked countries will be populated. Simply hover over the county that is to be unblocked and an "unblock" option will appear. Select "unblock" and the country will be taken off of the list. 

mceclip1.png

Traffic Direction

The UniFi Network controller allows configuring the GeoIP filtering traffic direction. Follow the steps below:

    1. Navigate to the top of the Threat Management Dashboard and select the direction. Screen_Shot_2019-11-21_at_3.58.16_PM.png

    2. Select the traffic direction.

Screen_Shot_2019-11-21_at_4.00.26_PM.png

    3. Click Done.


DNS Filters


Back to Top

ATTENTION: 
  • DNS Filtering is only available on the UniFi Dream Machine. 
  • Clients that use VPN, DNS-over-HTTPS, or DNS-over-TLS will have non-standard DNS requests that will not be seen by the UniFi Dream Machine. 

The DNS Filter feature allows administrators to select levels of filtering per-network. This ensures that any DNS requests that go out from clients on configured LANs adhere to the filtering levels. 

    1. To configure DNS Filters, navigate to New Settings > Internet Security > DNS Filters.

mceclip0.png

    2. Enable DNS Filtering by clicking the slider button.

    3. Select Add Filter.

    4. Choose the desired level of filtering for the LAN. 

    5. Select which network this filter should apply to and confirm the selection. 

    6. DNS filtering will be enabled at this point. 

Filter Levels

Security

Blocks access to phishing, spam, malware, and malicious domains. The database of malicious domains is updated hourly. Note that it does not block adult content.

Adult

Blocks access to all adult, pornographic and explicit sites. It does not block proxy or VPNs, nor mixed-content sites. Sites like Reddit are allowed. Google and Bing are set to the "Safe Mode". Malicious and Phishing domains are blocked.

Family

Blocks access to all adult, pornographic and explicit sites. It also blocks proxy and VPN domains that are used to bypass the filters. Mixed content sites (like Reddit) are also blocked. Google, Bing, and Youtube are set to the Safe Mode. Malicious and Phishing domains are blocked.


Deep Packet Inspection


Back to Top

To configure Deep Packet Inspection (DPI) navigate to New Settings > Internet Security > Deep Packet Inspection.

mceclip1.png

NOTE: Device fingerprinting is not available on the UniFi Security Gateway.

DPI Restrictions

ATTENTION: DPI restrictions are limited to whole-category selections on the UniFi Security Gateway. This restriction is not applicable to the UniFi Dream Machine platform. 

    1. Click Add Restriction under "Restriction definitions".

    2. In the configuration side-panel select a restriction group to add the rules to.

    3. Select a category to block. 

    4. Select an application from the category or select "All applications" to block the entire category.

    5. Ensure that "Enable This Restriction" is selected.

    6. Add the restriction group to a network in the "Restriction assignments" section. 

NOTE: A restriction definition can be applied to many networks. A restriction definition for each network is not required.

To manage the restriction definition, hover over the definition and selection either edit or remove.

mceclip2.png


Configuring Network Scanners


Back to Top

ATTENTION: Network Scanners are only available on the UniFi Dream Machine. 

Endpoint Scanner

The "endpoint scanner" feature automatically scans the clients on all LANs for the following information:

  • IP address
  • Operating system (best effort)
  • Open ports
NOTE: Not all clients will have open ports or return a detectible operating system. 

Scan reports can be found on the Threat Management Dashboard

Internal Honeypot

The "internal honeypot" feature is a passive detection system that listens for LAN clients attempting to gain access to unauthorized services or hosts. Clients that are potentially infected with worm or exfiltration type vulnerabilities are known to scan networks, infect other hosts, and potentially snoop for information on easy-to-access servers. The honeypot will report when hosts attempt to access the honeypot. Reports can be found on the Threat Management Dashboard.

To configure the internal honeypot follow the steps below:

    1. Navigate to New Settings > Internet Security > Network Scanners.

mceclip4.png

    2. Enable the honeypot service by clicking the slider button.

    3. Select "Add Honeypot".

    4. In  the popup modal select the network and Honeypot IP.

    5. Select "Create".

Honeypot Services

The honeypot service listens on the following ports:

  • FTP - TCP Port 21
  • SSH - TCP Port 22
  • Telnet - TCP Port 23
  • SMTP - TCP Port 25
  • DNS - UDP Port 53
  • HTTP - TCP Port 80
  • POP3 - TCP Port 110
  • SMB - TCP Port 445
  • MSSQL - TCP Port 1443

Testing & Verification


Back to Top

Intrusion Detection/Prevention

Linux or macOS

Input:

curl -A "BlackSun" www.example.com

Expected controller alert result:

Threat Management Alert 1: A Network Trojan was Detected. Signature ET USER_AGENTS Suspicious User Agent (BlackSun). From: 192.168.1.172:55693, to:172.217.4.196:80, protocol: TCP

Windows

The DNS category must be enabled

Input:

nslookup blacklistthisdomain.com 8.8.8.8

Expected controller alert result:

Threat Management Alert 1: A Network Trojan was Detected. Signature ET DNS Reply Sinkhole - 106.187.96.49 blacklistthisdomain.com. From: 192.168.1.1:53, to: 192.168.1.182:61440, protocol: UDP

Internal Honeypot

A few examples of manually testing the internal honeypot service are below. The following commands may or may not prompt for login credentials. The alerts will appear in the Honeypot section of the Threat Management Dashboard a few minutes after attempting the testing.

Telnet:

telnet <honeypot_ip>

SSH:

ssh <honeypot_ip>
NOTE: Replace <honeypot_ip> with the honeypot IP configured in the controller.

Privacy Statement


What information does the IPS/IDS engine send to the cloud?

1. When a UniFi Administrator enables IPS or IDS on the controller a token is generated for the gateway. The information listed below is sent over a TLS 1.2 encrypted connection whenever there is an IPS/IDS signature match.

timestamp
interface
source IP
source port
destination IP
destination port
protocol
signature id

2. Every 120-seconds there is a keep-alive to the ips1.unifi-ai.com hostname. This connection is to ensure reliable delivery of the violation message. The keep-alive is a connection to our cloud using port 443 so it is not just an ICMP ping or DNS resolution but a complete 3-way handshake and SSL Key exchange.

What information is kept on our servers regarding IPS/IDS?

The data listed above is only temporarily stored in the IPS Cloud until the controller downloads the information. After the information is downloaded by the controller, the data is deleted from our cloud except for the attacker IP. The attacker IP information helps Ubiquiti maintain an up-to-date and effective attacker list which will improve Ubiquiti’s services to Ubiquiti customers around the world.

How is the information from alerts used by Ubiquiti?

Ubiquiti will use the alert information to improve its products and services, including generating lists of IP Reputation, Malicious IP addresses, Threat Intelligence and creating blacklists and new signatures for Ubiquiti devices. A sanitized version of IP addresses  (Ex: 200.200.x.x) can also be displayed on Ubiquiti Public Threat Map to help the public community to see malicious traffic around the world.


Related Articles


Back to Top

UniFi - USG Firewall: Introduction to Firewall Rules

UniFi - Regenerating an IPS/IDS Token (Debian-based Linux/Cloud Key)

UniFi - USG: Responding to a Threat Detection Alert


We're sorry to hear that!