Module 12
Module 12
Honeypots
Lab 1: Perform Intrusion Detection using
Various Tools
Lab Scenario
The goal of the Intrusion Detection Analyst is to find possible attacks against a network. Recent
years have witnessed a significant increase in Distributed Denial-of-Service (DDoS) attacks on
the Internet, making network security a great concern. Analysts search for possible attacks by
examining IDS logs and packet captures and corroborating them with firewall logs, known
vulnerabilities, and general trending data from the Internet. IDS attacks are becoming more
sophisticated; automatically reasoning the attack scenarios in real-time, and categorizing them
has become a critical challenge. These processes result in huge amounts of data, which analysts
must examine to detect a pattern. However, the overwhelming flow of events generated by IDS
sensors make it difficult for security administrators to uncover hidden attack plans.
To become an expert penetration tester and security administrator, you must possess sound
knowledge of network IPSs, IDSs, malicious network activity, and log information.
Lab Objectives
Intrusion detection systems are highly useful as they monitor both the inbound and outbound
traffic of the network and continuously inspects the data for suspicious activities that may indicate
a network or system security breach. The IDS checks traffic for signatures that match known
intrusion patterns and signals an alarm when a match is detected. It can be categorized into
active and passive, depending on its functionality: an IDS is generally passive and is used to
detect intrusions, while an intrusion prevention system (IPS) is considered as an active IDS, as it
is not only used to detect the intrusion on the network, but also prevent them.
• Gathers and analyzes information from within a computer or a network, to identify the
possible violations of security policy
• Also referred to as a "packet-sniffer," which intercepts packets traveling along various
communication mediums and protocols
• Evaluates traffic for suspected intrusions and signals an alarm after detection
Uses of Snort:
3. Accept the License Agreement and install Snort by selecting the default options
that appear step by step in the wizard.
8. snort.conf is already present in C:\Snort\etc; replace the file with the newly
copied file.
9. Copy the so_rules folder from E:\CEH-Tools\CEHv13 Module 12 Evading
IDS, Firewalls, and Honeypots\Intrusion Detection Tools\Snort\snortrules-
snapshot-29150 and paste into C:\Snort.
11. Using the same method, copy the rules folder from E:\CEH-Tools\CEHv13
Module 12 Evading IDS, Firewalls, and Honeypots\Intrusion Detection
Tools\Snort\snortrules-snapshot-29150 and paste into C:\Snort.
12. Now, right-click on the Windows Start icon and click Run from the menu.
13. The Run window appears; type cmd in the Open field and click OK to launch
command prompt window.
16. Now type snort -W. This command lists your machine's physical address, IP
address, and Ethernet Drivers, but all are disabled by default.
17. Observe your Ethernet Driver index number and write it down (in this task, it
is 1).
18. To enable the Ethernet Driver, in the command prompt, run command snort -
dev -i 1.
19. You see a rapid scroll text in the command prompt, which means that the
Ethernet Driver is enabled and working properly.
20. Leave the Snort command prompt window open, and launch another command
prompt window.
The Google IP address will differ when you perform this task.
23. Close both command prompt windows. The verification of Snort installation and
the triggering alert is complete, and Snort is working correctly in verbose mode.
26. Scroll down to the Step #1: Set the network variables section (Line 41) of
the snort.conf file. In the HOME_NET line (Line 45), replace any with the IP
addresses of the machine (target machine) on which Snort is running. Here, the
target machine is Windows 11 and the IP address is 10.10.1.11.
28. If you have a DNS Server, then make changes in the DNS_SERVERS line by
replacing $HOME_NET with your DNS Server IP address; otherwise, leave this
line as it is.
30. Remember that if you do not have any servers running on your machine, leave
the line as it is. DO NOT make any changes in that line.
To create a text file, right-click anywhere inside the rules window and navigate
to New --> Text Document.
34. While changing the extension, if any pop-up appears, click Yes.
35. Switch back to Notepad++, scroll down to the Step #4: Configure dynamic
loaded libraries section (Line 238). Configure dynamic loaded libraries in
this section.
38. At the path to base preprocessor (or dynamic) engine (Line 246),
replace /usr/local/lib/snort_dynamicengine/libsf_engine.so with your base
preprocessor engine C:\Snort\lib\snort_dynamicengine\sf_engine.dll.
39. Ensure that the dynamic rules libraries (Line 249) is commented out, as you
have already configured the libraries in dynamic preprocessor libraries.
40. Scroll down to the Step #5: Configure preprocessors section (Line 253), the
listed preprocessor. This does nothing in IDS mode, however, it generates errors
at runtime.
41. Comment out all the preprocessors listed in this section by adding '#' and
(space) before each preprocessor rule (261-265).
44. These two files are in C:\Snort\etc. Provide this location of files in the configure
output plugins (in Lines 527 and 528)
(i.e., C:\Snort\etc\classification.config and C:\Snort\etc\reference.config).
45. In Step #6, add to line (529) output alert_fast: alerts.ids: this command orders
Snort to dump all logs into the alerts.ids file.
46. In the snort.conf file, find and replace the ipvar string with var. To do this,
press Ctrl+H on the keyboard. The Replace window appears; enter ipvar in
the Find what : text field, enter var in the Replace with : text field, and
click Replace All.
47. By default, the string is ipvar, which is not recognized by Snort: replace with
the var string, and then close the window.
49. Save the snort.conf file by pressing Ctrl+S and close Notepad++ window.
50. Before running Snort, you need to enable detection rules in the Snort rules file.
For this task, we have enabled the ICMP rule so that Snort can detect any host
discovery ping probes directed at the system running Snort.
51. Navigate to C:\Snort\rules and open the icmp-info.rules file with Notepad++.
52. In line 21, type alert icmp $EXTERNAL_NET any -> $HOME_NET 10.10.1.11
(msg:"ICMP-INFO PING"; icode:0; itype:8; reference:arachnids,135;
reference:cve,1999-0265; classtype:bad-unknown; sid:472; rev:7;) and
save. Close the Notepad++ window.
54. In the Run window, type cmd in the Open field and press Enter: This will launch
a command prompt window.
55. In the command prompt window, type cd C:\Snort\bin and press Enter.
58. If you receive an error stating "Could not create the registry key," then run the
command prompt as Administrator.
59. Snort starts running in IDS mode. It first initializes output plug-ins,
preprocessors, plug-ins, loads dynamic preprocessors libraries, rule chains of
Snort, and then logs all signatures.
60. If you have entered all command information correctly, you receive a comment
stating Commencing packet processing (pid=xxxx) (the value of xxxx may be
any number; in this task, it is 2132), as shown in the screenshot.
61. After initializing interface and logged signatures, Snort starts and waits for an
attack and triggers alerts when attacks occur on the machine.
63. Attack your own machine, and check whether Snort detects it or not.
64. Now, click on Windows Server 2019 to switch to the Windows Server
2019 machine (Attacker Machine). Click Ctrl+Alt+Delete to activate the
machine and login with Administrator/Pa$$w0rd.
65. Open the command prompt and issue the command ping 10.10.1.11 -t from
the Attacker Machine
10.10.1.11 is the IP address of the Windows11. This IP address may differ when
you perform the task.
66. Click Windows 11 to return to the Windows 11 machine. Observe that Snort
triggers an alarm, as shown in the screenshot:
67. Press Ctrl+C to stop Snort; snort exits.
The folder name 10.10.1.19 might vary when you perform the task, depending
on the IP address of the Windows 11 machine.
This means that whenever an attacker attempts to connect or communicate with
the machine, Snort immediately triggers an alarm
This will make you aware of the intrusion and can thus take certain security
measures to disconnect the lines of communication with the attacker's machine.
69. Close all open windows in the Windows 11 and Windows Server
2019 machines.
Question 12.1.1.1
Install Snort in the Windows Server 2019 machine. The necessary files are available at
Z:\CEHv13 Module 12 Evading IDS, Firewalls, and Honeypots\Intrusion Detection Tools\Snort.
Configure and initialize the Snort tool. Initialize the Snort interfaces and attack a target machine
from the attacker machine (10.10.1.11) to check whether Snort detects it or not. Enter the Snort
command to view the index number of the Ethernet driver.
Here, we will use Cowrie honeypot to capture incoming malicious traffic from the attacker's
machine (here, Parrot Security).
1. Click Ubuntu to switch to the Ubuntu machine and login with Ubuntu/toor.
Leave Full Name, Room Number, Work Phone, Home Phone, Other blank and
type Y when prompted Is the information correct? [Y/n].
o Open Files and navigate to the + Other Locations from the left
pane
o In the Connect to Server field, type smb://10.10.1.11 and
press Enter to access Windows 11 shared folders.
o The security pop-up appears; enter the Windows 11 machine
credentials (Admin/Pa$$w0rd) and click Connect.
o The Windows shares on 10.10.1.11 window appears; double-click
the CEH-Tools folder.
5. Open a new terminal and execute sudo su to run the programs as a root user
(When prompted, enter the password toor). Now, jump into Cowrie directory
using cd cowrie command.
Here,
o -t nat specifies the table in which the rule should be added. Here, it
is the network address translation (NAT) table.
o -A PREROUTING specifies that the rule should be appended to the
PREROUTING chain. The PREROUTING chain is traversed by
packets as soon as they come in, before any routing decisions are
made.
o -p tcp specifies the protocol to which the rule should apply. Here, it
is TCP.
o --dport 22 specifies the destination port. Here, it is port 22, which is
commonly used for SSH (Secure Shell) connections.
o -j REDIRECT specifies the target of the rule. It instructs iptables to
redirect the packet to another destination instead of its original
destination. Here, the destination will be redirected.
o --to-port 2222 specifies the port to which the packet should be
redirected. Here, it is port 2222. So, any incoming TCP packets to
port 22 will be redirected to port 2222.
14. Click Parrot Security to switch to Parrot Security machine and use toor as
password. Open a Terminal window and execute sudo su to run the programs
as a root user (When prompted, enter the password toor).
15. In the terminal, run nmap -p- -sV 10.10.1.9 command to discover open ports
and services.
16. You can observe that the port 22 is open and is the default port used for SSH
connection. Since the port is open we will try to connect to the machine using
SSH.
Here, you can also observe the SSH service running on port 2222 that is a
honeypot that we have deployed. Attackers will target the SSH service running
on default SSH port (22).
17. To establish a connection to the target machine via SSH, we will use PuTTY.
Initiate the PuTTY interface by executing putty command.
18. The PuTTY Configuration (as superuser) window appears. Enter the IP
address of the target machine (here, 10.10.1.9) in the Host Name (or IP
address) field, and proceed by clicking on Open button.
22. In the PuTTY Configuration (as superuser) window, type the IP address of the
target machine (here, 10.10.1.9) under Host Name (or IP address) section and
click on Open.
23. In 10.10.1.9 - PuTTY (as superuser) window, type login as root and type a
random password of your choice.
24. You are now in the honeypot, execute various commands to gather intelligence
and explore the system.
more...
25. Click Ubuntu to switch back to the Ubuntu machine and execute tail
cowrie.log command to view the logs. These logs will capture the activities
performed by the attacker within the Cowrie honeypot environment, including the
execution of commands.
This will notify you of the intrusion, allowing you to implement specific security
measures to sever communication with the attacker's machine.
26. This concludes the demonstration of detecting malicious network traffic using
Cowrie.
27. Close all open windows and document all acquired information.
Question 12.1.2.1
In ubuntu machine (10.10.1.9) setup Cowrie honeypot to capture incoming malicious traffic on
port 22 from the attacker's machine (10.10.1.13). Enter the port number to which the port 22
traffic is redirected to.
Lab 2: Evade IDS/Firewalls using Various
Evasion Techniques
Lab Scenario
Firewalls and IDSs are intended to prevent port scanning tools such as Nmap, from receiving
a precise measure of significant data of the frameworks that they are scanning. However,
these prevention measures can be easily overcome: Nmap has numerous features that were
created specifically to bypass these protections. It has the ability to issue a mapping of a
system framework, through which you can view a substantial amount of information, from
OS renditions to open ports. Firewalls and interruption recognition frameworks are made to
keep Nmap and other applications from obtaining that data.
As an ethical hacker or penetration tester, you will come across systems behind firewalls that
prevent you from attaining the information that you need. Therefore, you will need to know
how to avoid the firewall rules and to glean information about a host. This step in a
penetration test is called Firewall Evasion Rules.
Lab Objectives
• Port Scanning
• Firewalking
• Banner Grabbing
• IP Address Spoofing
• Source Routing
• Tiny Fragments
• Using an IP Address in Place of URL
• Using Anonymous Website Surfing Sites
• Using a Proxy Server
• ICMP Tunneling
• ACK Tunneling
• HTTP Tunneling
• SSH Tunneling
• DNS Tunneling
• Through External Systems
• Through MITM Attack
• Through Content
• Through XSS Attack
Here, we will use BITSAdmin to evade firewall and transfer malicious file into the target
machine.
1. Click Windows Server 2019 to switch to the Windows Server 2019 machine
and launch Control Panel.
2. The Control Panel window appears, click System and Security. In System
and Security window, select Windows Defender Firewall.
3. The Windows Defender Firewall control panel appears; click the Turn
Windows Defender Firewall on or off link in the left pane.
6. Click OK.
7. Click Parrot Security to switch to the Parrot Security machine. Open
a Terminal window and execute sudo su to run the programs as a root user
(When prompted, enter the password toor).
12. In the Type here to search field of the Desktop, type powershell and
click Windows PowerShell to launch a PowerShell.
18. Close all open windows and document all acquired information.
Question 12.2.1.1
Use BITSAdmin to evade firewall and transfer malicious file into the target machine
(Windows Server 2019). Enter the BitsAdmn command that is used to transfer malicious file
in this lab