Provide steps on how to investigate an SQL injection attack.

In this part, you will perform an SQL injection to access credit card information that is stored on a web
server. The Metasploitable VM is functioning as a web server configured with a MySQL database.

Step 1. Perform an SQL injection.
a. Log into Kali VM using the username root and password cyberops.
b. In the Kali VM, click the Firefox ESR icon ( ) to open a new web browser.
c. Navigate to 209.165.200.235. Click Mutillidae to access a vulnerable web site.
![15488|501x263](upload://8qcfq15A6KqE5UwKPmBB1j6I4TI.png)

d. Click OWASP Top 10 > A1 – Injection > SQLi – Extract Data > User Info.
![15489|501x411](upload://hAeJsTZy6hZz6WzhCY0rs9aj8q2.png)

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 the Name field. Close the Inspect Element
when finished.
![15490|505x150](upload://cKP8Cxt96UPdc5QGL7F9Atuzcyi.png)

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 the 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.
![15491|504x147](upload://leE9SWYyEtKbtyvl2jajmldlCbi.png)

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.
![15492|332x224](upload://oCg1Ov1BBARqHYfJ62MBTUeshOL.png)

Step 2. Review the Sguil logs.
a. Navigate to the Security Onion VM. Double-click the Sguil icon on the Desktop. Enter

the username analyst and password cyberops when prompted.
b. Click Select All to monitor all the networks. Click Start SGUIL to continue.
c. In the Sguil console, in the bottom-right window, click Show Packet Data and Show

Rule to view the details of a selected alert.

d. Search for alerts related to ET WEB_SERVER Possible SQL Injection Attempt

UNION SELECT. Select the alerts that start with 7. These alerts are related to seco-
nion-eth2-1, and they are probably the most recent alerts. Because Sguil displays real

time events, the Date/Time in the screenshot is for reference only. You should note the
Date/Time of the selected alert.
![15493|501x303](upload://tvAINpAd2KRE6VmasgzaREDhCFL.png)

e. Right-click the number under the CNT heading for the selected alert to view all the

related alerts. Select View Correlated Events.
![15494|338x94](upload://dqQtyqZ9xTWUe0bn7YsljGvSjyO.png)

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.
![15495|502x188](upload://plGPjP7ixJAdOJasZ13dHOWS7vd.png)

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.
![15487|420x286](upload://paF7S3INWaAR7vaY1T5tyzdigrF.png)

What information can you gather from the Transcript window?
____________________________________________________________________________
____________________________________________________________________________
____________________________________________________________________________
The Transcript window displays the transaction between the source
209.165.201.17:52644 and the destination 209.165.200.235:80. The transcript indicates
209.165.201.17 is trying to access credit card information using a SQL UNION operator.
The transcript for the web server at 209.165.200.235 shows the HTML content that was
displayed to the attacker.

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 cap-
tured. The same credit card information may be displayed differently than the figure below.

Note: If you are unable to locate the stolen credit card information, you may need to view the tran-
script in another alert.
![15496|420x490](upload://fedzkQLUZYndjH2NuVSwi6htKR9.png)

Compare the credit card information from the Transcript window and the content
extracted by the SQL injection attack. What is your conclusion?
____________________________________________________________________________
The credit card information is the same because the transcript shows all the content
transmitted between the source and 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.

k. Right-click on a TCP packet and select Follow TCP Stream.
![15497|503x265](upload://t762EWNQSoIxmH6MiFf9UqeuxRD.png)

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.
![15498|280x220](upload://usPzdKZDNN8OmJyeCWfZ7rdOa2Q.png)
![15499|277x217](upload://j7IDo1pZRjuN35fD4ukKPXg1B1x.png)

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.
Step 3. Review the ELSA logs.
The ELSA logs can also provide similar information.

a. While in the Security Onion VM, start ELSA from the Desktop. If you receive the mes-
sage “Your connection is not private”, click ADVANCED to continue.
![15500|419x199](upload://5teBtWmrZ5YfLtNFFfhznKqGC0H.png)

b. Click Proceed to localhost (unsafe) to continue to the localhost.
c. Log in with the username analyst and password cyberops.
d. In the left panel, select HTTP > Top Potential SQL Injection. Select 209.165.200.235.
![15501|505x165](upload://yBYsLGqkhcXpwyLOoy8aN8cNyZz.png)

e. Click Info on the last entry. This information is related to the successful SQL injection.

Notice the union query that was used during the attack.
![15502|504x238](upload://6bQ7E1Gfdl5STOW1GIVDm6lJjZe.png)

f. Click Plugin > getPcap. Enter username analyst and password cyberops when prompt-
ed. Click Submit if necessary. CapMe is a web interface that allows you to get a pcap

transcript and download the pcap.
![15503|216x142](upload://z6HIwylxkmOQkzL9LCOU1z8JqcA.png)

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 the Find... dialog box. Enter username in the field. You should be able to
locate the credit card information that was displayed during the SQL injection exploit.
![15504|516x61](upload://2rpGZAHWX7D2UkeFfsOltJNCMDK.png)

Computer Science & Information Technology

You might also like to view...

OneNote Online is Microsoft's cloud storage tool associated with your Microsoft account

Indicate whether the statement is true or false

Computer Science & Information Technology

What is the advantage of creating transparency effects within InDesign?

What will be an ideal response?

Computer Science & Information Technology