17.2.6 Lab - Attacking A Mysql Database
17.2.6 Lab - Attacking A Mysql Database
Objectives
In this lab, you will view a PCAP file from a previous attack against a SQL database.
Part 1: Open Wireshark and load the PCAP file.
Part 2: View the SQL Injection Attack.
Part 3: The SQL Injection Attack continues…
Part 4: The SQL Injection Attack provides system information.
Part 5: The SQL Injection Attack and Table Information
Part 6: The SQL Injection Attack Concludes.
Background / Scenario
SQL injection attacks allow malicious hackers to type SQL statements in a web site and receive a response
from the database. This allows attackers to tamper with current data in the database, spoof identities, and
miscellaneous mischief.
A PCAP file has been created for you to view a previous attack against a SQL database. In this lab, you will
view the SQL database attacks and answer the questions.
Required Resources
● CyberOps Workstation virtual machine
Instructions
You will use Wireshark, a common network packet analyzer, to analyze network traffic. After starting
Wireshark, you will open a previously saved network capture and view a step by step SQL injection attack
against a SQL database.
What are the two IP addresses involved in this SQL injection attack based on the information displayed?
c. The attacker has entered a query (1=1) into a UserID search box on the target 10.0.2.15 to see if the
application is vulnerable to SQL injection. Instead of the application responding with a login failure
message, it responded with a record from a database. The attacker has verified they can input an
SQL command and the database will respond. The search string 1=1 creates an SQL statement that
will be always true. In the example, it does not matter what is entered into the field, it will always be
true.
The database name is dvwa and the database user is root@localhost. There are also multiple user
accounts being displayed.
d. Close the Follow HTTP Stream window.
e. Click Clear display filter to display the entire Wireshark conversation.
What would the modified command of (1' OR 1=1 UNION SELECT null, column_name FROM
INFORMATION_SCHEMA.columns WHERE table_name='users') do for the attacker?
=> Afficher les noms des utilisateurs
=> Hack Me
c. Using a website such as https://crackstation.net/, copy the password hash into the password
hash cracker and get cracking.
d. Close the Follow HTTP Stream window. Close any open windows.
Reflection Questions
1. What is the risk of having platforms use the SQL language?
=>An SQL Injection vulnerability may affect any website or web application that uses an SQL database
such as MySQL, Oracle, SQL Server, or others. Criminals may use it to gain unauthorized access to
your sensitive data: customer information, personal data, trade secrets, intellectual property, and more.
2. Browse the internet and perform a search on “prevent SQL injection attacks”. What are 2 methods or steps
that can be taken to prevent SQL injection attacks?
=>The only sure way to prevent SQL Injection attacks is input validation and parametrized queries
including prepared statements. The application code should never use the input directly. The developer
must sanitize all input, not only web form inputs such as login forms.