Netsparker and SQLmap: scan sites for vulnerabilities. A guide for the smallest and most patient.

Jollier

Professional
Messages
1,127
Reputation
6
Reaction score
1,102
Points
113
In previous articles, we have already talked about how to test a site for vulnerabilities using the simplest tools.

Today we will work with professional software. Namely with Netsprker and SQLmap. It's time to get rid of the pacifier, which is played by programs such as Webcruiser and Albaloo. To begin with, I suggest downloading everything that we will use throughout the article.

It is impossible not to mention that this particular "bundle" was used in 2016 by the American hacker Ray Buttler right from prison and achieved impressive results by opening several clandestine "shops" and bitcoin exchanges. Gone are the days, but do not forget that 19% of web applications have vulnerabilities that allow them to gain control over both the application itself and the server OS. Netsparker will find them.

We will consider working with the software under Windows, since NetSparker works only on this platform. However, the author recommends using Kali Linux and NetSparker on a virtual machine.

Netsparker 5.0.0.19747 - The version I'm using.
Netsparker 5.3.0.24388 - Newer than mine, but generally no different except for possible additional functionality), so this article should be relevant for this version of
SQLmap git or Sqlmap Git rar
Python 2.7 (for working with SQLmap)
Burp Suite

Why exactly Netsprker and SQLmap?
NetSparker is a powerful scanner, SqlMap is a console tool for exploiting found vulnerabilities.

Netsparker is a powerful scanner of online resources, sites and web applications for errors, vulnerabilities and minor bugs. In the course of work, he generates a report, describing in as much detail as possible each part of the scanned resource, drawing up its “map”. Flexible settings, an intuitive interface, prompts and a huge base of vulnerabilities, plus a unique tool for detecting false positives, make this tool the de facto leader in the industry. It also has disadvantages: NetSparker is a heavyweight, scanning a resource can take hours, but at the same time the “sparker” will run the site and all its applications for all possible and impossible variants of vulnerabilities.

NetSparker is far from the only tool of this kind, there are other good scanners like ZAP, which I will talk about next time.

Since, before proceeding directly to exploitation, vulnerabilities must be discovered, therefore, first we will talk about Netsparker. Next, we will look at the basic principles of attacking these vulnerabilities using SQLmap.

In order to open the program, you need to double-click on the Netsparker.exe file. After starting the program, we see the following:
izobrazhenie-270-1024x618.png


The start window of the program has six sections, which we should consider:
1-1.bmp

  • 1 - Field for entering the crawled site. The button built into the input field (the rightmost one, with a green arrow) opens the site that we introduced earlier. Also netsparker remembers the sites that we have already scanned and by clicking on the down arrow, which is located slightly to the left of the button, we can see them. It is very convenient if you suddenly need to go back to rescanning previous sites.
  • 2 - For each crawled site, the program remembers the settings (which we will consider below), and this item allows you to save and select the crawl settings for the selected site. As follows:
    izobrazhenie-12-1.png

    Save Profile - Save settings
    Save As New Profile - Save settings for this scan separately
    Default - Standard scan
    Previous Settings - Previous scan settings
  • 3 - Site scan settings
  • 4 - Authentication settings on the crawled site. An optional menu, but very useful if you need to scan a resource through your personal account
  • 5 - Field of settings for each item of the third and fourth menus
  • 6 - Start button and cancel button. It is worth mentioning that this item also has its own “settings” window:
izobrazhenie-15-1.png

Start Scan - Getting started. No problems.
Crawl and Wait - Crawl without attacks.
Manual Crawl (Proxy Mode) - The same quiet mode, but through a proxy. I must warn you that you will need to install the certificate:
izobrazhenie-17-1.png

Scan Imported Links Only - Scans only specific links.
Schedule Scan - scheduled scanning.

After we have disassembled the interface, it's time to start a detailed study of the menu items. First, let's look at the third section - Scan Settings. We see five items in total. Let's consider them in order

General
Basic settings.

izobrazhenie-18-1.png


Let's start by looking at Scan Policy. These are the rules by which the resource will be scanned. Using this item, you can optimize our scan if we already have any information about the target. To do this, you need to click on the button that resembles a magic wand:
izobrazhenie-19-1.png


The following menu opens:
izobrazhenie-20-1.png


This is the welcome window. You can skip it. We look further.

izobrazhenie-21-1.png

Here we select the operating system installed on the scanned server.

izobrazhenie-22-1.png

In this window, we have to select the server installed on the scanned machine.

izobrazhenie-23-1.png

The fourth window is the choice of the language in which the applications of the scanned resource are written. You can select several at once if you are not sure.

izobrazhenie-24-1.png

In this window, select the database that the scanned resource uses. You can choose several if you are not sure.

izobrazhenie-25-1.png


At this stage, we indicate the amount of dynamic content on the site:
Little or no dynamic content - there is little dynamic content, or it is decorative, that is, it does not interact in any way with the back-end of the
Moderately sized dynamic web site - there is a lot of dynamic content and pages with it. Most sites fall into this category.
Complex Single-Page-Application - Complex applications that update the content of one page.

izobrazhenie-26-1.png

The seventh window is the search for hidden content. Netsparker enumerates the possible names and names of the contents of the remote server. Here it is possible to set a search limit.

izobrazhenie-27-1.png

The latter is a report of the parameters we selected earlier.
Scan Policy Name - the name of the created / optimized policy by us.

Click Finish, and in the main menu of the scan settings, we can select our policy. It usually becomes active by default.

izobrazhenie-28-1.png


The next thing we will look at in the main menu is the Report Policy. These are the items on which the program will report. If it is important for you to know only one detail, for example, whether the target has a vulnerability to the same SQL injection, click on three dots and from the entire list, leave only the SQL injection checked:

izobrazhenie-29-1024x617.png

izobrazhenie-31-1.png

Conveniently, the list is sorted from minimum to maximum.

It is better not to disable anything here - let the report be as complete as possible.

Custom Cookies is a menu item where you can insert your own cookies, for example, intercepted ones:
izobrazhenie-32-1.png


The last point - setting up the Crawling AKA making a sitemap

izobrazhenie-34-1.png


Find & Follow New Links - Follow the found links.
Enable Crawl & Attack at Same Time - Attack simultaneously with scanning
Pause Scan After Crawling - Stop the software after drawing up a complete sitemap.
Incremental Scan - Augmented scan based on the previous scan. Cannot be used without a finished resource card or on a new scan

Scope
Scan area settings

izobrazhenie-35-1.png

Includes only three fields:

Scope
Select the scan scale:
izobrazhenie-36-1.png

Entered Path and Below - Scanning a page and deeper
Only Entered URL - Scanning only an entered page
Whole Domain - Scanning an entire domain

Next - Exlude URLs with RegEx

izobrazhenie-37-1.png

Exceptions. Regular expressions, pages with which the program will skip

To invert this function, just mark Include instead of Exclude in the lower right corner of this item:
izobrazhenie-39-1.png


Inlude URLs with RegEx - Regular expressions, pages with which the program will crawl first

izobrazhenie-38-1.png


Disallowed HTTP methods - Disallowed request types

izobrazhenie-40-1.png


In total, the program supports 13 types of requests:
izobrazhenie-42-1.png


We select the methods of requests to the server, turn on everything and we will not change anything here.

I will not describe each of them in detail, since this information is not necessary in our case and can easily be found on the Internet.

Additional Websites
Additional sites and links to crawl

izobrazhenie-44-1.png

The fact is that netsparker does not scan pages that have a different domain from the main one. As an example, I can cite my previous article, where there was a site ixi.store. When switching to the affiliate program, we were transferred to the partner.ixi.store domain. So the program will scan only ixi.store, but will not compile a sitemap of partner.ixi.store

Therefore, to achieve a full scan, you need to add this domain to the augmented scan lists:
izobrazhenie-46-1.png


To do this, just insert the link we need into the text field and click on the square on the right in the Canonicial column to make a check mark appear. It is also worth warning that the program accepts links only in the correct form. That is, in the form of . Links like partner.ixi.store will be considered incorrect:
izobrazhenie-47-1.png


Imported Links
Links that the netsparker will crawl in addition to the main domain. Also, when the Scan Imported Links Only button is selected, the program will scan only what we have thrown here.

izobrazhenie-48-1.png

Let's explore the main functions of this menu.

Add - adding links

izobrazhenie-49-1.png


After clicking on this button, a new configuration window opens:
izobrazhenie-50-1.png


This is a form for creating a request for scanning and adding a link to the list of scanned. It's very simple, because the program will do everything automatically for you.

Let's say we have a link that we want to add. To do this, just insert this link into the Host line. The domain that we will scan is usually entered there. But if we are going to “conduct an investigation” on individual links and sites, we can safely paste the copied into this field. The program will automatically edit everything:
izobrazhenie-51-1.png


If we have a completely different site in the scan profile, the netsparker will warn us about this and suggest changing the header.

izobrazhenie-52-1.png

Yes - Change
No - Do not change

Edit - edit the entered link. The same can be done with two clicks on the desired line.

izobrazhenie-53-1.png


Delete - delete the selected line. Another option is to press the delete button on your keyboard

izobrazhenie-54-1.png


Clear - complete clearing of the list, deletes all lines

izobrazhenie-55-1.png


Search - search through the list. This function can be called by the key combination Ctrl + F

izobrazhenie-56-1.png


Import From File - import data from files. It also accepts reports from other programs:
izobrazhenie-57-1.png


After choosing the type of imported file - select this file on your computer.

Enter Links - manual entry of links.

izobrazhenie-58-1.png

In addition, you can choose the format of the links you enter. In my case, it's Relative or Absoute Links

izobrazhenie-59-1.png


After entering the links, we see the following picture:
izobrazhenie-61-1.png


Everything was imported successfully

URL Rewrite
Link conversions. This makes it much easier for search engines to index all pages on the site.

izobrazhenie-62-1.png


Use Heuristic URL Rewrite Support - The program will automatically detect other URL rewriting rules. Both custom and heuristic rules will also apply.

izobrazhenie-63-1.png

Root Path Maximum Dynamic Signatures - maximum dynamic signatures in the root path. By default, their value is 60.

Sub Path Maximum Dynamic Signatures - maximum dynamic signatures of the sub path. Usually the value is 30.
Block Separators - separators. Classic separators are / $.,; |:
Analyzable Extensions - extensions that will be analyzed. In our case htm and html.
Use Custom Rewrite Rules - netsparker will use custom (custom) link rewriting rules.

izobrazhenie-64-1.png

To create / test a rule - click on the New button

izobrazhenie-65-1.png


A window opens where we will edit the link for the example. We will use .

izobrazhenie-66-1.png


Here we need to choose where we will rewrite and what:
izobrazhenie-68-1.png


Select the parameter to be overwritten, select its type and enter the name of the parameter. There are a lot of parameter types, but if you don't want to mess around, choose Any.

izobrazhenie-69-1.png

After these actions, we can observe how the program itself creates regular expressions and executes new rewriting rules.

izobrazhenie-70-1.png


To delete a rule, select the required line and click on Delete:
izobrazhenie-71-1.png


No URL Rewrite - do not convert links

izobrazhenie-73-1.png


We're done with this menu. It remains to consider the Authentication menu. This menu is responsible for configuring authentication on the scanned resource. Sometimes a resource can be closed, and for a full report you will need to log in to it.

We will consider this function through authorization at php.testsparker.com. It is intended for testing the netsparker, and it seems to me that it is great for an illustrative example. Let's start!

Form
Select a form for authorization on the resource.

izobrazhenie-74-1.png


To “enable” automatic authorization, you must check the Enabled box:
izobrazhenie-75-1.png


Now we need a link to the data entry form to enter the personal account. In our case, this is the link http://php.testsparker.com/auth/login.php. We enter it in the Login Form URL:
izobrazhenie-76-1.png


After that, enter your login information. They are entered in the Personas field.
Active - selection of a combination of login and password that will be used
Username - Username
Password - User password

We will fill in the data as follows:
Login - admin
Password - admin123456
These data are written on the site itself:
izobrazhenie-77-1.png


After entering, everything should look like this:
izobrazhenie-79-1.png


There are also settings for authorization by login and password. We'll look at them in turn:
izobrazhenie-80-1.png


Interactive Login - The program enters data and then transfers control to the user. It is mainly used to bypass captcha, the user of the program enters it here manually, and then completes the authorization and transfers control back to the program.

Override Target URL with authenticated page - Use the final page of the authentication process at the beginning of the entered url. If this option is selected, then netsparker will not make a request to the specified target url.

Detect Bearer Authorization Token - if an AJAX request is received after authorization on the site, the intercepted tokens will be used for scanning.

Now let's verify the login and logout functions. This is done using the Verify Login & Logout button. It looks like this:
izobrazhenie-81-1.png


Immediately (or almost immediately) a window opens:
izobrazhenie-82-1.png


This window can be roughly divided into two sections:
izobrazhenie-83-1.png

  • 1 - Input check section
  • 2 - Output check section
Immediately after opening this window, netsparker will begin initializing the login.

The circles in the lower right corners of the sections will indicate the work done. They are yellow by default. Look like this:
izobrazhenie-85-1.png


Immediately after the initialization of the input, work on the output begins. The completed work will look like this:
izobrazhenie-84-1.png


If the program has coped with the task, the circle in each corner will be green:
izobrazhenie-87-1.png


You can check if the login page is verified in the settings menu of the authentication form, which we reviewed earlier. The following message should have appeared next to the Enabled item:
izobrazhenie-88-1.png


If the login has not been verified, we will write login scripts. It's not as complicated as you might think. I'll help you. To create a "plot" according to which the netsparker will initialize the input, click on the Custom Script item:
izobrazhenie-89-1.png


After clicking, the program itself tries to explain to us how we will write scripts:
izobrazhenie-90-1024x612.png


I created this script earlier, so let's look at the left menu first. I will explain how scripts work

netsparker.auth.login (username, password); - the command should be the default. This is the initialization of variables with a login and password, which we entered into the form at the very beginning.

As I understand it, the program fills in the form using a CSS selector, which is copied automatically.

In order to create your own script, right-click on the login field. We are looking for it in the window on the right:
izobrazhenie-91-1024x613.png


Right-clicking on any item will always bring up the same menu. It consists of four points, of which we will use only two at most. But we will analyze everything at once:
izobrazhenie-92-1.png


Log element to console - logging of the selected element to the console. A very convenient thing to avoid looking for an element in the element code

izobrazhenie-93-1.png


After clicking on this item, find our element in the console below:
izobrazhenie-94-1.png


This function is very convenient if we need to conjure with an element separately. For example, copy Selector, or just change.

Generate Element code - automatic generation of code using the selected element.

izobrazhenie-95-1.png

After clicking on this item, a line of code appears in the left menu.

izobrazhenie-96-1.png

Of course, we will not understand anything right away, so I will specially analyze the line of this code for you:

netsparker.auth.setValueByQuery ('# content> div.post> form> input [type = ”text”]: nth-child (1)', username);

It consists of four elements
  • 1 - netsparker.auth.setValueByQuery - defining actions to be performed on the element from which the first part is netsparker.auth. always static. The second part of the first element is of two kinds: setValueByQuery and clickByQuery. In the case of setValueByQuery, the program will write the data. clickByQuery, on the other hand, initiates a click on an element, it is usually used for buttons and other elements, such as links, etc.
  • 2 - '#content> div.post> form> input [type = ”text”]: nth-child (1)' - this is the path to the element to which the actions described in the first element will be applied (respectively, this is either a click, or data entry). The path to the element is described in the form of a CSS Selector. To get such a path ourselves, we turn to the Log element to console, where in the console we copy Selector. Thus, we get an identical path that can be entered manually. For example, the path to the password field would be content> div.post> form> input [type = ”password”]: nth-child (3). Copied this from the console like this:
    izobrazhenie-97-1.png
  • 3 - username or password. These two variables were initialized with the first line netsparker.auth.login (username, password); ... Works only on text fields. As you understand, we are not going to enter anything into buttons, so these variables are applied only for text fields.
  • 4 - Pause element. Together with it, we will consider the last point - Generate element code (delay 2000ms):
izobrazhenie-98-1.png

This item adds a pause. By default, this is two thousand milliseconds (which is equal to two seconds). This value is appended in the case of a text field after the entered variable, for example, username:
izobrazhenie-99-1.png


If we talk about buttons, then clicking on the authorization button will look like this: netsparker.auth.clickByQuery ('# content> div.post> form> input [type = ”submit”]: nth-child (7)'); ... In the case of a pause, the value is appended immediately after the path, since the variables, as I said, do not take any part. The pause option looks like this: netsparker.auth.clickByQuery ('# content> div.post> form> input [type = ”submit”]: nth-child (7)', 2000);

Now let's formulate the mask by which the code is built:
What to Do ('path', variable, pause);

Now with this knowledge, we can write our own script (or generate via Generate element code ). The finished version will look like this:
izobrazhenie-100-1.png


To test it, click on the Test Script button:
izobrazhenie-101-1.png


And we observe the work of the script:
izobrazhenie-102-1.png


If everything works, click on OK, after which we are thrown into the main start menu, and the Custom Scripts item is replenished:
izobrazhenie-103-1.png


We are done with this point.

Basic, NTLM / Kerberos
Authentication via Basic, NTLM and Kerberos protocols

izobrazhenie-104-1.png

We will linger on this topic a little longer to figure out what kind of protocols they are.

The basic protocol can be found, for example, when trying to connect to FTP of any site through a browser.

izobrazhenie-105-1.png


NTLM is a network authentication protocol that was developed by Microsoft specifically for its operating systems

Kerberos is also a network authentication protocol, the mechanism of which is mutual authentication between a client and a server. It is also supported by operating systems of the Windows family. A more secure protocol based on the Single Sign-On principle

In addition to these three, the program supports two more types: Digest and Negotiate. Consider them as well:

izobrazhenie-108-1.png

Digest (commonly known as a digest) - This is commonly used by web servers to process user credentials entered into a web browser. A similar method uses VoIP

Negotiate is a scheme inherent in the Windows family that offers a choice between NTLM and Kerberos

Now we can start studying the form itself. It consists of five elements - the type of authentication (there are only five types that the program supports: Basic, NTLM Kerberos, Digest and Negotiate)

izobrazhenie-106-1.png

  • 1 (Type) - Authentication type.
  • 2 (URL Prefix) - URL to be logged in.
  • 3 (Username) - Username
  • 4 (Password) - User password
  • 5 (Domain) - Domain, optional item.
To test the entered credentials or just look at the work of the program - use the Test Credentials button

izobrazhenie-107-1.png

There is also one more setting, the last one in this window.
Do not expect challenge (Basic Authentication) - means that after authentication no problems or additional requirements should arise, just like with basic authentication

izobrazhenie-110-1.png

In addition to all this, there are tips for each item in the netsparker. They are located at the bottom of the menu:

izobrazhenie-111-1.png

Therefore, if you did not understand anything from what I told you, you can read the tips. And we go to the next point.

Header Header customization.

izobrazhenie-112-1.png

In some cases, resources use headers for authorization. This menu is necessary to indicate these very titles. It is worth paying attention to the hint, which says that the title should contain only ASCII characters. Now about its functionality. There are only two settings here:
Name - the name of the title
Value - the value for the title.

Example: name is auth, value is true. It will look like this:
izobrazhenie-113-1.png


You can use a kind of built-in constructor, which is called on the Add Authorization Header button

izobrazhenie-114-1.png

After clicking on this button, the following window opens:

izobrazhenie-115-1.png

In Type we select the type, and in Credentials the same value.

izobrazhenie-117-1.png

In order not to get stuck at this point, I will enter a random value in order to show what is written at the output. To save the data, click Save

izobrazhenie-116-1.png


To delete a line - click on any value ( Name or Value ), and press Delete:
izobrazhenie-118-1.png


Client Certification
Client certificate for authorization on the resource

izobrazhenie-119-1.png

By default, this is DO_NOT_TRUST_NetsparkerRoot, but you can add your own by clicking on the Add New button

izobrazhenie-120-1.png

The program accepts PFX and P12 files

PFX and P12 are extensions to the PKCS # 12 standard. It did not become clearer, as I see it. This standard is used in cryptography. The very name PKCS is an abbreviation for “Public Key Cryptography Standards”, which translates as “Public Key Cryptography Standards”. In our opinion, PKCS will sound like SKOK. In our case, this is PKCS # 12, which is a file format for storing keys that is recognized and used by many browsers and email agents. PFX and P12 are the same extensions.

Smart card
Authentication on the resource through a readable card.

izobrazhenie-121-1.png

If you have a similar card - activate the item

izobrazhenie-122-1.png

To add data - click on Import Smart Carf Certificate

izobrazhenie-123-1.png

Then netsparker will start looking for a driver for reading cards, and then save the certificate it read.

izobrazhenie-124-1.png

After reading the card, enter the pincode in the PIN field, and click on Get Certificates. After this procedure, click Import and in the main menu select the certificate we need, which the program read earlier.

We have disassembled the scan setting. Now we can proceed to the main window of the Netsparker program!

Let's start a test scan.

izobrazhenie-125-1024x618.png

  • 1 - Main pages of the program. During the scan, two more are added: Link and Vulnerability .
  • 2 - Menu with items and functions. For each page, everything is different and in different quantities. Lord, I still have to consider each of them ...
  • 3 - Sitemap generated by the program during scanning.
  • 4 - Controlled scanning. You can check the items from the third menu (which will appear in the upper Choose Parametrs to Scan window) separately for the parameters selected in the Choose Security Tests window. By the way, this is a very useful item if in the scan parameters you have chosen only to draw up a map without attacks. Thus, you can hit the right nodes clearly, and not rape the entire site, as it happens with a normal scan.
  • 5 - Window with the most detailed scan report (and not only).
  • 6 - List of found items, grouped by netsparker database. Easier to show in practice.
  • 7 - Brief information about the scan. Scanning speed (currently and average), number of requests, failed requests, time spent.
  • 8 - Found vulnerabilities, potential vulnerabilities, flaws and general information about “problem” areas.
  • 9 - Program log, report on work.
So. Let's do a full scan of php.testsparker.com. Just a scan, no settings. Unless we'll add authorization via login and password. How to do it - see above. Just in case, let me remind you:

izobrazhenie-126-1.png

Now let's wait a bit to see the full picture.

izobrazhenie-128-1024x619.png

This site was created specifically to test the program, so it contains all possible holes, flaws and vulnerabilities. We are better off, because we can see what the program is capable of.

First, let's examine the functions of menu number one (1):
izobrazhenie-130-1.png


File
Work with program files. Import, export, etc.

Let's examine this function:
izobrazhenie-132-1024x618.png


All autosaves and saves of previous scans are located here. To load - we find the save we need and load it by double clicking on it.

You can upload someone else's (or your own, if saved separately) report using the Browse button

izobrazhenie-133-1.png

To export a report, use the Export button in the left menu

izobrazhenie-134-1.png


Then we create a file with the nss extension. In fact, two files are created:
izobrazhenie-135-1.png


Everything is in order, part is the report, part is the base of the report.

After that, the data download icon appears in the center of the screen:
izobrazhenie-136-1.png


When the download is over, the Home page will open. And to return to it without loading the report, there is a button in the upper left corner:

izobrazhenie-137-1.png


You can also look at the beautiful and minimalistic design of the About window:
izobrazhenie-138-1.png


Well, and Exit, if you are suddenly tired of everything and want to do something else:
izobrazhenie-139-1.png


All clear? It's strange if not. If it's still not clear, read it again.

It's time to deal with the Home tab.

izobrazhenie-140-1.png

New - new scan

izobrazhenie-141-1.png


Schedule Scan - scheduled scanning.

izobrazhenie-142-1.png


Incremental Scan - Augmented scan based on our

izobrazhenie-143-1.png


Schedule Incremental - a postponed additional scan that requires entering a report on which the work will be carried out.

izobrazhenie-144-1.png


New Instanse - opens a new netsparker.

izobrazhenie-145-1.png


Retest all - retest all found vulnerabilities to find out if they were fixed or not. Useful if you are checking your resource.

izobrazhenie-146-1.png


Hawk Check - check for Out-of-band vulnerabilities. These vulnerabilities are vulnerabilities such as the: The Blind the SQL Injection, The Blind Cross-site the Scripting etc .. It also applies to post-scan.

izobrazhenie-147-1.png


Import - import report \ session

izobrazhenie-148-1.png


Export - export our session \ report

izobrazhenie-149-1.png


Scan Policy Editor - editing the resource scan policy:

izobrazhenie-150-1.png

Consider this point.

izobrazhenie-151-1024x639.png

Here you can change the policy right during the scan. For example, if during the scan it turned out that this is a Linux system, all tests under Windows can be disabled to speed up the work.

If we look at the interesting things, then there are a couple of quite tasty parameters. For example, a list of ignored mail accounts. If you have similar ones, write them down. The item is called Ignored Email Addresses

To configure, copy the Extensive Security Checks item. To copy an item, first select the item we need, and then click on the Clone button:
izobrazhenie-152-1.png


The copied item will appear at the very bottom.

Security Checks - Vulnerabilities for which the resource will be scanned.

izobrazhenie-153-1024x477.png


Moreover. Each vulnerability has its own scan settings. For example, take our favorite SQL injection:
izobrazhenie-154-1.png


Crawling - search for links, drawing up a sitemap, studying a resource.

izobrazhenie-155-1024x471.png


Crawling Page Limit - Page limit.
Maximum Signature - the maximum number of site signatures
Maximum Page Visits - The maximum number of visits to the site pages
Wait for Resource Finder Checks to Finish - waiting for the resource search check to complete
Text Parser - parser text from the crawled resource
Parse SOAP Web Services - A type of parsing of WSDL files (WSDL is a language for describing web services and accessing them)
Parse REST Web Services - Parses WADL files and Swagger (framework and specification for defining REST APIs).
Fallback to GET - can we get to work already? no? okay... The program sends special HEAD requests to reveal hidden files and directories. If all else fails, the netsparker reverts to the GET option. Usually off
Add Related Links - Specifies whether to crawl all related links when a new one is found. Adds all related links to the sitemap. Usually included
Enable Parameter-Based Navigation - if the target website uses parameters to work with content other than pages. For example, instead of the page tovar.php, it uses a parameter like page = tovar. Usually off
Navigational Parameter RegEx - navigation regular expressions for the program to work by resource.
Maximum Page Visits - the maximum number of visits to a page that contains navigation parameters, we talked about them above.

izobrazhenie-157-1024x474.png


Load Preset Values - Load presets of all items for different types of sites.
DOM Load Timeout - Timeout in milliseconds to wait for the site page to load before starting the JS DOM simulation. DOM stands for Document Object Model, which translates to “ Document Object Model”. A programming interface that allows programs and scripts to access the content of HTML and XML files.
DOM Simulation timeout - Timeout in milliseconds (all timeouts are in milliseconds, I won't write this anymore, that's all) before the end of the JS DOM simulation.
Intervent Timeout - timeout after a JS event trigger before new events start. Just like in life.
Max Simulated Elements - the maximum number of elements in the simulation.
Skip Threshold - Skip threshold. The number of elements that will be simulated / simulated before starting the total skip of all other elements.
Elements to skip - the number of skipped elements after passing the skip threshold (referring to the point above).
Max Modified Element Depth - The simulation begins to skip examining each of the cascading elements after passing through the depth threshold.
Pre-simulation Wait - timeout before starting simulation / simulation and after loading the page

Exclude by CSS Selector - Exclude HTML elements from event modeling using the CSS Selector function. All matching elements will be excluded, including their derivatives. We will have to select the elements manually:
izobrazhenie-159-1024x702.png


After completing the work, click on Select, and enjoy the recorded data.

Max Option Elements - the maximum number of optional elements per selected element to simulate.
Persistent JavaScript Cookies - Semicolon - separated cookie names.
Open Redirect Conf. Timeout - timeout before the end of the JS DOM simulation to confirm an open redirect. How. Where - do not ask. Where the redirection goes there and there will be confirmation.
XSS Confirmation Timeout - timeout before the end of the JS DOM simulation for XSS confirmation. Yes, there is such a thing too.
Filter document events - Filter the events attached to the document by name to reduce the number of events triggered during simulation.
Ignore document events - ignore events attached to a document
Filter 'colon' events - filter for events containing a colon. Commonly used by frameworks.
Extract static resources - Extract static resources from DOM elements.
Allow out-of-scope XML HTTP requests during simulation - A useful feature if the target is not unloaded due to a curved scan profile setting

Now we are gradually moving on to other settings.

Attacking

izobrazhenie-161-1024x472.png

Maximum Number of Parameters to Attack on Single Page - the maximum number of attacked parameters on one page.

Enable Proof Generation - generate an exploit report after confirming a vulnerability.
Attack Parameter Names - Generate additional. attacks using the name of the request parameter.
Attack User-Agent Header - Generate additional. attacks using user agent header
Optimize Header Attack - I didn't understand how this function works. I only understood that the header attack will target all links
Optimize Attack to Recurring Parameters - search for duplicate parameters in different URLs. Attacks everything that is included in the limit on the attacked elements on the page (Maximum Number of Parameters to Attack on Single Page)
Recurring Parameters Attack Limit - page limit for attack by repeated parameters
Anti-CSRF Token Names (Comma Separated) - comma separated names of tokens for protection against CSRF attacks ( Cross Site Request Forgery in translation as “cross-site request forgery”)
Enable Random Parameter Attacks in Cross-site Scripting Engine - using additional parameters on pages to detect vulnerabilities such as Cross-site Scripting

We continue to suffer, learning all the functions of the program.

Custom 404

izobrazhenie-162-1024x474.png

Setting up 404 pages, as I understand it. Some sites use their own beautiful ones. And now they are very different from the standard 404. So that the program does not be stupid and does not scan empty answers, we choose what values the 404 pages have to detect them.

Auto Custom 404 - Automatic recognition. You need to enter the maximum number of 404 signatures.
Manual Custom 404 - You will have to enter the regular rules for 404 manually.
Disabled - standard 404.
Maximum 404 pages to Attack - the number of 404 pages to bypass and attack.

Go to the Scope item

izobrazhenie-164-1024x477.png

Case Sensetive - Increased SQL Injection Report. Although the scan will be more sensitive, the result was never affected, no matter how much I used netsparker. And by default it is usually always off.

Bypass Scope for Static Checks - detection of vulnerabilities even if a scan is specified from a specific page and further, without going down to the domain.
Enable Content-type Checks - the program will ignore and not analyze pages whose content title matches the values given in the list.
Block Ad Networks - Always on. If there is a link to an advertising resource from the list, the program will ignore the scan of this resource.

Next on the list is Ignored Parameters

izobrazhenie-165-1024x613.png

Parameters are simply ignored.

closer to the end - Form Values

izobrazhenie-166-1024x473.png

Form data. You can add your data via URL or by uploading past scans. We will consider this as regular rules.

Brute force

izobrazhenie-167-1024x477.png

Netsparker has about sixty brute force combinations. You can use this function to check for standard login form passwords.

Autocomplete

izobrazhenie-168-1024x473.png

Data for searching forms with autocomplete.

Netsparker hawk

izobrazhenie-170-1024x475.png

It's simple, setting up one of the post-scans. The URL is inserted by default.

Ignored Email Adresses

izobrazhenie-171-1024x477.png

regulars of ignored mailboxes.

CSRF

izobrazhenie-172-1024x474.png

Configuring a CSRF attack

Web Storage

izobrazhenie-173-1024x476.png

Web storage

Auto Send To

izobrazhenie-174-1024x477.png

Configuring Automatic Submission

Extensions

izobrazhenie-175-1024x479.png

Scanned extensions and some settings for them: Attacked parameter or not, investigate or not, and so on. To change this or that parameter - click on it and select the option you need from the list.

Go to the HTTP tab

Let's examine the Request item

izobrazhenie-176-1024x478.png

User Agent - data of user agents. Name and meaning

Requset Timeout (seconds) - the program will retry the request if the previous request took more than the specified time. This time the timeout is set in seconds.
Accept - setting the headers that the netsparker will use in all requests.
Accept Charset - setting the encoding for all subsequent requests.
Accept Language - Setting the language that will be used in all requests

Then there are just three checkboxes: Gzip support, server load reduction, cookie support.

Concurrent Connections - the number of connections to the target. If you put too much, there may be connection problems and / or server failure (DoS). Haha, dudos

The second point is Proxy

izobrazhenie-177-1024x479.png

Setting the used proxies for the scan. You can chop up your proxies, just like in my last article about brute force, where you can connect your account with proxies to the program

izobrazhenie-178-1.png


Penultimate item - Headers

izobrazhenie-179-1024x478.png

This is the setting for the headers.

The last one is SSL / TLS

izobrazhenie-180-1024x476.png

Configuring supported protocols.

Now the third menu item is Knowledge Base.
And immediately the first page of the menu - General

izobrazhenie-181-1024x478.png

Connecting this very base to the scan. The thing is useful, we leave it on.

The last item in this window is Comments

izobrazhenie-182-1024x476.png

Regular expressions for finding information from comments. You can add your own search terms if you know what to look for.

Everything! We can go back to the program itself. I hope there will be no more such large-scale menus.

We continue to explore our top menu:
izobrazhenie-184-1.png


There are a couple of unstudied items left for eac. For example, Report Policy Editor

izobrazhenie-185-1.png


In fact, this is a configuration of vulnerabilities, the presence of which will be reported by the program:
izobrazhenie-183-1024x617.png


Another important point is Options

izobrazhenie-186-1.png

These are program settings. Everything is very simple and straightforward, let's figure it out. Believe me, you will come here sometimes. Not as often as in the scan settings (which I will dream about after this article), but you will go.

This is what the window looks like:
izobrazhenie-187-1.png


Now everything is in turn.

General

izobrazhenie-188-1.png

Language - the language of the program. Usually only two languages are supported: English and Korean.

Sounds - setting the sounds of the program. Type of sound notifications when a vulnerability is “caught”

To add your own sounds or customize existing ones, there is a Configure sounds button :

Storage

izobrazhenie-190-1.png

Setting up storage locations.

Data Directory is a storage location for scanned data and the like.

Password Encryption Scope - sorting passwords for setting up authentication.

Internal proxy

izobrazhenie-191-1.png

Internal proxies.

Listening port - proxy port

Register as the System Proxy - connecting the system proxy settings from IE.

Allow Remote Connections - the program will listen to all connected interfaces "from outside"

Use Custom Root Certificate - use your own root certificate. The program will read files with the extension. cer and. pfx (we talked about them earlier, by the way).

Logging Level

izobrazhenie-192-1.png

Logging and customization.

Enable Logging - Enables the logging function.

Performance Analysis - Performance analysis.

Show Attack Possibilites Knowledge Base Node - show potential vulnerabilities of a node in the Knowledge Base function tree.

Default Log Level - Select what will be reported and what will be logged by the program. The further we move the slider, the more will be logged. You can see the number of logged elements just below the slider:

izobrazhenie-193-1.png

Categories - categories of logging.

Auto Update

izobrazhenie-194-1.png

Automatic updates. Why is this included for me? Turn off.

Scan Policy

izobrazhenie-195-1.png

Suggest Optimization - a warning about the optimization of the scan policy.

Proxy

izobrazhenie-196-1.png

Setting up external proxies.

Use System Proxy - Using proxies with IE

Use Custom Proxy - use your own proxies. Data entry will be required. As in brute force. I talked about this earlier, by the way. And in the last article about databases, you can find a similar function. Nothing complicated. Enter the Username, Password, domain on which authentication will take place, etc.

izobrazhenie-197-1.png


Cloud

izobrazhenie-198-1.png

Netsparker's cloud storage settings. Disable the function and skip this item.

Well, the last menu is Extensions with a single Send To Actions item.

izobrazhenie-201-1.png

Setting up automatic sending of data. If you will use it, the easiest way is to set up a submission to GitHub.

izobrazhenie-203-1.png

I've experimented with this function, and somehow it didn't work out very well. This function is optional, so we skip it.

If you realized that you were tricky with the settings, then you can reset them to the standard ones:
izobrazhenie-205-1.png


Understood? Excellent! There is not much.
Go to the new menu: View

izobrazhenie-206-1.png

Well, I won't say much here. It's just setting up windows - which ones to show, which ones to not. The main six are always active, the rest are opened either automatically or manually, if you like. I'll just look at a couple of interesting features.

Encoder and Request Builder can be used outside the scan as separate functions. Lucky they are next to each other

izobrazhenie-208-1.png


Let's look at the Encoder utility first. A useful utility for decrypting encoded / ciphertext. The only thing it doesn't decode is hashes. Has two fields. Entering text:

izobrazhenie-210-1.png


And the text output:
izobrazhenie-211-1.png


There is a settings menu in between. Encode text, or decode:
izobrazhenie-212-1.png


And now my favorite. Request Builder. A very handy thing for working with queries. True, the utility supports only seven requests: GET, POST, HEAD, PUT, PATCH, DELETE, and OPTIONS. I spoke about them, and I will not repeat myself.

izobrazhenie-213-1024x606.png

To send a request - use the button in the upper right corner of the Send Request

izobrazhenie-215-1.png

The program will configure everything automatically - just paste the link into the Host line.

izobrazhenie-216-1.png

Only the choice of the type of request depends on you.

izobrazhenie-214-1024x580.png

Actually, that's all with that. I showed the main functions, then it all depends on what you want.

To return windows to default - use the Reset Layout button

izobrazhenie-217-1.png


The next tab to learn is Reporting

izobrazhenie-218-1024x86.png

This is the export of a scan report, but more advanced, it is possible to generate a report for import into other programs.

  • OWASP Top Ten 2010 Report - A report for the OWASP project, in my case unreadable.
    izobrazhenie-219-1.png
  • Detailed Scan Report - same raspberry as with OWASP
    izobrazhenie-221-1.png
  • HIPAA Compliance Report is a human, readable report compiled in accordance with GOST HIPAA ( Health Insurance Portability and Accountability Act ), a la the health insurance accountability act, but in the Internet
    izobrazhenie-222-1.png
  • OWASP Top Ten 2013 Report - The report for the OWASP 2013 project, in my case, remains unreadable.
    izobrazhenie-224-1.png
  • OWASP Top Ten 2017 Report - Report for the OWASP 2017 project. Unlike previous OWASPs, readable and convenient
    izobrazhenie-225-1.png
  • PCI Compliance Report - PCI Compliance Report,
    izobrazhenie-226-1.png
  • Compration Report is a short report. My key is broken like a border in Letov's song
    izobrazhenie-227-1.png
  • Executive Summary Report - The shortest and most beautiful report on found issues with an explanation. Beautiful pie chart.
    izobrazhenie-229-1.png
  • Knowledge Base Report is a “knowledge base” only report. I have it broken.
izobrazhenie-230-1.png

Who still does not understand what a "knowledge base" is - please read:
izobrazhenie-231-1.png

These are the collected features of the site and found details such as postal addresses or code comments. A very useful thing. We will get acquainted with it a little later, when we finish with the main menu.
[*]ModSecurity WAF Rules - Report of vulnerable parameters and rules of the ModSec firewall. I don’t use it, the report works.
[/LIST]

izobrazhenie-232-1.png


Wow, there are still 10 points left. Let me simplify the task.

izobrazhenie-233-1.png

  • 1 - Export the list of found links
  • 2 - Export the list of crawled links
  • 3 - Exporting the list of found vulnerabilities
There are only three options for the exported list: in CSV, JSON and XML files.

The last tenth function is a detailed report on the vulnerabilities found in XML format. Vulnerabilities List - Detailed (XML)

izobrazhenie-235-1.png


Before we finish parsing the reports, I will disassemble the window for saving the report:
izobrazhenie-263-1.png


Path - the path where the report will be saved

Policy - reporting policy. By default, this is the Default Report Policy

Export as HTML - Save report to HTML document

Export as PDF - Save report to PDF document

Open Generated Report - Open a saved report. If you make two reports - PDF and HTML, then both will open upon creation.

Save - save

The next tab is Help.

izobrazhenie-236-1.png

This menu has nothing to do with the functionality of the program, so we will not consider it.

The active items in the Vulnerability tab depend on what kind of vulnerability Netsparker found

izobrazhenie-237-1.png


For example, let's take one of the previously found vulnerabilities:
izobrazhenie-239-1024x518.png


In addition, pages are added in the main block. Usually there are two new pages - Vulnerability and Browser View. We'll look at them later when we work with the main interface.

Retest - to double-check the found vulnerability.

izobrazhenie-240-1.png


Copy as cURL - copy the cURL request for this link

izobrazhenie-243-1.png


Generate Exploit - Creates XSS and CSRF vulnerabilities, works only for Cross-site Scripting vulnerabilities. Accordingly, in order to be able to generate such a vulnerability, you need to select a link that has a confirmed Cross-site Scripting.

izobrazhenie-244-1.png


Execute SQL commands - execution of SQL commands. Only works with SQL injection vulnerabilities

izobrazhenie-245-1.png


Get Shell - using a shell for remote execution. Can only be exploited if there is a Code Evaluation vulnerability.

izobrazhenie-246-1.png


LFI Exploitation - download system and just important files from the site server if there is a Local File Inclusion vulnerability

izobrazhenie-248-1.png


Short Names - short names. I have never used it.

izobrazhenie-249-1.png


Ignore from this Scan - ignore vulnerability or item for this scan

izobrazhenie-250-1.png


Configure Send To Action - See the Extensions menu, Send To Actions.

izobrazhenie-251-1.png


ModSecurity - As I understand it, this is a report of the vulnerable settings and rules of the ModSec firewall specifically to this link.

izobrazhenie-252-1.png


So, everything with this menu item. It remains to consider the latter.

Link Controlled Scan - a controlled scan of this particular page.

izobrazhenie-253-1.png


Send Request Builder - We have already analyzed this

izobrazhenie-254-1.png


Copy URL - copy the URL. You can also copy the URL from the Vulnerability tab

izobrazhenie-255-1.png


Next, there is a whole bunch of useless functions that I have never used - open this page in the selected browser. Not in the program, but in your browser.

izobrazhenie-256-1.png

By the way, I've always wondered why the icons of all browsers are always round. Amigo doesn't count - it's a virus.

The last push. Let's examine the main window in more detail. This should have been done at the very beginning, but I decided to debug the sweet and simple for later.

Sitemap - sitemap.

izobrazhenie-257-1.png

To get a report on a particular phenomenon, page and vulnerability found, you need to click on the item of interest to us.

If you right-click the mouse, you can call up a quick menu with basic functions. We've covered everything before

izobrazhenie-269-1.png

It is worth considering only a couple of individual ones that will help us a lot in the future.

Copy SQLmap Command - the program generates a command for SQLmap and copies it to the clipboard. Perhaps one of the most useful features.

Exclude This Branch from Attack - exclude all pages of this node from the list of attacked

Expand - expand a node

Collapse - collapse a node

Controlled Scan - controlled scan.

izobrazhenie-258-1.png

To get started, you need to select the desired parameter in the sitemap, select it in the upper list, select what we will scan for in the lower list and click on the Scan button. I have already talked about it several times. Once again, I will say that it is very useful when you do not attack with a scan, but simply draw up a sitemap, and then hit specific nodes, and do not force the entire system.

One large window. Several tabs. Let's start with the first one - Scan

izobrazhenie-259-1024x612.png

A detailed report on the current scan: the attacked page, its parameters, the attack method, what is happening, passive analysis, etc. There is even a timer showing how long the page has already been scanned.

HTTP Request / Response - a log of HTTP requests and responses, there is a search function by response.

izobrazhenie-260-1024x611.png


Attack Radar - visualization of problematic sides and their criticality.

izobrazhenie-261-1024x613.png

Nice, huh? You can also disable the grid with the Logarithmic item.

The other two we have already considered earlier.

Browser View - viewing this page “in the browser”. Purely visual function, nothing more. The page itself does not work.

izobrazhenie-262-1024x611.png


That's all with that. These are the main pages that we will have by default.

Let's proceed to the Knowledge Base window. This window is linked to the previous one, and when we click on the element of interest, a new page opens in the previous window.

izobrazhenie-264-1.png

I don't think I need to explain what is what here. You can poke at random and see what has opened. Everything is intuitively clear from the icons. But since I promised to consider it in more detail, it is worthwhile to deal with each item separately:

Comments - Comments found by the program
Crawling Performance - Crawling performance report for each function
CSS Files - Found CSS files
Email Addresses - Email addresses found on the site
External Frames - External frames
External Scripts - External scripts
File Extensions - all file extensions on the site
Interesting Headers - Headers that the program paid attention to
MIME Types - found MIME types
Out of Scope Links - links and pages that were excluded from scanning
Proofs - basic data pulled from the server through exploits (for example, data from C: \ windows \ win.ini or a list of server processes)
Scan Performance - Report on the performance of the entire scan
Site Profile - site profile
Slowest Pages - pages that took the most time to load
Web Pages With Inputs - pages that have an input function

izobrazhenie-266-1024x523.png


Issues - a short report on found problems, vulnerabilities and just information.

izobrazhenie-268-1.png

Can be grouped by severity, by type of vulnerability, by “proof” and by page.

Everything. We've completely disassembled Netsparker. I must say right away: do not forget to configure the program when checking serious resources! The admins will not have any questions if suddenly someone searches through the entire site, drawing up a map. But if you rape the site, then it will certainly be noticed.

Therefore, use the settings and work correctly!

Let's get down to the next tool. This can be considered the last part of this article - in it I will teach you how to use SQLmap. But first, I'll tell you what it is and what we need to work.

SQLmap automates the process of finding and exploiting SQL injection, and not only finds a security hole, but exploits it to the fullest. Supports all types of injections. The sqlmap functionality allows you to: dump databases, automatically search in the database, extract and decrypt logins and passwords, launch cmd shell, launch an interactive sql shell, in which you only need to write SQL queries to the database, and sqlmap itself will compose the payload for injection. There is an excellent Cheet Sheet that shows all the features of this tool in two pages.

To work with this utility, we need Python version 2.7. All links are given at the very beginning and I see no point in telling what to download and what to install.

In this article, I use an operating system of the Windows family, therefore, the analysis will be for this OS. In fact, working with SQLmap on shind is actually no different from working with it on Linux. The Internet is full of manuals for this program, so we will consider only the main functionality.

There are five main classes of SQL injection, and all of them are supported by
sqlmap:
  • UNION query SQL injection. The classic version of SQL injection, when an expression starting with “UNION ALL SELECT” is passed to the vulnerable parameter. This technique works when web applications directly return the output of the SELECT command to the page: using a for loop or similar, so that each record of the retrieved database selection is sequentially output to the page. Sqlmap can also exploit the situation when only the first record from the selection is returned (Partial UNION query SQL injection).
  • Error-based SQL injection. In the case of this attack, the scanner replaces or adds a syntactically incorrect expression to the vulnerable parameter, after which it parses the HTTP response (headers and body) in search of DBMS errors, which would contain a previously known injected sequence of characters and somewhere “nearby” output to the desired us a subquery. This technique only works when the web application for some reason (most often for debugging purposes) exposes DBMS errors.
  • Stacked queries SQL injection. The scanner checks if the web application supports sequential requests and, if they do, adds a semicolon (;) to the vulnerable HTTP request parameter, followed by an injected SQL request. This technique is mainly used to inject non-SELECT SQL commands, such as manipulating data (using REPLACE or DELETE). It is noteworthy that the technique can potentially lead to the ability to read / write from the file system, as well as the execution of commands in the OS. However, depending on the database management system used as the back-end, as well as user privileges.
  • Boolean-based blind SQL injection... Implementation of the so-called blind injection: data from the database in a "pure" form are not returned anywhere by a vulnerable web application. The technique is also called deductive. Sqlmap adds a syntactically well-formed expression containing a SELECT subquery (or any other command to retrieve a selection from the database) to the vulnerable HTTP request parameter. For each HTTP response received, the headers / body of the page is compared with the response to the original request, so the utility can determine the output of the embedded SQL statement character by character. Alternatively, the user can supply a string or regular expression to define "true" pages (hence the name of the attack). The binary search algorithm implemented in sqlmap to perform this technique is capable of retrieving each character in the output with a maximum of seven HTTP requests.
  • Time-based blind SQL injection. Completely blind injection. Just like in the previous case, the scanner plays with the vulnerable parameter. But in this case, it adds a subquery that causes the DBMS to pause for a specified number of seconds (for example, using the SLEEP () or BENCHMARK () commands). Using this feature, the scanner can retrieve data from the database character by character, comparing the response time to the original request and to the request with the embedded code. It also uses a binary search algorithm. In addition, a special method for data verification is applied to reduce the likelihood of incorrect character extraction due to unstable connection.
Despite the fact that the scanner is able to automatically exploit the found vulnerabilities, you need to understand in detail each of the techniques used. If the topic of SQL injection is still familiar to you only on your fingers, I recommend flipping through the archive] [or read Dmitry Evteev's manual " SQL Injection: From A to Z ". It is also important to understand that attack implementations are often very different for different DBMSs. All these cases are able to handle sqlmap and currently supports MySQL, Oracle, PostgreSQL, Microsoft SQL Server, Microsoft Access, SQLite, Firebird, Sybase and SAP MaxDB.

Remember that before we learned how to use NetSparker? If Netsparker finds at least one Sql injection, then SqlMap will allow it to be exploited.

I got bored with conventional injections, so I suggest considering Blind Injection to make it more interesting. We will not search for a long time - we will take the link from the site that we crawled earlier.


By the way, when installing python, there is a clause that adds the python executable file to path, so as not to write the path to it every time. I am still a fruit and for my fruit reasons I will not do this. Just because I'm not looking for easy ways. But in fact, I just realized that I fucked up, and I am writing this paragraph at the end of the article

Now we open the command line. I installed python on the C drive. Next to python I also installed sqlmap. Now we need to check if everything works. To do this, use the CD command to go to the root: CD C: \

To run the utility, you first need to register the path to the python executable file: Python27 \ Python.exe, and then, separated by a space, the path to the utility itself: SQLmap \ sqlmap.py and press Enter. Don't copy SQLmap to python folder!

izobrazhenie-272-1.png

Don't worry, this error is caused by a "blank" startup. Let's check one of the proposed options. Use -h to get a list of commands. Press Enter again (this time to continue), and enter:

Python27 \ Python.exe SQLmap \ sqlmap.py -h

izobrazhenie-273-1.png

Everything is working.

To get started, you need to use the -u option. It is used to indicate an attacked link. The correct command would look like this:

Python27 \ Python.exe SQLmap \ sqlmap.py -u
It is necessary to follow the whole process, since the program may ask us how to proceed next:
izobrazhenie-274-1.png


Usually we are asked a simple yes or no. To answer yes - enter Y or y, otherwise - N or n. The capital letter in the question means the default choice, and if you are too lazy to press two buttons, you can press one - Enter, and the program will continue working with the default choice. What? Are you too lazy? Okay. To make the program act at its own discretion, we use –batch. Please note, two hyphens. We add this option to the end of the command:

Python27 \ Python.exe SQLmap \ sqlmap.py -u http://php.testsparker.com/artist.php?id=test –batch

izobrazhenie-275-1024x760.png

It remains to wait for the program to finish. She herself will inform you about the completion of the work, and provide the found material

izobrazhenie-277-1024x219.png

To get a list of databases - use the –dbs option.

You can find out what exactly the program does and what methods it uses by reading the log of work.

And since this is a blind injection, the utility will gradually, by letter, recognize the names of all bases.

izobrazhenie-278-1024x546.png

a great and illustrative example of working with blind injection. To do it manually, you would have quit in the second minute of work.

izobrazhenie-279-1.png

When working with other resources, the utility can stop its work, reporting the expired timeout: “connection timed out to the target URL”. With this, your target will work and open quietly in the browser. The problem is that some resources recognize the SQLmap and disconnect with it. To avoid this problem, I advise you to use the –random-agent function. Thus, we disguise ourselves and continue working:

Python27 \ Python.exe SQLmap \ sqlmap.py -u http://php.testsparker.com/artist.php?id=test –random-agent –dbs

Ok, we've got a list of all databases, and now we need to get their contents. Our proud -dbs turns into a simple -D, after which we enter the name of the database we are interested in. In my case, this is mysql. To get the tables, add –tables to the very end.

Python27 \ Python.exe SQLmap \ sqlmap.py -u http://php.testsparker.com/artist.php?id=test –random-agent -D mysql –tables –batch

Since this is a blind injection, we also have to wait for all the data to be received. Yes, for a long time, but how else?

izobrazhenie-281-1.png

The utility found a lot of tables. To get the columns, we use the same system as with obtaining tables, only change –tables to -T, enter the required tables and then add –columns :

Python27 \ Python.exe SQLmap \ sqlmap.py -u http://php.testsparker.com/artist.php?id=test –random-agent -D mysql -T proc –columns –batch

Yes, we have to wait again. It was necessary to study in advance the insides of the target for the article. It takes only a couple of seconds for you, and I'm sitting here with tea, I've been waiting for an hour.

I've been waiting for the fifth hour, so I just scored and left to work with another database of logs. Everything is the same, only the names of the bases and tables are different:

Python27 \ Python.exe SQLmap \ sqlmap.py -u http://php.testsparker.com/artist.php?id=test –random-agent -D logs -T logs –columns –batch

izobrazhenie-282-1.png

Finally! We got a list of columns. Now, to get their contents, we do the following: –columns evolves (or degrades, as it is more convenient for anyone) into -C, enter the columns / columns we are interested in separated by commas and add the –dump key to the end.

Python:
Python27 \ Python.exe SQLmap \ sqlmap.py -u http://php.testsparker.com/artist.php?id=test –random-agent -D logs -T logs -C IP, useragent –dump –batch

After that, the program starts merging data:
izobrazhenie-283-1.png


I will have to wait a very long time to show the finished result, so I'll show you how the dump will look in someone else's example:
12-1.jpg

The problem is the time it will take for the blind injection.

In principle, that's all. But specifically, as an addition, I will show a couple of chips. For example, how about the server executing our commands? for this we need to create a wrapper. For this we will use the –sql-shell command:
Python:
Python27 \ Python.exe SQLmap \ sqlmap.py -u http://php.testsparker.com/artist.php?id=test –sql-shell

izobrazhenie-284-1.png


It does not always work, but if we are successful, we get full access, and we can even add our own users. For example, let's try to get the user with the SELECT user () command. To execute this command, we just need to write it directly into the command line. SQLmap has already created a wrapper and is ready to send our commands for execution. Let's try:
izobrazhenie-285-1.png

izobrazhenie-286-1.png


Voala. I will not explain the usefulness of this function, it seems obvious to me. And to get out of this mode - enter x or q. If you want to use CMD, it is easier to do it in Netsparker if there is a similar vulnerability.

In addition, I am obliged to tell you how to attack the vulnerability if the data is transmitted by the POST parameter. If in Netsparker you see a message that this is a POST SQL Injection, then by clicking on it in the sparker, in the working window find the name of the variable being passed (TYPE) and its value (VALUE), then simply substitute these values into sqlmap:

Python27 \ Python.exe SQLmap \ sqlmap.py -u –data “username = admin, password = admin123456”, then everything is the same.

You can also use Burp Suite to parse POST injections. You can do without this program, but more on that later, but this tool is very interesting and we must put in at least a word for it. After installation and launch, we will be asked to select a project. We will not create anything, and therefore we will select a temporary one and click further:

izobrazhenie-288-1.png


We will use the default settings for this project, the standard ones:
izobrazhenie-289-1.png

Click on start and wait for the program to open

izobrazhenie-290-1.png


Immediately after opening the program, we go to the proxy settings menu:
izobrazhenie-292-1024x336.png


Now I will immediately show you how to add your own, but we will add a little specific. Click on the Add button. After that, set up everything like mine and click OK:
izobrazhenie-293-1.png

izobrazhenie-294-1.png


We will use our new proxy. To do this, go to the browser settings. Since I use Firefox (and I advise you), then the proxy setting is in my "Network Settings"

izobrazhenie-295-1.png

izobrazhenie-297-1.png

We manually configure the proxies that we introduced in Burp Suite.

Before accepting the settings, open the login data entry form separately: http://php.testsparker.com/auth/internal.php. After that, we accept the settings, enter the data and click on the login button.

izobrazhenie-299-1.png


The page will load, but we do not need this process, but the data that is in Burp Suit'e:
izobrazhenie-301-1.png


We only need one line. Input line: username = admin + & password = admin123456 & token = 11940

to work with this data in SQLmap, we will use the –data option:
Python:
Python27 \ Python.exe SQLmap \ sqlmap.py -u http://php.testsparker.com/auth/internal.php –random-agent –data “username = admin + & password = admin123456 & token = 11940” - dbs –batch

izobrazhenie-302-1.png

In our case, the injection failed. However, I explained how to use POST in SQLmap to attack.

As I promised, I will tell you how to catch POST immediately in the browser. for this we need to open the page where we will enter the login and password, and open the console with the F12 key. Next, we need to open the Network tab and check the Continuous logs item

izobrazhenie-303-1024x377.png

After that, we enter the data on the site and start looking for our POST request in the logs. To get the data we need - click on the request we need and in the menu on the right, select the “parameters” tab.

izobrazhenie-304-1024x288.png

In the parameters there is an item "payload", which contains the string we need.

My task is to consider the main functions, and separately and completely the SQLmap utility needs to be disassembled and considered in a new, separate article. This article is already painfully long and loaded. I think I'll analyze it in a future article as well as Netsparker in this one.

The article has come to an end. I will not hide, most of the effort went to Netsparker. The reason for this is the lack of such material in Russian. There are short descriptions, but no full analysis. I decided to change the situation by writing a full analysis of the functions of this product. The fact is that on the same SQLmap you will find hundreds, if not thousands of articles and full analyzes of all functions, commands, and even examples of successful attacks. But you will hardly find a complete analysis of Netsparker.

On my own behalf, I want to add that professionals reading this material do not throw rotten tomatoes at me. I really tried.

Good luck. Take care of yourself, do not break the law and remember that you can scan other people's resources only with the permission of their owners. Nevertheless, the utilities described by us will allow you to conduct an excellent pen test of even the most complex application.

(c) cybersec.org
 
Top