How to Perform Authenticated Website Scans with Pentest-Tools.com

Sep 9, 2019 • Cristin Sirbu

Categories:

This article shows how to scan a web application that requires authentication using the Website Vulnerability Scanner of Pentest-Tools.com.

The purpose of the article is to show you how to configure the authentication options of the scanner such that it automatically passes the login page and performs in-depth scanning.

Note: To access the authentication options of the scanners you need to first login to your Pentest-Tools.com account.

Why authenticated scans?

If authentication is not enabled, the web scanner covers only a small set of application functionality, the one exposed before the user has to authenticate. However, there may be other uncovered vulnerabilities that can only be identified after logging in to the application.

Another good reason for performing authenticated scans is that it mimics the activities of a malicious authenticated user, which has additional attack vectors. Authenticated users have access to more functionality than unauthenticated users.

Supported authentication methods

Our Website Vulnerability Scanner supports two methods for performing authenticated scans:

  1. Form-based authentication

  2. Cookie-based authentication

The following sections of the article show you how to configure the scanner and how to interpret the results when doing authenticated scans.

1. Form-based authentication

The Website Vulnerability Scanner provides two types of scans: Light and Full. Only the Full scan supports authentication.

Here is the web interface of the scanner that allows you to configure the authentication options:

alt text

In order to configure the authentication for a Full scan you have to:

  1. Insert the URL of the website that you want to scan (the target)

  2. Select the Full Scan

  3. Enable the “Authentication” option

  4. Choose Login authentication

The “Login authentication” option allows the user to make an authenticated scan by having a valid pair of credentials in the target application.

You will have to provide the following details:

At this point you can test if the authentication works properly by pressing the Check Authentication button or Start the scan directly. The Check Authentication functionality does not initiate the scanning process but it only shows a screenshot of the successful login page (cropped at 1280 x 720px).

Here is a sample configuration of the”Login authentication” option and a sample screenshot of a successful login:

alt text

alt text

HTTP Cookies are pieces of data that a web browser receives from the server and are usually used to identify the web session of a user (they are also called session cookies). After receiving a session cookie, the browser sends it with each HTTP request that it makes to that server. It is helpful to know that the request is associated with that particular user.

Our Cookie-based authentication option mimics the behavior of a web browser that already has a session cookie. It requires the user to insert a valid session cookie in the ‘Cookie header’ field. The session cookie must be taken from an already established web session (you need to manually login to your web app and get the cookies from your browser).

The web interface for this type of authentication looks like in the picture below:

alt text

First, you have to manually authenticate in the target web application using your web browser. Second, you need to get the session cookie string from the browser.

For example, using Google Chrome, you have perform the following actions:

  • Enter Developer Tools - by Menu > More tools > Developer Tools (or Ctrl + Shift + I)
  • Enter the ‘Network’ Tab
  • Click on the ‘Name’ section, choose a URL that displays an additional ‘Cookies’ tab.
  • Go to ‘Headers’ Tab (for that URL)
  • Scroll to Request Headers and see the Cookie header
  • Copy the string from the Cookie header and insert it as in the example below

    ‘PHPSESSID=a765feb13b4112f3d12f3dfa12e;_aa_id=ad4b654ad48f4d545a64d75ea’ (a list with name=value separated by “;” and no spaces)

Here is the Developer Tools interface

alt text

Interpreting the results

Authenticated scanning covers more application functionality and pages than the unauthenticated scan. You should an additional “Authentication success” message in the final scan report, more exactly in the Spider results. Furthermore, the Spider results should contain more crawled URLs than the unauthenticated scan.

Results displayed for scanning with authentication alt text

Results displayed for scanning without authentication

Behind the scenes

The main steps phases of a web vulnerability scan are spidering and active scanning. In order to perform these as an authenticated user, the scanner requires the user’s session cookie. It will be used for every request and it will uncover more information than an unauthenticated scan.

The Login authentication option performs an additional step in order to obtain the session cookie. First, the scanner detects the login form from the URL provided and tries authenticating with the credentials. Second, the scanner tries to obtain the session cookie from the authenticated user and use it from this point in every request.

If you select just the Check authentication option, a screenshot of the user’s page is taken to help you visualize whether the authentication was successful or not. The spidering is not initialized and the scan stops.

In the Cookie based authentication, having the session cookie already provided by you, the spidering and active scanning start directly. If the cookie is correct, the scan will result in more URLs discovered and analyzed for vulnerabilities.

Please note that the scanner cannot know if the provided cookie is correct or not. It will use it as is and it is up to you to validate if the scan has reached the desired parts of the application.

Limitations

It is important to note that there are some cases in which the authentication may not work as expected due to some implementation constraints.

Single Page Applications

The Login authentication method cannot currently find login forms in Single Page Applications (web pages created dynamically with JavaScript) because the HTML code does not directly contain the login form.

Furthermore, some login forms which use complex JavaScript logic for authentication may also not be properly identified.

As a workaround for this case, you should use the ‘Cookie authentication’ method and provide the session cookie manually.

Token-based authentication

At the moment, the scanning engine does not support token-based authentication (ex. JWT).

However, we are constanly developing our authentication methods and the Website Vulnerability Scanner, thus we will add these capabilities in the near future.

Final words

In conclusion, authenticated scanning provides more coverage within a web application, as it discovers more dynamic URLs. when you perform a more in-depth scanning, there is a higher chance to find well-hidden vulnerabilities and render your web applications more secure.