12.4.1.1 Lab - Interpret HTTP and DNS Data To Isolate Threat Actor
12.4.1.1 Lab - Interpret HTTP and DNS Data To Isolate Threat Actor
12.4.1.1 Lab - Interpret HTTP and DNS Data To Isolate Threat Actor
Topology
Objectives
In this lab, you will review logs during an exploitation of documented HTTP and DNS vulnerabilities.
Part 1: Prepare the Virtual Environment
Part 2: Investigate an SQL Injection Attack
Part 3: Data Exfiltration Using DNS
Background / Scenario
MySQL is a popular database used by numerous web applications. Unfortunately, SQL injection is a common
web hacking technique. It is a code injection technique where an attacker executes malicious SQL statements
to control a web application's database server.
Domain name servers (DNS) are directories of domain names, and they translate the domain names into IP
addresses. This service can be used to exfiltrate data.
Cisco and/or its affiliates. All rights reserved. Cisco Confidential Page 1 of 17 www.netacad.com
Lab – Interpret HTTP and DNS Data to Isolate Threat Actor
In this lab, you will perform an SQL injection to access the SQL database on the server. You will also use the
DNS service to facilitate data exfiltration.
Required Resources
Host computer with at least 8GB of RAM and 40GB of free disk space
Latest version of Oracle VirtualBox
Internet connection
Four virtual machines:
c. Start the CyberOps Workstation, Kali, Metasploitable, and Security Onion virtual machines by selecting
each one of them and clicking the Start button. The Start button is located in VirtualBox’s Toolbar.
d. Log into the CyberOps Workstation virtual machine, open a terminal and configure the network by
executing the configure_as_static.sh script.
Because the script requires super-user privileges, provide the password for the user analyst.
Cisco and/or its affiliates. All rights reserved. Cisco Confidential Page 2 of 17 www.netacad.com
Lab – Interpret HTTP and DNS Data to Isolate Threat Actor
IP Configuration successful.
[analyst@secOps ~]$
e. Log into the Security Onion VM. Right-click the Desktop > Open Terminal Here. Enter sudo service
nsm status command to verify that all the servers and sensors are ready. This process could take a few
moments. Repeat the command as necessary until all the status for all the servers and sensors are OK
before moving onto the next part.
analyst@SecOnion:~/Desktop$ sudo service nsm status
Status: securityonion
* sguil server [ OK ]
Status: HIDS
* ossec_agent (sguil) [ OK ]
Status: Bro
Name Type Host Status Pid Started
manager manager localhost running 5577 26 Jun 10:04:27
proxy proxy localhost running 5772 26 Jun 10:04:29
seconion-eth0-1 worker localhost running 6245 26 Jun 10:04:33
seconion-eth1-1 worker localhost running 6247 26 Jun 10:04:33
seconion-eth2-1 worker localhost running 6246 26 Jun 10:04:33
Status: seconion-eth0
* netsniff-ng (full packet data) [ OK ]
* pcap_agent (sguil) [ OK ]
* snort_agent-1 (sguil) [ OK ]
* snort-1 (alert data) [ OK ]
* barnyard2-1 (spooler, unified2 format) [ OK ]
<output omitted>
b. In the Kali VM, click the Firefox ESR icon ( ) to open a new web browser.
Cisco and/or its affiliates. All rights reserved. Cisco Confidential Page 3 of 17 www.netacad.com
Lab – Interpret HTTP and DNS Data to Isolate Threat Actor
d. Click OWASP Top 10 > A1 – Injection > SQLi – Extract Data > User Info.
Cisco and/or its affiliates. All rights reserved. Cisco Confidential Page 4 of 17 www.netacad.com
Lab – Interpret HTTP and DNS Data to Isolate Threat Actor
f. In the Username field, double-click the 20 and change it to 100 so you can view the longer string as you
enter the query into Name field. Close the Inspect Element when finished.
g. Enter ' union select ccid,ccnumber,ccv,expiration,null from credit_cards -- in the Name field. Click
View Account Details to extract the credit card information from the credit_cards table in owasp10 mysql
database.
Note: There is a single quote ( ' ), followed by a space at the beginning of the string. There is a space
after -- at the end of the string.
h. Scroll down the page for the results. The result indicates that you have successfully extracted the credit
card information from the database by using SQL injection. This information should only be available to
authorized users.
Cisco and/or its affiliates. All rights reserved. Cisco Confidential Page 5 of 17 www.netacad.com
Lab – Interpret HTTP and DNS Data to Isolate Threat Actor
e. Right-click the number under the CNT heading for the selected alert to view all the related alerts. Select
View Correlated Events.
Cisco and/or its affiliates. All rights reserved. Cisco Confidential Page 6 of 17 www.netacad.com
Lab – Interpret HTTP and DNS Data to Isolate Threat Actor
f. Right-click an Alert ID in the results. Select Transcript to view the details for this alert.
Note: If you mistyped the user information in the previous step, you should use the last alert in the list.
Cisco and/or its affiliates. All rights reserved. Cisco Confidential Page 7 of 17 www.netacad.com
Lab – Interpret HTTP and DNS Data to Isolate Threat Actor
g. In this window, you can see that the GET statement using the UNION operator was used to access the
credit card information. If you do not see this information, try right-clicking another of the correlated
events.
Note: If you entered the injection script more than once because of a typo or some other reason, it may
be helpful to sort the Date/Time column and view the most recent alert.
h. You can also determine the information retrieved by the attacker. Click Search and enter username in
the Find: field. Use the Find button to locate the information that was captured. The same credit card
information may be displayed differently than the figure below.
Cisco and/or its affiliates. All rights reserved. Cisco Confidential Page 8 of 17 www.netacad.com
Lab – Interpret HTTP and DNS Data to Isolate Threat Actor
Note: If you are unable to locate the stolen credit card information, you may need to view the transcript in
another alert.
Compare the credit card information from the transcript window and the content extracted by the SQL
injection attack. What is your conclusion?
Informasi kartu kredit adalah sama karena transkrip menunjukkan semua konten yang dikirimkan antara
source dan destination
i. Close the windows when finished.
j. Return to the Sguil window, right-click the same Alert ID that contains the exfiltrated credit card
information and select Wireshark.
Cisco and/or its affiliates. All rights reserved. Cisco Confidential Page 9 of 17 www.netacad.com
Lab – Interpret HTTP and DNS Data to Isolate Threat Actor
l. The GET request and the exfiltrated data are displayed in the TCP stream window. Your output may be
different than the figure below, but it should contain the same credit card information as your transcript
above.
m. At this time, you could save the Wireshark data by clicking Save As in the TCP stream window. You can
also save the Wireshark pcap file. You can also document the source and destination IP addresses and
ports, time of incident, and protocol used for further analysis by a Tier 2 analyst.
n. Close or minimize Wireshark and Squil.
Cisco and/or its affiliates. All rights reserved. Cisco Confidential Page 10 of 17 www.netacad.com
Lab – Interpret HTTP and DNS Data to Isolate Threat Actor
a. While in the Security Onion VM, start ELSA from the Desktop. If you receive the message "Your
connection is not private", click ADVANCED to continue.
Cisco and/or its affiliates. All rights reserved. Cisco Confidential Page 11 of 17 www.netacad.com
Lab – Interpret HTTP and DNS Data to Isolate Threat Actor
e. Click Info on the last entry. This information is related the successful SQL injection. Notice the union
query that was used during the attack.
f. Click Plugin > getPcap. Enter username analyst and password cyberops when prompted. Click Submit
if necessary. CapMe is a web interface that allows you to get a pcap transcript and download the pcap.
g. The pcap transcript is rendered using tcpflow, and this page also provides the link to access the pcap file.
You can also search for the username information. Type Ctrl + F to open Find… dialog box. Enter
username in the field. You should be able to locate the credit card information that were displayed during
the SQL injection exploit.
Cisco and/or its affiliates. All rights reserved. Cisco Confidential Page 12 of 17 www.netacad.com
Lab – Interpret HTTP and DNS Data to Isolate Threat Actor
b. Display the content of the confidential.txt file using the more command.
c. The xxd command is used to create a hexdump or convert a hexdump back to binary. To transform the
content of confidential.txt into 60-byte long hex strings and save it to confidential.hex, use the
command xxd -p confidential.txt > confidential.hex.
The option -p is used to format the output in Postscript format and > is to redirect the output to
confidential.hex.
Note: Use the xxd man page to learn more about all the available options for the xxd command.
[analyst@secOps lab.support.files]$ xxd -p confidential.txt >
confidential.hex
d. Verify the content of confidential.hex.
[analyst@secOps lab.support.files]$ cat confidential.hex
434f4e464944454e5449414c20444f43554d454e540a444f204e4f542053
484152450a5468697320646f63756d656e7420636f6e7461696e7320696e
666f726d6174696f6e2061626f757420746865206c617374207365637572
697479206272656163682e0a
e. Verify that CyberOps Workstation has been configured to use the local DNS resolver at 209.165.200.235.
Enter cat /etc/resolv.conf at the prompt.
[analyst@secOps lab.support.files]$ cat /etc/resolv.conf
# Generated by resolvconf
nameserver 8.8.4.4
nameserver 209.165.200.235
Cisco and/or its affiliates. All rights reserved. Cisco Confidential Page 13 of 17 www.netacad.com
Lab – Interpret HTTP and DNS Data to Isolate Threat Actor
;; ANSWER SECTION:
;; AUTHORITY SECTION:
example.com. 604800 IN SOA ns.example. root.example.com. 2 604800 86400
2419200 604800
;; ADDITIONAL SECTION:
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Cisco and/or its affiliates. All rights reserved. Cisco Confidential Page 14 of 17 www.netacad.com
Lab – Interpret HTTP and DNS Data to Isolate Threat Actor
Cisco and/or its affiliates. All rights reserved. Cisco Confidential Page 15 of 17 www.netacad.com
Lab – Interpret HTTP and DNS Data to Isolate Threat Actor
c. Click one of the links and copy the 63-byte string prepended to ns.example.com.
d. Open a terminal window and use the echo and xxd commands to revert the hex string. The -n option
prevents the output of the trailing newline.
analyst@SecOnion:~/Desktop$ echo -n
"434f4e464944454e5449414c20444f43554d454e540a444f204e4f542053" | xxd -r -p
CONFIDENTIAL DOCUMENT
Cisco and/or its affiliates. All rights reserved. Cisco Confidential Page 16 of 17 www.netacad.com
Lab – Interpret HTTP and DNS Data to Isolate Threat Actor
DO NOT Sanalyst@SecOnion:~/Desktop$
If you continue to revert the hex strings, what is the result?
Hasilnya :
CONFIDENTIAL DOCUMENT
DO NOT SHARE
Cisco and/or its affiliates. All rights reserved. Cisco Confidential Page 17 of 17 www.netacad.com