jSQL Injection usage guide: a multifunctional tool for scanning and exploiting SQL injection in Kali Linux
jSQL Injection is a multipurpose penetration testing tool. Its main function is to find and exploit SQL-injection vulnerabilities.
It is also able to:
- explore databases from remote host
- search for admin pages,
- read files from remote host using injection,
- create a web shell to remote host and open a terminal
- create a SQL shell to remote host and open a terminal
- upload a file to host
- brute-force hashes
- encode or decode a string
- test multiple URLs for SQL injection
To detect and exploit SQL injections, I usually prefer sqlmap. It is a command-line utility, it can do a lot of things, it uses all possible SQL injection methods, tries to bypass server protection, can create shells and much more.
It is also cross-platform, reliable and very effective.
Since sqlmap is extremely powerful and flexible, for the command-line program it means a huge number of different options.
For beginners this may seem too complicated.
JSQL Injection has an excellent graphical interface. The program is written in Java, it is cross-platform and very undemanding to resources. By the way, the executable file is only 2.14 megabytes.
But start in order – with the search for candidates for hacking. It will not be superfluous to recall that hacking is a criminal offense. Therefore, do not do anything that violates the law. Ideal (from the point of view of legality) is the use for training a vulnerable script on localhost or one of the specialized environments. Please, consider the articles:
1. Search for sites vulnerable to SQL injection
One of the ways to find vulnerable web sites is to use Google dorks. This table is borrowed from the site blackmoreops.com:
|Google dorks||Google dorks||Google dorks|
Open sites one by one from the search results and try to add a quote to a variable in the query string.
For example, the site address:
Then I try so:
If you receive any SQL error message, then the site is likely to be vulnerable to SQL injection.
In addition, often vulnerable sites in response to a quote character, do not display anything, or the behavior of the site gives grounds for assuming insufficient data filtering.
It is definitely not worth looking for SQL injection in popular CMSs.
Even if they are found there, they are almost always difficult to exploit.
If you read this guide, then it is for sure (yet) not your level.
Popular CMSs can become vulnerable due to vulnerable plugins (especially self-written ones).
However, again, this is not our level yet.
2. Installing jSQL Injection
jSQL Injection is already preinstalled in Kali Linux.
But the version there could be outdated is already available.
To check the latest release number visit the release page: https://github.com/ron190/jsql-injection/releases
To launch pre-installed jSQL Injection type in your console:
If you need, you can download the latest release:
Once the file is downloaded, start the tool like this:
The main window of the program looks like this:
By the way, this is one of those programs for pentesting that work fine in Windows.
To run in Windows, download the latest version from the official website: https://github.com/ron190/jsql-injection/releases
Run the downloaded file with a double click (you need to have a Java virtual machine).
3. Scanning a web site for SQL injection with jSQL
Working with the program is extremely simple. Just enter the address of the site and press ENTER.
The following screenshot shows that the site is vulnerable to three types of SQL injections at once.
We already got names of available databases.
Click on a database to explore its tables. You can see the contents of each table. Click on a table; wait for a list of columns appears:
Select columns of interest:
Click the table name by right button of your mouse and select ‘Load’:
The content of the table will appear:
Usually, tables with named administrator, users are the most interesting, because the can contain credentials.
If you are lucky and you found the administrator’s credentials, it is still not enough.
We still need to find an admin page where to enter these credentials.
4. Searching for admin pages with jSQL Injection
To do this, go to the next tab. Here we are met by a list of possible addresses. You can select one or more pages to check:
Convenience is that you do not need to use other programs.
Unfortunately, negligent programmers, who store passwords in clear test, are not very numerous. Quite often in the password line we see something like
This is a hash. You can decipher it with brute force. And … jSQL Injection has a built-in brute-force.
5. Brute-forcing hashes using jSQL Injection
Undoubted convenience is that you do not need to look for other programs. There is support for many of the most popular hashes.
This is not the best solution. To brute-force on maximum speed use Hashcat.
However, of course, when there is no other program at hand or there is no time to learn Hashcat, jSQL Injection with the built-in brute force function will be very useful.
There are settings: you can specify what characters are in the password, the length range of the password.
6. Operations with files after detection of SQL injections
In addition to database operations – reading and modifying them, in the case of detecting SQL injections, the following file operations are possible:
- reading files on the server
- uploading new files to the server
- unloading shells to the server
And all this is implemented in jSQL Injection!
There are restrictions – the SQL server must have enough privileges. Good system administrators disables it option and access to the file system cannot be obtained.
The presence of file privileges is easy enough to verify. Go to one of the tabs (reading files, creating a shell, uploading a new file) and try one of the specified operations.
Still very important remark – we need to know the exact absolute path to the file with which we will work – otherwise it will not work.
Look at the following screenshot:
Any response to a file operation is answered by us: No FILE privilege, and nothing can be done about it.
If instead you have another error:
This means that you have incorrectly specified the absolute path to which the file should be written.
In order to assume the absolute path, you need, at a minimum, to know the operating system on which the server is running.
To do this, switch to the Network tab.
Such a record (Win64 string) gives us reason to assume that we are dealing with Windows OS:
Here we have some kind of Unix (*BSD, Linux):
And here we have CentOS:
In Windows, the typical folder for sites is C:\Server\data\htdocs\.
But, in fact, if someone thought of making a server on Windows, then, very likely, this person has not heard anything about file permissions.
Therefore, the attempt starts directly from the C:/Windows/ folder:
As you can see, everything went fine from the first time.
But here I myself have doubts about the jSQL Injection shells themselves.
If there are file privileges, then you can download anything with the web interface.
7. Mass check of sites on SQL-injection
And even this function is in jSQL Injection. Everything is extremely simple – insert a list of sites (you can import from a file), select the ones you want to check and click the button to start the operation.
Conclusion on jSQL Injection
jSQL Injection is a good, powerful tool for searching and post-exploiting vulnerable to SQL injection web sites.
Its undoubted advantages: ease of use, built-in related functions. jSQL Injection can become a novice’s best friend when analyzing websites.
Like all tools with a graphical interface, it cannot be automated in scripts.
Nevertheless, some automation is possible in this program as well, thanks to the built-in function of mass web site scanning.
The jSQL Injection program is much easier to use than sqlmap.
But sqlmap supports more types of SQL injection, has options for working with file-based firewalls and some other functions.
Outcome: jSQL Injection is the best friend of a beginner hacker.