StackZero
  • Homepage
  • Cryptography and Privacy
  • Ethical Hacking
  • Reverse Engineering
  • Contacts
  • About Me
No Result
View All Result
StackZero
No Result
View All Result

Mastering DVWA SQL Injection: Medium Security with Burp Suite

October 14, 2023
in Ethical Hacking
0 0
Mastering DVWA SQL Injection: Medium Security with Burp Suite
0
SHARES
2.2k
VIEWS
Share on FacebookShare on Twitter

Welcome to our new write-up! Our focus today is on ‘DVWA SQL Injection Medium Burp.’ As we delve deeper into DVWA’s medium security setting, Burp Suite becomes our trusted guide, revealing the intricacies of SQL injection challenges. Before starting you need to configure your lab, and if you don’t know how to do it, here is a quick tutorial to use DVWA on TryHackMe.
I also assume you have a working attack machine, with the main tools installed (follow this tutorial if you don’t).

Let’s embark on this journey, enhancing our skills and fortifying our defences against sophisticated threats.

Here is the list of all the articles about SQL injection for quick navigation:

Table of Contents

Toggle
    • In-Band SQL injection
    • Blind SQL injection
  • Overview of the Vulnerable Application’s Functionalities
  • Unearthing Database Details with DVWA SQL Injection Medium Burp
    • Determining Column Count
  • Extracting Database Information
  • Unveiling Table Details with DVWA SQL Injection Medium Burp
  • Getting Columns’ Details
  • Unlocking Credentials
    • Fetching User Details
    • Cracking the Hash
  • Concluding Our Dive into DVWA SQL Injection Medium with Burp Suite

In-Band SQL injection

  • SQL Injection: What You Need to Know
  • Learn SQL injection in practice by hacking vulnerable application!
  • How To Hack With SQL Injection Attacks! DVWA low security
  • Hack With SQL Injection Attacks! DVWA medium security
  • Hack With SQL Injection Attacks! DVWA high security
  • Mastering SQL Injection on DVWA Low Security with Burp Suite: A Comprehensive Guide
  • Mastering DVWA SQL Injection: Medium Security with Burp Suite

Blind SQL injection

  • Blind SQL injection: How To Hack DVWA With Python (Low Security)
  • Blind SQL Injection: How To Hack DVWA With Python (Medium Security)
  • Blind SQL Injection: How To Hack DVWA With Python (High Security)

Overview of the Vulnerable Application’s Functionalities

First, adjust the DVWA difficulty to medium and navigate to the SQL Injection section.

Notice the absence of an input field for SQL injection.

DVWA first appearance

No worries. With Burp Suite, our approach remains largely unchanged from our previous guide on DVWA Low-Security SQL injection. The main difference? We’re dealing with a POST request.

Start by launching Burp Suite. Open its browser under the proxy tab and ensure “Intercept” is active.

Burp Suite Proxy

Next, on the DVWA page, submit a value. Observe the intercepted request in Burp Suite. The POST request carries its variables in the body, but our strategy remains consistent with the low-security level.

DVWA SQL Injection Medium Burp intercepted request

Send the request to the repeater (right-click->send to the repeater) to make it easier to send our future requests.
Given the IDs are likely stored as INTs in the database, we won’t need quotes. Test the waters with a simple payload:

AND 1=1#
DVWA SQL Injection Medium Burp first payload

No encoding is necessary since the data is sent via POST, not embedded in the URL. Forward the request.

If no errors pop up, bingo! We’ve identified an SQL Injection vulnerability.

SQLi result screen

So the game can start! Prepare yourself!

Unearthing Database Details with DVWA SQL Injection Medium Burp

Determining Column Count

Every SQL injection tutorial emphasizes the importance of identifying column numbers. Why? It’s crucial for leveraging the UNION clause effectively.

We’ll employ the ORDER BY clause. This clause sorts results based on column positions. If a column doesn’t exist for a given position, an error surfaces, revealing the column count.

Instead of automating this with the intruder (for which a guide is available here), we’ll manually send requests via the repeater. Here’s our approach:

1 ORDER BY 1 #
1 ORDER BY 2 #
1 ORDER BY 3 #
...

When we type the third command we get an error, so we know that the vulnerable query contains just two columns. Upon executing the third command, an error emerges. This confirms our query targets two columns.

DVWA SQL Injection Medium Burp column count

Extracting Database Information

Next, we aim to identify the DBMS and its version. Using the following queries, we can extract this data (note the “-1” ensures a singular result):

-1 UNION SELECT DATABASE(), VERSION()#
DVWA SQL Injection Medium Burp For DB info

Given that “VERSION()” is specific to MySQL, we ascertain the DBMS in use. Additionally, we determine the schema name as “dvwa“.

With this foundational knowledge in hand, we’re primed for the subsequent steps!

Unveiling Table Details with DVWA SQL Injection Medium Burp

Diving deeper, we now target table information. A challenge arises: we need strings without using quotes. The solution? Convert these strings into their hexadecimal form, a tactic we’ve previously explored.

Typically, to fetch table names, we’d use:

-1 UNION SELECT 1,table_name FROM information_schema.tables WHERE table_type='base table' AND table_schema='dvwa'; 

But, given our constraints, we’ll convert ‘base table’ and ‘dvwa’ to hexadecimal. While Python can achieve this (as demonstrated in a prior article), numerous online tools also exist. A quick “text to hex” search will yield many options. For our purposes:

dvwa = 0x64767761
base table = 0x62617365207461626c65

Sending our modified request, we’re greeted with:

DVWA SQL Injection Medium Burp For tables' info

From the response, two tables emerge:

  • users
  • guestbook

Of these, the “users” table piques our interest, promising valuable insights for our mission.

Getting Columns’ Details

Moving forward, our focus shifts to the columns within the “users” table. As before, we’ll employ hexadecimal conversion to craft our payload.

For “users”, the hexadecimal representation is:

users = 0x7573657273

With this in hand, our query to fetch column names becomes:

-1 UNION SELECT 1, column_name FROM information_schema.columns WHERE table_name='users'

After applying our hex conversion:

-1 UNION SELECT 1, column_name FROM information_schema.columns WHERE table_name=0x7573657273

Executing this, we observe:

DVWA SQL Injection Medium Burp For columns' info

Among the numerous fields, two stand out: user and password. These will be our focal points as we craft the final exploit.

Unlocking Credentials

Fetching User Details

We’re on the home stretch! To retrieve the usernames and their corresponding hashed passwords, we’ll deploy this concise payload:

-1 UNION SELECT user, password FROM users #

Upon executing, the results display plaintext usernames alongside their hashed passwords:

DVWA SQL Injection Medium Burp For getting credentials

While all users are intriguing, the “admin” account naturally catches our eyes.

Cracking the Hash

The challenge now? Deciphering the hashed password. Enter Rainbow Tables, a method to reverse cryptographic hash functions. A popular tool for this purpose is Crackstation.

By inputting our hashed password into Crackstation, we hope to unveil its plaintext counterpart:

Crackstation screen for get the password's plaintext

Success! The hash translates to the all-too-familiar “password“.

With this revelation, we confirm the credentials: username = admin and password = password. In real-world scenarios, such a discovery would grant us administrative access to the application.

Mission accomplished!

Concluding Our Dive into DVWA SQL Injection Medium with Burp Suite

In the ever-evolving landscape of cybersecurity, mastering tools like Burp Suite and understanding the intricacies of vulnerabilities like SQL injection are paramount. Our deep dive into DVWA’s medium security level has showcased the synergy between knowledge and the right tools. While this guide has provided a structured path, remember that the world of cybersecurity is vast, with endless avenues to explore and challenges to conquer.

Your engagement and feedback have been instrumental in shaping this guide, and I encourage you to continue this journey with us. For more insights, tutorials, and deep dives, don’t forget to follow our blog and stay connected with us on our social media channels. Your support fuels our passion, and together, we can navigate the complexities of the digital realm. Until next time, stay curious, stay safe, and happy hacking!

Tags: application securityctfdvwaethical hackingethical-hackingvulnerable applicationweb application securityweb exploitationweb security
Previous Post

Mastering SQL Injection on DVWA Low Security with Burp Suite: A Comprehensive Guide

Next Post

How Automate Malware Scans with VirusTotal API and Python: The Ultimate Guide.

Next Post
How Automate Malware Scans with VirusTotal API and Python: The Ultimate Guide.

How Automate Malware Scans with VirusTotal API and Python: The Ultimate Guide.

You might also like

Cryptographic functions

Cryptographic Hash Functions in Python: Secure Your Data Easily

November 3, 2024
Malware Obfuscation Techniques: All That You Need To Know

Malware Obfuscation Techniques: All That You Need To Know

March 25, 2024
How To Do Process Enumeration: An Alternative Way

How To Do Process Enumeration: An Alternative Way

March 4, 2024
How To Do DLL Injection: An In-Depth Cybersecurity Example

How To Do DLL Injection: An In-Depth Cybersecurity Example

February 8, 2024
Process Injection By Example: The Complete Guide

Process Injection By Example: The Complete Guide

January 24, 2024
How To Build Your Own: Python String Analysis for Malware Insights

How To Build Your Own: Python String Analysis for Malware Insights

November 10, 2023

StackZero

StackZero is a specialized technical blog dedicated to the realm of cybersecurity. It primarily provides insightful articles and comprehensive tutorials designed to educate readers on developing security tools. The blog encompasses a broad spectrum of subjects, starting from the foundational principles of cryptography and extending to more sophisticated areas such as exploitation and reverse engineering. This makes StackZero an invaluable resource for both beginners and professionals in the field of cybersecurity.
The blog covers a wide range of topics, from the basics of cryptography to the more advanced topics of exploitation and reverse engineering.

Tags

application security blind sqli blind sql injection bruteforce c cesar cipher command injection cryptography ctf cybersecurity debugging dom-based xss dvwa ethical-hacking ethical hacking exploitation file inclusion gdb hacking injection javascript malware malware analysis malware evasion network-security pentesting lab picoctf pico ctf python reflected xss reverse engineering sql sqli sql injection static analysis stored xss substitution substitution cipher vulnerable application web application security web exploitation web security windows windows api xss
  • About Me
  • Contacts
  • HomePage
  • Opt-out preferences
  • Privacy Policy
  • Terms and Conditions

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Manage Cookie Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Manage options Manage services Manage {vendor_count} vendors Read more about these purposes
View preferences
{title} {title} {title}
No Result
View All Result
  • Homepage
  • Cryptography and Privacy
  • Ethical Hacking
  • Reverse Engineering
  • Contacts
  • About Me