Ultimate Guide to Effective Web Application Penetration Testing

Very Lazy Tech
4 min readJun 18, 2024

--

Web application penetration testing is a crucial skill for ensuring the security and integrity of web applications. Whether you’re a beginner or have some experience, this guide will walk you through the essential steps to perform effective web application penetration testing. By following these steps, you can identify and address vulnerabilities in web applications, ensuring they are secure against malicious attacks.

Very Lazy Tech

1. Identify Technologies

The first step in web application penetration testing is identifying the technologies used by the web server. This includes the server type, operating system, web application frameworks, and more. Understanding the technologies in use will help you identify potential vulnerabilities specific to those technologies.

How to Identify Technologies

1.1. HTTP Headers

Examine HTTP headers to gather information about the web server. Tools like curl or browser developer tools can help:

curl -I http://example.com

1.2. Web Server Banner

Some servers reveal their details in the server banner. Look for headers like Server, X-Powered-By, and Set-Cookie.

1.3. Online Tools

Use online tools like BuiltWith or Wappalyzer to identify technologies used by the website.

Tricks to Keep in Mind

  • Version Disclosure: Many applications disclose their version numbers in HTTP headers or meta tags. Pay attention to these, as they can be used to find known vulnerabilities.
  • Comment Tags: Developers sometimes leave comment tags in the HTML source code with valuable information.

Checking for Known Vulnerabilities

1.4. Vulnerability Databases

Check databases like CVE and Exploit Database for known vulnerabilities in the identified technologies.

1.5. Specialized Tools

Use tools like WPScan for WordPress sites to identify known vulnerabilities:

wpscan --url http://example.com --enumerate vp

1.6. Information Extraction Tools

Tools like Nikto and WhatWeb can help extract more information about the web server and its configurations.

2. Initial Checks

Before diving deep into penetration testing, perform some initial checks to gather more information about the target web application.

2.1. Examine robots.txt

The robots.txt file can reveal areas of the website that are restricted from web crawlers but might be of interest to a penetration tester.

curl http://example.com/robots.txt

2.2. Sitemap

A sitemap.xml file can provide a structured list of URLs within the site, useful for identifying potential entry points.

curl http://example.com/sitemap.xml

2.3. 404 Errors

Custom 404 error pages can sometimes reveal server information or provide links to useful resources.

2.4. SSL/TLS Scan

If the site uses HTTPS, perform an SSL/TLS scan to check for vulnerabilities in the SSL/TLS configuration.

  • Use tools like SSL Labs or SSLyze:
sslyze --regular example.com

3. Spidering the Web Page

Spidering, or web crawling, involves systematically browsing a web application to discover all files, folders, and parameters. This step is crucial for understanding the structure of the application.

3.1. Automated Tools

Use tools like Burp Suite, OWASP ZAP, or HTTrack to spider the web page.

3.2. Burp Suite

  1. Configure Burp Suite as a proxy in your browser.
  2. Browse the web application manually to capture the traffic.
  3. Use the “Spider” function to automatically discover additional content.

3.3. OWASP ZAP

  1. Set up OWASP ZAP as a proxy.
  2. Explore the web application to capture the traffic.
  3. Use the “Spider” function to crawl the application.

3.4. Importance of Re-Spidering

Re-spider the web application whenever you discover new directories or URLs, whether through brute-forcing or manual exploration. This ensures that you have the most comprehensive map of the web application.

4. Directory Brute-Forcing

Brute-forcing directories is an effective way to find hidden files and directories that might not be easily discoverable.

4.1. Tools for Directory Brute-Forcing

4.2. Using Gobuster

gobuster dir -u http://example.com -w /path/to/wordlist.txt

4.3. Recursive Brute-Forcing

Whenever new directories are discovered, recursively brute-force them to find more hidden content.

4.4. Custom Wordlists

Use custom wordlists or combine multiple wordlists for a more comprehensive brute-force attack.

5. Backups Checking

Developers often leave backup files on the server, which can contain sensitive information. Testing for these backups is a crucial step.

5.1. Common Backup Extensions

Test discovered files by appending common backup extensions such as .bak, .old, .backup, .zip, and .tar.gz.

5.2. Tools for Backup Checking

Automate this process with tools like [Burp Suite] or custom scripts to append and test backup extensions systematically.

6. Brute-Forcing Parameters

Hidden parameters can be gateways to potential vulnerabilities. Brute-forcing parameters involves guessing parameter names that might not be readily visible.

6.1. Tools for Brute-Forcing Parameters

  • ffuf
  • [Burp Suite’s Intruder]

6.2. Using ffuf

ffuf -u http://example.com/FUZZ -w /path/to/wordlist.txt

6.3. Common Parameter Names

Use wordlists containing common parameter names like admin, debug, test, etc.

7. Identifying Vulnerabilities

Once all possible endpoints accepting user input are identified, it’s time to test for vulnerabilities.

7.1. Common Vulnerabilities to Check

  • SQL Injection (SQLi): Use tools like SQLMap or manual techniques to test for SQLi.
  • Cross-Site Scripting (XSS): Test for XSS by injecting payloads into input fields and observing the results.
  • Cross-Site Request Forgery (CSRF): Check for CSRF vulnerabilities by crafting malicious requests.
  • File Inclusion: Test for Local File Inclusion (LFI) and Remote File Inclusion (RFI) vulnerabilities.
  • Server-Side Request Forgery (SSRF): Test if the server can be tricked into making requests to arbitrary URLs.

7.2. Automated Tools

  • Burp Suite: Use Burp Suite’s active scanning features.
  • OWASP ZAP: Utilize ZAP’s automated scanners.

📎 If You like my content and you want some more, View On My Shop bundle of 20+ E-Books for your OSCP!

📎 Buy me a Coffee

--

--

Very Lazy Tech

🛋️ Welcome to Very Lazy Tech! 🖥️ Hey, I'm your tech guide focused on simplicity. Join me as we navigate the world of tech with ease.