Lab 7 Manual SQL Injection, John The Ripper
Lab 7 Manual SQL Injection, John The Ripper
Contents
I. Background Information................................................................................................................ 1
II. Virtual Machine Settings ................................................................................................................ 2
III. Manual SQL Injection.................................................................................................................... 7
IV. Create Password Hash File .......................................................................................................... 15
V. Proof of Lab Using John the Ripper ........................................................................................... 17
I. Background Information
1. What is Damn Vulnerable Web App (DVWA)?
SQL injection (also known as SQL fishing) is a technique often used to attack
data driven applications.
This is done by including portions of SQL statements in an entry field in an
attempt to get the website to pass a newly formed rogue SQL command to the
database (e.g., dump the database contents to the attacker). SQL injection is a
code injection technique that exploits a security vulnerability in an application's
software.
The vulnerability happens when user input is either incorrectly filtered for
string literal escape characters embedded in SQL statements or user input is not
strongly typed and unexpectedly executed. SQL injection is mostly known as
an attack vector for websites but can be used to attack any type of SQL
database.
Lab Notes
We use inject always true SQL statements into the SQL Injection User ID
field with security set to low.
We will obtain the username and raw-MD5 password contents from the
users table.
We will use John the Ripper to crack the raw-MD5 password HASH for
each user.
II. Virtual Machine Settings
1. Login to Metasploitable2
- Start up VMware Workstation
- Select Metasploitable2
- Play virtual machine
Login: msfadmin
Password: msfadmin
2. Login to Kali
- Select Kali
- Play virtual machine
Login: root
Password: toor
Note( kali 2020 is kali/kali)
2. Basic Injection
- Input “1” into the text box
- Click Submit
- Note, webpage/code is supposed to print ID, First name, and Surname to the screen.
Notes (FYI): Below is the PHP select statement that we will be exploiting, specifically %=$id.
$getid = “SELECT first_name, last_name FROM users WHERE user_id = ‘$id’”
CHARACTER_SETS,COLLATIONS,COLLATION_CHARACTER_SET_APPLICABILITY,C
OLUMNS,COLUMN_PRIVILEGES,KEY_COLUMN_USAGE,PROFILING,ROUTINES,SCH
EMATA,SCHEMA_PRIVILEGES,STATISTICS,TABLES,TABLE_CONSTRAINTS,TABLE_
PRIVILEGES,TRIGGERS,USER_PRIVILEGES,VIEWS,guestbook,users,columns_priv,db,func,
help_category,help_keyword,help_relation,help_topic,host,proc,procs
2. Open Notepad
Instructions:
Applications --> Favorites --> Programs --> Text Editor
Paste in Notepad
3. Save in Notepad
Instructions:
1. Navigate to --> /pentest/passwords/john
2. Name the file name --> dvwa_password.txt
3. Click Save
V. Proof of Lab Using John the Ripper
Instructions:
1. Bring up a new terminal
2. cd Desktop
3. cat dvwa_password.txt
4. john --format=raw-MD5 dvwa_password.txt