githubEdit

80,443 - Pentesting Web Methodology

circle-check

Get a hacker's perspective on your web apps, network, and cloud

Find and report critical, exploitable vulnerabilities with real business impact. Use our 20+ custom tools to map the attack surface, find security issues that let you escalate privileges, and use automated exploits to collect essential evidence, turning your hard work into persuasive reports.

Basic Info

The web service is the most common and extensive service and a lot of different types of vulnerabilities exists.

Default port: 80 (HTTP), 443(HTTPS)

Web API Guidance

Web API Pentestingchevron-right

Methodology summary

In this methodology we are going to suppose that you are going to a attack a domain (or subdomain) and only that. So, you should apply this methodology to each discovered domain, subdomain or IP with undetermined web server inside the scope.

Server Version (Vulnerable?)

Identify

Check if there are known vulnerabilities for the server version that is running. The HTTP headers and cookies of the response could be very useful to identify the technologies and/or version being used. Nmap scan can identify the server version, but it could also be useful the tools whatwebarrow-up-right, webtech arrow-up-rightor https://builtwith.com/arrow-up-right:

Search for vulnerabilities of the web application version

Check if any WAF

Web tech tricks

Some tricks for finding vulnerabilities in different well known technologies being used:

Take into account that the same domain can be using different technologies in different ports, folders and subdomains. If the web application is using any well known tech/platform listed before or any other, don't forget to search on the Internet new tricks (and let me know!).

Source Code Review

If the source code of the application is available in github, apart of performing by your own a White box test of the application there is some information that could be useful for the current Black-Box testing:

  • Is there a Change-log or Readme or Version file or anything with version info accessible via web?

  • How and where are saved the credentials? Is there any (accessible?) file with credentials (usernames or passwords)?

  • Are passwords in plain text, encrypted or which hashing algorithm is used?

  • Is it using any master key for encrypting something? Which algorithm is used?

  • Can you access any of these files exploiting some vulnerability?

  • Is there any interesting information in the github (solved and not solved) issues? Or in commit history (maybe some password introduced inside an old commit)?

Source code Review / SAST Toolschevron-right

Automatic scanners

General purpose automatic scanners

CMS scanners

If a CMS is used don't forget to run a scanner, maybe something juicy is found:

Clusterdarrow-up-right: JBoss, ColdFusion, WebLogic, Tomcat, Railo, Axis2, Glassfish CMSScanarrow-up-right: WordPress, Drupal, Joomla, vBulletin websites for Security issues. (GUI) VulnXarrow-up-right: Joomla, Wordpress, Drupal, PrestaShop, Opencart CMSMap: (W)ordpress, (J)oomla, (D)rupal or (M)oodle droopscanarrow-up-right: Drupal, Joomla, Moodle, Silverstripe, Wordpress

At this point you should already have some information of the web server being used by the client (if any data is given) and some tricks to keep in mind during the test. If you are lucky you have even found a CMS and run some scanner.

Step-by-step Web Application Discovery

From this point we are going to start interacting with the web application.

Initial checks

Default pages with interesting info:

  • /robots.txt

  • /sitemap.xml

  • /crossdomain.xml

  • /clientaccesspolicy.xml

  • /.well-known/

  • Check also comments in the main and secondary pages.

Forcing errors

Web servers may behave unexpectedly when weird data is sent to them. This may open vulnerabilities or disclosure sensitive information.

  • Access fake pages like /whatever_fake.php (.aspx,.html,.etc)

  • Add "[]", "]]", and "[[" in cookie values and parameter values to create errors

  • Generate error by giving input as /~randomthing/%s at the end of URL

  • Try different HTTP Verbs like PATCH, DEBUG or wrong like FAKE

Check if you can upload files (PUT verb, WebDav)

If you find that WebDav is enabled but you don't have enough permissions for uploading files in the root folder try to:

  • Brute Force credentials

  • Upload files via WebDav to the rest of found folders inside the web page. You may have permissions to upload files in other folders.

SSL/TLS vulnerabilites

  • If the application isn't forcing the user of HTTPS in any part, then it's vulnerable to MitM

  • If the application is sending sensitive data (passwords) using HTTP. Then it's a high vulnerability.

Use testssl.sharrow-up-right to checks for vulnerabilities (In Bug Bounty programs probably these kind of vulnerabilities won't be accepted) and use a2sv arrow-up-rightto recheck the vulnerabilities:

Information about SSL/TLS vulnerabilities:

Spidering

Launch some kind of spider inside the web. The goal of the spider is to find as much paths as possible from the tested application. Therefore, web crawling and external sources should be used to find as much valid paths as possible.

Brute Force directories and files

Start brute-forcing from the root folder and be sure to brute-force all the directories found using this method and all the directories discovered by the Spidering (you can do this brute-forcing recursively and appending at the beginning of the used wordlist the names of the found directories). Tools:

  • Dirb / Dirbuster - Included in Kali, old (and slow) but functional. Allow auto-signed certificates and recursive search. Too slow compared with th other options.

  • Dirsearcharrow-up-right (python): It doesn't allow auto-signed certificates but allows recursive search.

  • Gobusterarrow-up-right (go): It allows auto-signed certificates, it doesn't have recursive search.

  • Feroxbusterarrow-up-right - Fast, supports recursive search.

  • wfuzzarrow-up-right wfuzz -w /usr/share/seclists/Discovery/Web-Content/raft-medium-directories.txt https://domain.com/api/FUZZ

  • ffuf arrow-up-right- Fast: ffuf -c -w /usr/share/wordlists/dirb/big.txt -u http://10.10.10.10/FUZZ

  • uroarrow-up-right (python): This isn't a spider but a tool that given the list of found URLs will to delete "duplicated" URLs.

  • Scavengerarrow-up-right: Burp Extension to create a list of directories from the burp history of different pages

  • TrashCompactorarrow-up-right: Remove URLs with duplicated functionalities (based on js imports)

  • Chamaleonarrow-up-right: It uses wapalyzer to detect used technologies and select the wordlists to use.

Recommended dictionaries:

Note that anytime a new directory is discovered during brute-forcing or spidering, it should be Brute-Forced.

What to check on each file found

Special findings

While performing the spidering and brute-forcing you could find interesting things that you have to notice.

Interesting files

403 Forbidden/Basic Authentication/401 Unauthorized (bypass)

403 & 401 Bypasseschevron-right

502 Proxy Error

If any page responds with that code, it's probably a bad configured proxy. If you send a HTTP request like: GET https://google.com HTTP/1.1 (with the host header and other common headers), the proxy will try to access google.com and you will have found a SSRF.

NTLM Authentication - Info disclosure

If the running server asking for authentication is Windows or you find a login asking for your credentials (and asking for domain name), you can provoke an information disclosure. Send the header: “Authorization: NTLM TlRMTVNTUAABAAAAB4IIAAAAAAAAAAAAAAAAAAAAAAA=” and due to how the NTLM authentication works, the server will respond with internal info (IIS version, Windows version...) inside the header "WWW-Authenticate". You can automate this using the nmap plugin "http-ntlm-info.nse".

HTTP Redirect (CTF)

It is possible to put content inside a Redirection. This content won't be shown to the user (as the browser will execute the redirection) but something could be hidden in there.

Web Vulnerabilities Checking

Now that a comprehensive enumeration of the web application has been performed it's time to check for a lot of possible vulnerabilities. You can find the checklist here:

Web Vulnerabilities Methodologychevron-right

Find more info about web vulns in:

Monitor Pages for changes

You can use tools such as https://github.com/dgtlmoon/changedetection.ioarrow-up-right to monitor pages for modifications that might insert vulnerabilities.

Get a hacker's perspective on your web apps, network, and cloud

Find and report critical, exploitable vulnerabilities with real business impact. Use our 20+ custom tools to map the attack surface, find security issues that let you escalate privileges, and use automated exploits to collect essential evidence, turning your hard work into persuasive reports.

HackTricks Automatic Commands

circle-check

Last updated