Installing Suricata IDS/IPS and Triggering Rules with an Nmap Stealth Scan and XSS Attack on bWAPP Using Burp Suite
We are enabling the IDS/IPS functionality on our OPNsense firewall to detect and alert on potential threats by analyzing incoming traffic against predefined rules. These rules act as "fingerprints" to identify known attacks and suspicious behaviors across the network.
In this Lab, i will be using Suricata, a free and open-source cybersecurity tool that functions as both an Intrusion Detection System (IDS) and an Intrusion Prevention System (IPS). Widely adopted by organizations worldwide, Suricata monitors networks for suspicious activity and detects cyber threats.
Suricata's rules analyze network packets for specific characteristics, such as source and destination IP addresses, ports, protocol types, and even packet content, to identify potential threats. When traffic matches a rule, Suricata generates an alert, notifying administrators of potential security incidents.
Based on my research, it is essential to disable offloading features before enabling the IDS/IPS capability on the OPNsense firewall or any IDS/IPS device. Offloading can alter packets in ways that may compromise Suricata's ability to analyze them accurately, potentially resulting in missed detections or false results.
To disable head over to Interfaces>Settings and uncheck the offload
We will now create an XML file that instructs OPNsense to download the
suricata-nmap.rules file from our Ubuntu host at 192.168.147.11.For this example, I have created two Suricata rules:
- The first rule triggers an alert when a stealth Nmap scan is detected.
- The second rule triggers an alert upon detecting a
<script>tag, which is commonly used to execute or facilitate XSS (Cross-Site Scripting) attacks.
| 2. Rule for specific XSS scripting Attack |
We will save the created rules in a
.rules file as shown in the screenshot above. Additionally, I used a web-based Suricata rule generator to assist in creating these rules.| There are no alerts yet because we haven’t generated any traffic that could trigger these rules. |
Now, let's head over to our Kali attack machine and initiate an Nmap scan targeting any host within our 192.168.147.0/24 subnet.
After generating the Nmap traffic, let's navigate to the alert tab in our OPNsense firewall. As we can see, it has triggered the Suricata rule related to the Nmap scan.
<script> tag. And should trigger the suricata rule that we created for that kind of attack.| Enabling the intercept under Proxy tab |
| Fill up the credentials and click Go button |
The screenshot above shows the content of our POST request to the bWAPP server, including the credentials we entered. Now, we will modify the input fields to include the following XSS payloads:
<script>alert("This_has_been_XSS!")</script> and <script>alert("XSS!")</script>.<script> tag. We also demonstrated how to transfer the suricata.rules file to the OPNsense firewall using an XML file. If we need to add more rules in the future, we can simply edit the suricata.rules file. After making any changes, we need to enable the HTTP server on our Ubuntu host so that the OPNsense firewall can download and update the Suricata rules. <script> tag.
Comments
Post a Comment