Module 14
Module 14
The first step in web application hacking for an ethical hacker or pen tester is to gather the
maximum available information about the target organization website by performing web
application footprinting using various techniques and tools. In this step, you will use
techniques such as web spidering and vulnerability scanning to gather complete information
about the target web application.
Web infrastructure footprinting helps you to identify vulnerable web applications, understand
how they connect with peers and the technologies they use, and find vulnerabilities in
specific parts of the web app architecture. These vulnerabilities can further help you to
exploit and gain unauthorized access to web applications.
The labs in this exercise demonstrate how easily hackers can gather information about your
web application and describe the vulnerabilities that exist in web applications.
Lab Objectives
Footprinting the web infrastructure allows attackers to engage in the following tasks:
• Server Discovery: Attackers attempt to discover the physical servers that host a
web application using techniques such as Whois Lookup, DNS Interrogation, and
Port Scanning
• Service Discovery: Attackers discover services running on web servers to
determine whether they can use some of them as attack paths for hacking a web
app
• Server Identification: Attackers use banner-grabbing to obtain server banners; this
helps to identify the make and version of the web server software
• Hidden Content Discovery: Footprinting also allows attackers to extract content
and functionality that is not directly linked to or reachable from the main visible
content
In this task, we will perform web application reconnaissance to gather information about
server IP address, DNS names, location and type of server, open ports and services, make,
model, version of the web server software, and server-side technology.
5. Now, we will perform port scanning to gather information about the open
ports and services running on the machine hosting the target website.
In this command, -T4: specifies setting time template (0-5), -A: specifies
aggressive scan, and -v: enables the verbose output (include all hosts and
ports in the output).
9. The result appears, displaying the open ports and services running on the
machine hosting the target website.
10. Scroll down to see the complete results. You can observe that the target
machine name, NetBIOS name, DNS name, MAC address, OS, and other
information is displayed, as shown in the screenshot.
11. Now, perform banner grabbing to identify the make, model, and version of
the target web server software.
13. The Trying 10.10.1.19… message appears; type GET / HTTP/1.0 and
press Enter two times.
14. The result appears, displaying information related to the server name and its
version, technology used.
15. Here, the server is identified as Microsoft-IIS/10.0 and the technology used
is ASP.NET.
more...
16. This concludes the demonstration of how to perform web application
reconnaissance (Whois lookup, DNS interrogation, port and services
discovery, banner grabbing, and firewall detection).
17. Close all open windows and document all acquired information.
Question 14.1.1.1
Perform a port and service discovery scan using Nmap on the website www.moviescope.com.
Enter the IP address of the machine hosting www.moviescope.com.
Question 14.1.1.2
Perform a scan using Nmap on the website www.moviescope.com. Enter the name of the
DNS server hosting the domain name for www.moviescope.com.
Question 14.1.1.3
Perform banner grabbing using Telnet on the website www.moviescope.com to identify the
make, model, and version of the target web-server software. Identify the server-side
application used to develop the web pages.
Task 2: Perform Web Spidering using OWASP ZAP
OWASP Zed Attack Proxy (ZAP) is an integrated penetration testing tool for finding
vulnerabilities in web applications. It offers automated scanners as well as a set of tools that
allow you to find security vulnerabilities manually. ZAP provides functionality for a range of
skill levels-from developers to testers new to security testing, to security testing specialists.
Here, we will perform web spidering on the target website using OWASP ZAP.
In this task, the target website (www.moviescope.com) is hosted by the victim machine
(Windows Server 2019). Here, the host machine is the Parrot Security machine.
1. In the Parrot Security machine, open a Terminal window and execute sudo
su to run the programs as a root user (When prompted, enter the
password toor).
3. In the Terminal window, type zaproxy and press Enter to launch OWASP
ZAP.
4. The OWASP ZAP initializing window appears; wait for it to complete.
In this task, the objective being web spidering, we will focus on the
information obtained while performing web spidering.
11. Now, click on the Spider tab from the lower section of the window to view
the web spidering information. By default, the URLs tab appears under
the Spider tab.
12. The URLs tab contains various links for hidden content and functionality
associated with the target website (www.moviescope.com).
13. Now, navigate to the Messages tab under the Spider tab to view more
detailed information regarding the URLs obtained while performing the web
spidering, as shown in the screenshot.
more...
14. This concludes the demonstration of how to perform web spidering on a
target website using OWASP ZAP.
15. Close all open windows and document all acquired information.
Question 14.1.2.1
Perform web spidering on the www.moviescope.com website using OWASP ZAP. Enter the
name of the tab on the OWASP ZAP application that allows you to view detailed information
regarding the URLs obtained while performing web spidering.
10. A CWE website appears in Microsoft Edge web browser, displaying the
details of CWE-319 ClearText Transmission of Sensitive Information.
11. In the CWE page, we can see that the attackers can gather sensitive
information such as passwords etc. by sniffing the network, if the information
is transmitted in cleartext format.
12. Close the browser window and switch to the SmartScanner window.
17. Under DESCRIPTION section we can observe that the browsers can
perform MIME sniffing which can cause the browsers to transform non-
executable content into executable content.
18. Similarly, you can view the the RECOMMENDATION section and click on
the reference link under REFERENCES section.
19. You can also click on any other vulnerability to view its detailed information.
21. You can also use other web application vulnerability scanning tools such
as WPScan Vulnerability Database (https://wpscan.com), Codename
SCNR (https://ecsypno.com), AppSpider (https://www.rapid7.com), Unisca
n (https://github.com) and N-Stalker (https://www.nstalker.com).
22. Close all open windows and document all acquired information.
Question 14.1.3.1
For an ethical hacker or pen tester, the next step after gathering required information about the
target web application is to attack the web application. They must have the required knowledge
to perform web application attacks to test the target network's web application security
infrastructure.
Attackers perform web application attacks with certain goals in mind. These goals may be either
technical or non-technical. For example, attackers may breach the security of the web application
and steal sensitive information for financial gain or for curiosity's sake. To hack the web app, first,
the attacker analyzes it to determine its vulnerable areas. Next, they attempt to reduce the
"attack surface." Even if the target web application only has a single vulnerability, attackers will
try to compromise its security by launching an appropriate attack. They try various application-
level attacks such as injection, XSS, broken authentication, broken access control, security
misconfiguration, and insecure deserialization to compromise the security of web applications to
commit fraud or steal sensitive information.
An ethical hacker or pen tester must test their company's web application against various attacks
and other vulnerabilities. They must find various ways to extend the security test and analyze
web applications, for which they employ multiple testing techniques. This will help in predicting
the effectiveness of additional security measures in strengthening and protecting web
applications in the organization.
The tasks in this lab will assist in performing attacks on web applications using various
techniques and tools.
Lab Objectives
One maintains and accesses web applications through various levels that include custom web
applications, third-party components, databases, web servers, OSes, networks, and security. All
the mechanisms or services employed at each layer help the user in one way or another to
access the web application securely. When talking about web applications, the organization
considers security to be a critical component, because web applications are major sources of
attacks. Attackers make use of vulnerabilities to exploit and gain unrestricted access to the
application or the entire network. Attackers try various application-level attacks to compromise
the security of web applications to commit fraud or steal sensitive information.
Here, we will perform a brute-force attack on the target website using Burp Suite.
In this task, the target WordPress website (http://10.10.1.22:8080/CEH) is hosted by the victim
machine, Windows Server 2022. Here, the host machine is the Parrot Security machine.
Ensure that the Wampserver is running in Windows Server 2022 machine. To run
the WampServer, execute the following steps:
• Click Windows Server 2022 to switch to the Windows Server 2022 machine
Click Ctrl+Alt+Delete to activate the machine and login
with CEH\Administrator / Pa$$w0rd.
• Now, click Type here to search field on the Desktop, search for wampserver64 in
the search bar and select Wampserver64 from the results.
• Click the Show hidden icons icon, observe that the WampServer icon appears.
• Wait for this icon to turn green, which indicates that the WampServer is successfully
running.
4. In the Mozilla Firefox browser, click the Open application menu icon ( )
in the right corner of the menu bar and select Settings from the drop-down list.
5. The General settings tab appears. In the Find in Settings search bar, search
for proxy and in the Search Results, click the Settings button under
the Network Settings option.
6. The Connection Settings window appears; select the Manual proxy
configuration radio button and specify the HTTP Proxy as 127.0.0.1 and
the Port as 8080. Tick the Also use this proxy for HTTPS checkbox and
click OK. Close the Settings tab and minimize the browser window.
7. Now, minimize the browser window, click the Applications menu form the top
left corner of Desktop, and navigate to Pentesting --> Web Application
Analysis --> Web Application Proxies --> Burpsuite CE to launch
the Burpsuite CE application.
8. The Burp Suite Community Edition pop-up appears, click OK.
10. The Burp Suite main window appears; ensure that the Temporary
project radio button is selected and click the Next button, as shown in the
screenshot.
If Burp Suite is out of date pop-up appears check Don't show again for this
version checkbox and click OK.
12. The Burp Suite main window appears; click the Proxy tab from the available
options in the top section of the window.
13. In the Proxy settings, by default, the Intercept tab opens-up. Observe that by
default, the interception is active as the button says Intercept is on. Leave it
running.
16. Now, right-click anywhere on the HTTP request window, and from the context
menu, click Send to Intruder.
18. In the Positions tab under the Intruder tab observe that Burp Suite sets the
target positions by default, as shown in the HTTP request. Click the Clear
§ button from the right-pane to clear the default payload values.
19. Once you clear the default payload values, select Cluster bomb from
the Attack type drop-down list.
Cluster bomb uses multiple payload sets. There is a different payload set for
each defined position (up to a maximum of 20). The attack iterates through each
payload set in turn so that all permutations of payload combinations are tested.
For example, if there are two payload positions, the attack will place the first
payload from payload set 2 into position 2 and iterate through all payloads in
payload set 1 in position 1; it will then place the second payload from payload
set 2 into position 2 and iterate through all the payloads in payload set 1 in
position 1.
more...
20. Now, we will set the username and password as the payload values. To do so,
select the username value entered in Step#14 and click Add § from the right-
pane. Similarly, select the password value entered in Step#14 and click Add
§ from the right-pane.
23. Under the Payload settings [Simple list] section, click the Load… button.
27. Under the Payload settings [Simple list] section, click the Load… button.
33. Wait for the progress bar at the bottom of the window to complete.
34. After the progress bar completes, scroll down and observe the different values
of Status and Length. Here, Status=302 and Length= 1155.
Different values of Status and Length indicate that the combination of the
respective credentials is successful.
The values might differ when you perform this task.
35. In the Raw tab under the Request tab, the HTTP request with a set of the
correct credentials is displayed. (here, username=admin and
password=qwerty@123), as shown in the screenshot. Note down these user
credentials.
36. Now, that you have obtained the correct user credentials, close the Intruder
attack of 10.10.1.22 window.
37. Navigate back to the Proxy tab and click the Intercept is on button to turn off
the interception. The Intercept is on button toggles to Intercept is off,
indicating that the interception is off.
38. Switch to the browser window and perform Step#4-5. Remove the browser
proxy set up in Step#6, by selecting the No proxy radio-button in
the Connection Settings window and click OK. Close the tab.
39. Reload the target website http://10.10.1.22:8080/CEH/wp-login.php?, enter
the Username and Password obtained in Step#35 and click Log In.
40. You are successfully logged in using the brute-forced credentials. The Welcome
to WordPress! Page appears, as shown in the screenshot.
41. This concludes the demonstration of how to perform a brute-force attack using
Burp Suite.
42. Close all open windows and document all acquired information.
Question 14.2.1.1
Here, we will perform a CSRF attack using vulnerability present in the wp-upg plugin.
1. Click Windows Server 2022 to switch to the Windows Server 2022 machine
and login with CEH\Administrator / Pa$$w0rd.
2. Click Type here to search field on the Desktop, search for wampserver64 in
the search bar and select Wampserver64 from the results.
3. Now, in the right corner of Desktop, click the Show hidden icons icon, observe
that the WampServer icon appears.
4. Wait for this icon to turn green, which indicates that the WampServer is
successfully running.
7. Assume that you have installed and configured User Post Gallery plugin
8. Hover your mouse cursor on Plugins in the left pane and click Installed
Plugins, as shown in the screenshot.
9. In the Plugins page, observe that User Post Gallery is installed.
Click Activate under the User Post Gallery plugin to activate the plugin.
10. Click Parrot Security to switch to the Parrot Security machine.
11. Open Mozilla Firefox web browser and go to https://wpscan.com/ and login to
the wpscan account that you have created in previous task.
12. You get signed in successfully in the website. Now, click the Get Started button
and click Start for free button under Researcher section.
13. The Edit Profile page appears; in the API Token section and observe the API
Token. Note down or copy this API Token; we will use this token in the later
steps.
15. In the Parrot Security machine, open a Terminal window and execute sudo
su to run the programs as a root user (When prompted, enter the
password toor).
20. In the Plugin(s) Identified section, within the context of the wp-upg plugin,
an Unauthenticated Remote Code Execution (RCE) vulnerability has been
detected as shown in the screenshot.
The number of vulnerable plugins might differ when you perform this lab.
21. In this task, we will exploit the RCE vulnerability present in the wp-upg plugin.
24. In the last step, whoami command was executed, yielding the outcome nt
authority\ \system
26. Close all open windows on both the machines (Windows Server
2022 and Parrot Security) and document all acquired information.
Question 14.2.2.1
In Windows Server 2022 machine activate User Post Gallery plugin which is installed in
http://10.10.1.22:8080/CEH web application. From Parrot Security machine, scan for vulnerable
plugins on the http://10.10.1.22:8080/CEH web application hosted in Windows Server 2022
machine using WPScan and perform Remote code execution attack on the
http://10.10.1.22:8080/CEH website. Enter the plugin name that was identified exploited in the
target web application to perform RCE attack.
Lab 3: Detect Web Application Vulnerabilities
using Various Web Application Security Tools
Lab Scenario
Web application attacks, launched on port 80/443, go straight through the firewall, past the
OS and network-level security, and into the heart of the application, where corporate data
resides. Tailor-made web applications are often insufficiently tested, have undiscovered
vulnerabilities, and are, therefore, easy prey for hackers.
A professional ethical hacker or pen tester needs to determine whether their organization's
website is secure, before hackers download sensitive data, commit crimes using the website
as a launchpad, or otherwise endanger the business. There are various web application
security assessment tools available to scan, detect, and assess the security and vulnerabilities
of web applications. These tools reveal the web application's security posture and are used to
find ways to harden security and create robust web applications. These tools automate the
process of accurate web-app security assessment, thus enabling cybersecurity staff to protect
their business from impending hacker attacks!
The tasks in this lab will assist in discovering the underlying vulnerabilities and flaws in the
target web application.
Lab Objectives
Web application security deals with securing websites, web applications, and web services.
Web application security includes secure application development, input validation, creating
and following security best practices, using WAF Firewall/IDS, and performing regular
auditing of a network using web application security tools.
Web Application security tools are automated tools that scan web applications, normally
from the outside, to look for security vulnerabilities such as XSS, SQL injection, command
injection, path traversal, and insecure server configuration. This category of tools is
frequently referred to as Dynamic Application Security Testing (DAST) Tools.
The name of the .html file varies when you perform this lab.
8. Run cp certifiedhacker.com_xxxxxxxx_xxxx.html
/home/attacker/ command to copy the .html file to /home/attacker location.
9. Open a new terminal and run firefox
certifiedhacker.com_xxxxxxxx_xxxx.html command to open the .html file
in Firefox browser.
10. Wapiti scan report opens upp in Firefox browser, you can analyze the scan
result with the discovered vulnerabilities.
11. Scroll down to view the detailed information regarding each discovered
vulnerability.
12. This concludes the demonstration of discovering vulnerabilities in a target
website scanning using wapiti.
13. Close all open windows and document all acquired information.
Question 14.3.1.1
In Parrot Security machine use wapiti web application security scanner to detect web
application vulnerabilities of https://www.certifiedhacker.com web application and generate a
.html report. Enter the WSTG code of the Clickjacking Protection vulnerability. (Answer
Format: XXXX-X-Xxxxx-Xxxxxxx)
Lab 4: Perform Web Application Hacking using
AI
Lab Scenario
Hacking web applications using AI involves leveraging advanced machine learning techniques to
exploit vulnerabilities in web applications. This approach can automate and enhance the
traditional methods of penetration testing and vulnerability assessment.
The labs in this exercise demonstrate how to perform web application hacking using AI.
Lab Objectives
The commands generated by ShellGPT may vary depending on the prompt used and the tools
available on the machine. Due to these variables, the output generated by ShellGPT might differ
from what is shown in the screenshots. These differences arise from the dynamic nature of the
AI's processing and the diverse environments in which it operates. As a result, you may observe
differences in command syntax, execution, and results while performing this lab task.
1. Click Parrot Security to switch to Parrot machine, and login with attacker/toor.
Open a Terminal window and execute sudo su to run the program as a root
user (When prompted, enter the password toor).
2. Run bash sgpt.sh command to configure ShellGPT and the AI activation key.
19. This concludes the demonstration of Webserver footprinting and attacks using
ShellGPT.
20. Close all open windows and document all the acquired information.
Question 14.4.1.1
Write a prompt using ShellGPT and execute it on the Parrot Security machine to check if website
https://www.certifiedhacker.com is protected with a web application firewall using wafwoof. Enter
the name of the web application firewall found during the scan.