Changes

Jump to: navigation, search

SRT210 Lab 5

4,752 bytes added, 01:26, 6 March 2019
Objectives
= Objectives =
* Understand how DHCP works and set up aworking server/client.* Understand which types of traffic can be captured where, from the point of view of an attacker.* Practice capturing traffic, and browsing it using Wireshark.
= PART 1: PREREQUISITES =
== DHCP Clients ==
* Create two a new nested VMs VM on the asg1 network. Same minimal installation, but leave their its network interfaces interface configured as a DHCP clientsclient.* The first one It should have the hostname <code>alice</code> and the second one should be named . For various scenarios later we'll treat different machines as <code>charliebob</code>. lin2a1 will serve as and <code>bobcharlie</code>, when we get to that.
* Boot up alice (or bring eth0 down and back up) and confirm that it's been configured as expected based on your DHCP server's configuration.
* You should be able to use the internet on the new machine without any extra configuration, which is the whole point of DHCP.
* Check the logs (/var/log/messages) on your DHCP server. You should see the expected four steps of the communication (discover, offer, request, and ack).
* Notice also that the communication is made of broadcast messages targeted using the MAC address of the DHCP server and DHCP client, since for an obvious reason they cannot communicate using IP addresses.
 
= PART 3: PACKET CAPTURE =
 
We'll do some packet capturing to better help you understand routing and how it applies to security topics. To do this we'll use the tcpdump command to capture traffic, and Wireshark to view it.
 
== Wireshark ==
 
* Wireshark can do many things, we'll just use it as a GUI to display the traffic we captured. Since we only have one machine with a graphical interface (c7host) - install it in there. The package is called wireshark-gnome.
* You can run it now, but we won't use it until we have something to display, in the next section.
 
== DHCP traffic ==
 
* You should already have a DHCP server and client on the asg1 network. Install tcpdump on the server, and run it like this:<source>
tcpdump -i eth0
</source>
* The tool will print a bit of information about the traffic that it sees (not all the details, but enough for now).
* Leave this window visible and switch to the alice VM. Bring its network interface down and back up. Since it's configured to be a DHCP client - this will result in a DHCP request.
* Back in the DHCP server window you should have noticed some extra output when you did the step above. You can kill it now with Ctrl+c and look at that output. You should notice at least a couple of BOOTP/DHCP lines related to what you just did.
* Now rerun tcpdump, but this time save the traffic in a Wireshark-compatible format:<source>
tcpdump -i eth0 -w dhcpserver.pcap
</source>
* Bring your interface down and back up in the alice VM, and kill tcpdump.
* The dhcpserver.pcap file will not be human-readable, it's intended to be viewed with Wireshark. So copy the file to c7host using the scp command.
* Open dhcpserver.pcap in Wireshark, and browse through the DHCP packets, looking specifically for MAC and IP addresses.
 
== Apache traffic ==
 
* It is generally accepted that no website using authentication should run over plain-text (http://) but many do, and in this section we'll see why that's a bad idea.
* There are quite a few steps to set everything up, but essentially you'll be doing the same thing here as you did for the DHCP traffic above.
* First reconfigure your website on lin1 to require authentication. To do that:
** Edit /etc/httpd/conf/httpd.conf, and find the section for the /var/www/html directory. In that section replace <source>AllowOverride None</source> with <source>AllowOverride All</source>. Then restart Apache.
** Go to the /var/www/html directory and create a couple of files. The first one (.htaccess) will require credentials when visitors access the webpage:<source>AuthUserFile /var/www/html/.htpasswd
AuthGroupFile /dev/null
AuthName "Please Enter Password"
AuthType Basic
Require valid-user
</source> And the second one (.htpasswd) will have the credentials (andrew/test): <source>andrew:PGwvUbWUtmzqE</source>
* Test that your changes worked by accessing lin1.yourusername.ops using Firefox on c7host. It should prompt for credentials and let you see your page when you give it the username andrew and password test.
* Now we'll need to install a GUI on the alice machine so that we can do our packet capture on the router:<source>yum groupinstall "GNOME Desktop"</source>
* Then make it start automatically <source>ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target</source> and reboot.
* This time the traffic will be between alice and lin1, and we'll do the packet capture on lin1a1, which is the gateway out of the asg1 network:<source>tcpdump -i eth1 tcp -w gatewaytcp.pcap</source>
* Which will capture all TCP traffic going through the gateway, including the communication we want to sniff.
* Open Firefox in the alice machine, close the extra tabs, and go to lin1.yourusername.ops. Type in the username and password to see your webpage.
* Stop the packet capturing on the gateway, scp the gatewaytcp.pcap file to c7host, and open it with wireshark.
* Look for a line with GET / HTTP/1.1 in the info column, and an "Authorization" line in the Hypretext Transfer Protocol section of that packet.
* With just a bit of browsing you should be able to find the username and password you've typed in when you logged in. Notice that no cracking of brute-forcing was needed.
= Lab completion =

Navigation menu