Chapter 2. Security Tuneup
2.2 Deal with Bad Actors
Learning Objectives
- Restrict certain websites
- Deal with DoS floods
Prerequisites:
- SNAT for the Internet
- Security policy for Inside to Outside
- Interface configuration
- Knowledge of previous labs
Scenario: In this lab, we will learn how to block a specific website and how to prevent script kiddies from succeeding with the infinite ping tool they downloaded from the sketchiest site you’ve ever seen. Kali acts like an attacker machine and we are going to attack the firewall through port Ethernet1/2. Then, we’ll enable DoS Prevention in the firewall to prevent attacks.
![Main scenario](https://opentextbc.ca/wp-content/uploads/sites/445/2022/04/2022-04-23-00-07-28-image.png)
Device | Configuration |
---|---|
PaloAlto-1 | management: 192.168.0.1/24 Ethernet1/1: 10.0.0.1/24 Ethernet1/2: DHCP |
Client (webterm) | eth0: 10.0.0.2/24 GW: 10.0.0.1 DNS: 8.8.8.8 |
Management (webterm) | eth0: 192.168.0.2/24 |
KaliLinux2019-3-1 | eth0: DHCP |
Zone | Interfaces |
---|---|
Inside | Ethernet1/1 |
Outside | Ethernet1/2 |
Create a URL Category
Under object > custom objects > URL category, click Add. Click cancel on the pop-up.
![Create a Custom URL Category](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/2022-04-23-00-21-06-image.png)
Here we can block 5, 6, or multiple sites. But here we will use just 1. Give it a name, then click Add.
![Add a CustomURL Category](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/1-1.jpg)
Enter some websites you would like to block. Here I have added a sample website (www.thegreattechadventure.com) you can also use wildcards if you want.
After you’re done. Click OK.
Block a Website
Under Policies > Security. Click Add:
![Add a security policy](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/NAT3.jpg)
Under the source tab, add the Inside zone under the source zone:
![Add a Source Zone](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/2022-04-23-00-33-28-image.png)
Under the destination tab, add the Outside zone under the destination zone:
![Add a Destination Zone](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/2022-04-23-00-33-53-image.png)
Under the Service/URL Category tab, add the created URL category you created in the previous step.
![Assign URL Category](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/2-1.jpg)
Under the actions page, set the action to deny.
![Set an Action to Deny](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/Sec2.jpg)
Then click OK.
Enable Block Pages
Under Device > Response pages. Click on Disabled beside Application Block Page.
![Enabling Application Block Page](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/Sec3.jpg)
Tick on the enable checkbox, then press OK.
![Enabling Application Block Page](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/2022-04-23-00-38-58-image.png)
Make sure to commit your changes!
Test the Blocked URL
Open up Firefox on the Client machine, and try to connect to the URL you blocked. If all is right, you should see a blocked page.
![Application Block Page](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/2022-04-23-00-41-38-image.png)
If you see this page, that is alright too!
![Application Block Page](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/2022-04-23-00-42-15-image.png)
Set Up Kali to Be a Bad Actor
After entering into the live graphical environment and testing for internet connection. Open up the terminal.
![Open up Terminal in Kali](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/2022-04-23-00-44-16-image.png)
We will be using Pentmenu by GinjaChris to demonstrate a flood. Run these commands to download and run the application:
#git clone https://github.com/GinjaChris/pentmenu
#cd pentmenu
#chmod +x pentmenu
#./pentmenu
![PentMenu app](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/2022-04-23-00-56-14-image.png)
Select option 2 for DoS attack.
![PentMenu app - Select DOS(2)](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/2022-04-23-00-57-05-image.png)
Select option 1 for ICMP Echo Flood.
![PentMenu app - Select ICMP Echo Flood(1)](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/2022-04-23-00-57-43-image.png)
For the IP, use the IP of the interface in the outside zone. It should be in the 192.168.122.0/24 range.
![PentMenu app - Enter Target IP address](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/Sec4.jpg)
Select r for random IP address.
![PentMenu app - Enter r for random IP address](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/2022-04-23-01-01-02-image.png)
After about 2 seconds, press Ctrl+C.
Analyze the ICMP Flood
Back on the Management machine, go under Monitor > Session browser.
![Verify session logs](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/2022-04-23-01-05-43-image.png)
As you can see, there are many entries here for ping. We want to prevent floods like these.
Create a DoS Protection Profile
Under Objects > Security Profiles > DoS Protection. Click Add.
![Create a DOS Protection](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/Sec5.jpg)
Set the type to Classified and under Flood protection, click the checkbox on the SYN Flood, UDP Flood, and ICMP Flood tabs.
![SYN Flood Protection](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/Sec6.2.jpg)
After that, click OK.
Apply the DoS Protection Profile
Under Policies > Dos Protection. Click Add.
![Add a DoS Protection Rule](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/Sec7.jpg)
Under the Source tab, add the Outside zone.
![Add the Source Zone](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/2022-04-23-01-13-35-image.png)
Under the Destination tab, add the Inside zone.
![Add the Destination Zone](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/2022-04-23-01-14-15-image.png)
Under the Option/Protection tab, configure these settings:
Parameter | Value |
---|---|
Action | Protect |
Schedule | None |
Log Forwarding | None |
Aggregate | None |
Classified | Tick this box |
Profile | The name of the one you created |
Address | source-IP-only |
![DoS Rule - Option/Policies](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/2022-04-23-01-17-49-image.png)
Then click OK.
Create a Zone Protection Profile
Under Network > Network Profiles > Zone Protection. Click Add.
![Add a Zone Protection](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/Sec8.jpg)
Under the flood protection tab, tick SYN, ICMP, and UDP.
![Add a Flood Protection](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/2022-04-23-01-18-37-image.png)
Under the Reconnaissance Protection tab, tick enables on all boxes, and change the action to block.
![Set UDP Port Scan](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/2022-04-23-01-20-40-image.png)
Under the Packet Based Attack Protection tab, under the IP drop subtab, tick on Spoofed IP address and Strict IP Address Check.
![Enable Spoof IP address and Strict Address Check](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/2022-04-23-01-23-19-image.png)
Under the Packet Based Attack Protection tab, under the TCP drop subtab, tick on TCP SYN with Data and TCP SYNACK with Data.
![Enable TCP SYN with Data](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/2022-04-23-01-24-19-image.png)
Under the Packet Based Attack Protection tab, under the ICMP drop subtab, tick on ICMP Ping ID 0, ICMP Fragment, and ICMP Large Packet(>1024).
![Enable ICMP Ping ID 0, ICMP Fragment](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/2022-04-23-01-25-24-image.png)
Then click OK.
Apply a Zone Protection Profile
Under Network > Zones. Click on the Outside Zone.
![Create an Outside zone](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/Sec9.jpg)
Under the Zone Protection category, select the profile you just created.
![Enable Zone Protection under Outside Zone](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/Sec10.jpg)
Click OK.
Don’t forget to commit your changes!
Test the DoS Protection
Run Pentmenu again using the previous options, then Ctrl+C after 3 seconds.
![Running PentMenu](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/2022-04-23-01-54-06-image.png)
Under Monitor > Logs > Threat. You should see an entry for an ICMP flood.
![Verify logs](https://opentextbc.ca/wp-content/uploads/sites/445/2023/11/2022-04-23-01-54-49-image.png)