CDIS CV PL.2 Scouting
CDIS CV PL.2 Scouting
CDIS CV PL.2 Scouting
2
Our objective
1/9/23 3
Kali VMs
4
Pre-flight check
You don’t want to give up your presence, so you disable ARP replies
on non-local interfaces (adjust the eth1 to your specific interface)
and mitigate
root@kali:~# sudo -i
root@kali:~# echo 1 > /proc/sys/net/ipv4/conf/eth1/arp_ignore
root@kali:~# echo 2 > /proc/sys/net/ipv4/conf/eth1/arp_announce
root@kali:~# echo 0 > /proc/sys/net/ipv4/conf/eth1/arp_notify
6
Also
You could also disable ARP altogether in an interface:
u ip link set dev eth1 arp off
7
Pre-flight check
§ It is recommended for you to use a separate
network interface for pentesting tasks.
1/9/23 8
Pre-flight check
(example of tcpdump on eth1)
Eventually, we could decide to configure the eth1 interface with the 1.1.1.1
address:
u ifconfig eth1 1.1.1.1 netmask 255.255.255.254
ARP replies for non-local ranges are disabled, so our host will not give up its
presence by announcing local source IPs or answering ARP queries.
10
Step 1: range recognition
§ You want to enumerate the devices present on
the address range.
§ Which one? A trace analysis might help.
11
Step 1: range recognition
Some examples
Using arp-scan:
This command executes an ARP scan on the eth0 interface, using a spoofed IP
address, by issuing ARP queries for an IP range. Throttling is ensured by means of
the –interval option (in milliseconds).
(for testing in this class, you can adjust the interval to 50 to make
things a little faster, but in real systems you should be patient)
ATTENTION !
For the next ones to work you’ll need
a valid network IP address for the testbed NIC.
21 for group 1
22 for group 2
23 for group 3
…
32 for group 4
1/9/23 13
Step 1: range recognition
Some examples
Using nmap:
u route add –net 172.27.224.0/24 dev eth1
u nmap --send-eth -e eth1 -sn -n --scan-delay 1 172.27.224.45-253
nmap
1/9/23 15
A quick detour…
nmap scan stages (that you may explore in your assignment)
Source: https://nmap.org/book/nmap-phases.html
16
A quick detour…
nmap scan stages (that you may explore in your assignment)
10. Output. Finally, Nmap collects all the information it has gathered
and writes it to the screen or to a file. Nmap can write output in
several formats.
11. Script post-scanning. After Nmap has completed its scanning and
normal output, scripts in this phase can process results and
deliver final reports and statistics.
Nmap offers many options for controlling which of these phases are
run. For scans of large networks, each phase is repeated many times
since Nmap deals with the hosts in smaller groups. It scans each
group completely and outputs those results, then moves on to the
next batch of hosts.
19
Step 2: target profiling
Nmap Output for 172.27.224.250
For more sophisticated scans you should assign a valid IP address to the
interface. Once again, nmap may be helpful.
TCP SYN SCAN
nmap --send-eth -e eth1 -sS -n 172.27.224.250 \
-–scan-delay 1 –p 1-1024 –Pn --disable-arp-ping
20
Step 2: target profiling
Nmap Output for 172.27.224.250
For more sophisticated scans you should assign a valid IP address to the
interface. Once again, nmap may be helpful.
TCP SYN SCAN
nmap --send-eth -e eth1 -sS -n 172.27.224.250 \
-–scan-delay 1 –p 1-1024 –Pn --disable-arp-ping
This is
probably a
PLC…
1/9/23 21
Step 2: target profiling
Once you get information about the hosts on the network
you’ll probably want to profile them.
Nmap is one of the best tools for this:
TCP FIN (FRAG) SCAN
nmap --send-eth -e eth1 -sF -f -n 172.27.224.250 \
-–scan-delay 1 –p 1-1024 –Pn --disable-arp-ping
SERVICE Versioning (verbose)
nmap --send-eth -e eth1 -sV -f -n 172.27.224.250 -v \
-p 1-1024 -Pn --disable-arp-ping –-scan-delay 1
UDP SCAN
nmap --send-eth -e eth1 -sU -n 172.27.224.250 \
–-scan-delay 1 –p 1-2014 –Pn --disable-arp-ping
(WARNING: Avoid using this one)
1/9/23 22
About UDP (and other) scans
The main issue has to do with the way nmap probes UDP ports, by
using null request payloads (for fingerprinting operations it can be
worse, because even malformed packets may be used).
For pretty much the same reasons that led to the unreliability of
some TCP/IP stack or service implementations, several developers
just didn’t care about sanitizing and/or validating protocol requests…
1/9/23 23
Step 2: target profiling
Nmap Output for 172.27.224.250
FIN Scan
Version Scan
UDP Scan
1/9/23 24
What did we find ?
1/9/23 25
1/9/23 26
1/9/23 27
Let the fun begin
For an in-depth analysis of our subject we are going to use the smod Modbus
pentesting framework:
https://github.com/oliverkko/smod
Download https://github.com/oliverkko/smod/archive/master.zip
Unzip the file.
Execute the following commands (in case you don’t have pip2, execute
apt-get install python-pip):
§ pip2 install crypto
§ pip2 install scapy
1/9/23 29
Let the fun begin
Which are the valid FCs for this device ?
1/9/23 30
Let the fun begin
Which are the valid UIDs for this device ?
1/9/23 31
Note: some versions may report only one UID, but the entire UID range is accepted.
Let the fun begin
Let’s read some coil registers:
1/9/23 32
Next steps - Homework