<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://elvis.hcw.ac.at/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=MVucinic</id>
	<title>Elvis Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://elvis.hcw.ac.at/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=MVucinic"/>
	<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php/Special:Contributions/MVucinic"/>
	<updated>2026-09-10T16:34:28Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.5</generator>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Cross-Site_Scripting_(XSS)&amp;diff=17576</id>
		<title>Cross-Site Scripting (XSS)</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Cross-Site_Scripting_(XSS)&amp;diff=17576"/>
		<updated>2024-12-18T17:53:59Z</updated>

		<summary type="html">&lt;p&gt;MVucinic: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Basic]]&lt;br /&gt;
== Cross-Site Scripting (XSS) ==&lt;br /&gt;
&lt;br /&gt;
 [[Image:xss_diagram.png|300px|thumb| The operational principle of Cross-Site Scripting (XSS)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cross-Site Scripting is a class of web application vulnerabilities, which is still one of the most common security vulnerabilities in web applications and can be used to compromise the confidentiality, integrity, and availability of the application. In general, XSS vulnerabilities allow an attacker to execute script code in the web browser of the victim and can be used to gain data from users, like cookies or private information. The different types are listed below. It is also possible to trigger actions on websites, redirect to other sites or hide advertisements. A short game with which some options can be seen easily: [https://xss-game.appspot.com/ XSS game]&lt;br /&gt;
&lt;br /&gt;
== Types ==&lt;br /&gt;
There are two ways to classify XSS attacks. Up until 2012 the types DOM-based (Type 0), stored/persistent (Type I) and reflected/non-persistent (Type II) were used. However, due to the potential overlap among these three types, the research community introduced the terms Server XSS and Client XSS from 2012 onward.&lt;br /&gt;
[[File:Server-XSS_vs_Client-XSS_Chart.png|200px|thumb]]&lt;br /&gt;
&lt;br /&gt;
=== Stored (Type I) ===&lt;br /&gt;
Stored XSS, also known as persistent XSS, occurs when the application or API stores unvalidated user input on the server, for example, in a database, comment field, visitor log, etc. This stored input is later retrieved and displayed by another user or administrator who requests the stored information.&lt;br /&gt;
&lt;br /&gt;
=== Reflected (Type II) ===&lt;br /&gt;
Reflected XSS is a non-persistent attack and is used to steal session cookies from a user. With Reflected XSS, the application or API includes unchecked and unmasked input from the user as part of the HTML output. If the attack was successful, the attacker could execute arbitrary HTML and a scripting language such as Javascript in the victim&#039;s browser. Typically, a user will have to click on a malicious link to do this. The attacker tries to bring this harmful link to the victim, via advertising, e-mail etc. &lt;br /&gt;
&lt;br /&gt;
=== DOM Based (Type 0) ===&lt;br /&gt;
DOM-based Cross-Site Scripting (XSS) is a type of XSS attack that occurs when malicious code is injected directly into the Document Object Model (DOM) of the web application. DOM-based XSS attacks can occur when user-supplied data is used to generate client-side JavaScript code without proper input validation. The malicious code is then sent to a user&#039;s browser, where it is executed. DOM-based XSS attacks can be used to gain access to sensitive information, perform malicious activities, and even hijack the user’s browser.&lt;br /&gt;
&lt;br /&gt;
==Demonstrations==&lt;br /&gt;
&lt;br /&gt;
This section demonstrates the three Cross-Site Scripting (XSS) attacks using the intentionally vulnerable OWASP Mutillidae II platform. These demonstrations include Stored XSS, Reflected XSS, and DOM-based XSS attacks, showcasing how vulnerabilities can be exploited to steal sensitive information in real-world scenarios. Specifically, these examples focus on stealing the victim&#039;s cookies.&lt;br /&gt;
&lt;br /&gt;
If you want to recreate these attacks, refer to this article: https://wiki.elvis.science/index.php?title=OWASP_Mutillidae_(2021) for detailed instructions on installing and using OWASP Mutillidae II.&lt;br /&gt;
&lt;br /&gt;
===Preparation Steps=== &lt;br /&gt;
Before demonstrating the attacks, it&#039;s essential to understand the groundwork required for successful execution. This includes identifying vulnerabilities, inspecting cookies, and preparing the necessary scripts and files for the exploitation process.&lt;br /&gt;
&lt;br /&gt;
====Searching for Exploits====&lt;br /&gt;
&lt;br /&gt;
Identifying vulnerabilities is a the first step. Attackers exploit weaknesses in web applications to inject malicious scripts. Techniques include:&lt;br /&gt;
&lt;br /&gt;
* Analyzing the Page Source: Review the HTML and JavaScript code for insecure functions like innerHTML, document.write, or unescaped user inputs. These functions often process user-supplied data without proper sanitization, creating potential attack vectors.&lt;br /&gt;
* Testing Input Fields: Use simple script tags to test input validation. For example, &amp;lt;script&amp;gt;alert(&amp;quot;Yooooooo&amp;quot;)&amp;lt;/script&amp;gt; can reveal whether the application sanitizes or escapes user input. If the alert box appears, it indicates the input field is vulnerable.&lt;br /&gt;
* Using Developer Tools: Open developer tools (F12) in your browser to inspect how data is handled:&lt;br /&gt;
* Check the &amp;quot;Application&amp;quot; tab for cookies or local storage.&lt;br /&gt;
Inspect server responses and client-side behavior to understand how data flows between them.&lt;br /&gt;
&lt;br /&gt;
[[File:Innerhtml.PNG]] [[File:Test-script.PNG]]&lt;br /&gt;
&lt;br /&gt;
Exploring these areas helps pinpoint potential vulnerabilities that can be leveraged in the attacks.&lt;br /&gt;
&lt;br /&gt;
====Inspecting Cookies====&lt;br /&gt;
&lt;br /&gt;
Cookies are a primary target for XSS attacks because they often store sensitive session data like authentication tokens. To check their accessibility:&lt;br /&gt;
&lt;br /&gt;
* Developer Tools Navigation: Go to the &amp;quot;Application&amp;quot; tab in browser developer tools and locate the &amp;quot;Cookies&amp;quot; section under &amp;quot;Storage.&amp;quot;&lt;br /&gt;
* Check for Security Flags: Look for cookies missing protective flags such as HttpOnly (prevents client-side access), Secure (ensures transmission over HTTPS), or SameSite (restricts third-party context usage).&lt;br /&gt;
* Use the Console: Enter document.cookie in the browser console to see if cookies are accessible. If cookies are displayed, they are vulnerable to theft.&lt;br /&gt;
&lt;br /&gt;
[[File:Document-cookies.PNG]] [[File:Httponly-no.PNG]]&lt;br /&gt;
&lt;br /&gt;
Understanding how cookies are stored and secured provides critical insight into an application&#039;s vulnerability.&lt;br /&gt;
&lt;br /&gt;
====Required Files====&lt;br /&gt;
&lt;br /&gt;
To execute the XSS demonstrations successfully, the following files and scripts are essential:&lt;br /&gt;
&lt;br /&gt;
* Cookie Logger Script (cookie-logger.php): A PHP script hosted on the attacker’s server to log cookies sent by the malicious payload. It listens for a cookies parameter in the URL, extracts its value, and writes it to the stolen-cookies.txt file along with a timestamp.&lt;br /&gt;
* Stolen Cookies File (stolen-cookies.txt): A plain text file used to store intercepted cookies. Each entry includes the captured cookie data and the timestamp of when it was received.&lt;br /&gt;
* Malicious Script: A custom JavaScript payload crafted to exploit the identified vulnerabilities. This script retrieves cookies using document.cookie and sends them to the attacker’s cookie-logger.php script.&lt;br /&gt;
&lt;br /&gt;
[[File:Php-script.PNG]]  [[File:Stolen-cookies.PNG]]&lt;br /&gt;
&lt;br /&gt;
These files and scripts form the backbone of the XSS demonstrations. Ensure they are set up correctly and tested in a controlled environment to replicate the attacks.&lt;br /&gt;
&lt;br /&gt;
====Demonstrations====&lt;br /&gt;
=====Stored XSS=====&lt;br /&gt;
Stored XSS involves injecting malicious scripts that are permanently stored on the server, such as in a database or a comment field. These scripts execute whenever a victim accesses the vulnerable page. I used the ”Add to your blog” found under OWASP 2017/A7 - Cross-Site Scripting (XSS)/Persistent (Second Order) in Mutillidae II.&lt;br /&gt;
&lt;br /&gt;
This is the script we then send to the database to essentally &amp;quot;poison&amp;quot; the website:&lt;br /&gt;
&lt;br /&gt;
[[File:Stored-script.PNG]]&lt;br /&gt;
&lt;br /&gt;
Once this is uploaded one can check if its properly working by visiting this website from another device and also ckecking the stolen-cookies.txt file. If, after visiting the site, the file has something in it (the Cookie) then its properly working and you have successfully finshed/done a Stored XSS attack.&lt;br /&gt;
&lt;br /&gt;
=====Reflected XSS Attack=====&lt;br /&gt;
&lt;br /&gt;
Reflected XSS uses a crafted URL that directly includes the malicious payload, which is reflected back in the server&#039;s response. This attack relies on tricking the victim into clicking the URL. I used the ”DNS Lookup” found underOWASP 2017/A7 - Cross-Site Scripting (XSS)/Reflected (First Order) in Mutillidae II.&lt;br /&gt;
&lt;br /&gt;
This is the manipulated URL that one has to send(coded and decoded):&lt;br /&gt;
&lt;br /&gt;
[[File: Coded-reflected.PNG]] [[File: Decoded-reflected.PNG]]&lt;br /&gt;
&lt;br /&gt;
You can now send this URL to yourself to test it out and also ckeck the stolen-cookies.txt file out. If, after visiting the site through that URL, the file has something in it (the Cookie) then its properly working and you have successfully finshed/done a ReflectedXSS attack. Note:the second and thrid IP should be the attackers servers IP.&lt;br /&gt;
&lt;br /&gt;
=====DOM based XSS=====&lt;br /&gt;
&lt;br /&gt;
DOM-based XSS manipulates the client-side Document Object Model (DOM) without server interaction. The attack occurs entirely in the victim&#039;s browser. I used the ”Password Generator” found under OWASP 2017/A7 - Cross-Site Scripting (XSS)/DOM-Based in Mutillidae II.&lt;br /&gt;
&lt;br /&gt;
This is the manipulated URL that one has to send(coded and decoded):&lt;br /&gt;
&lt;br /&gt;
[[File: Dom-xss-coded.PNG]]    [[File:Decoded-dom-based.PNG]]&lt;br /&gt;
&lt;br /&gt;
You can now send this URL to yourself to test it out and also ckeck the stolen-cookies.txt file out. If, after visiting the site through that URL, the file has something in it (the Cookie) then its properly working and you have successfully finshed/done a DOM based XSS attack. ote:the second and thrid IP should be the attackers servers IP.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
These demonstrations illustrate the risks of XSS attacks and their potential to steal sensitive data like cookies. Understanding these methods is crucial for identifying and mitigating vulnerabilities. Always practice responsibly in controlled environments like OWASP Mutillidae II to promote safer web applications.&lt;br /&gt;
&lt;br /&gt;
== XSS attack consequences ==&lt;br /&gt;
&lt;br /&gt;
A Cross-Site Scripting (XSS) attack can have various severe consequences, including:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Data Theft&#039;&#039;&#039;: Stealing sensitive user data such as login credentials, session tokens, and personal information.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Identity Theft&#039;&#039;&#039;: Stealing user identities to take over their accounts, resulting in fraudulent activity.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Session Hijacking&#039;&#039;&#039;: Taking control of user sessions and accessing their accounts without the user&#039;s knowledge.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Malware Propagation&#039;&#039;&#039;: Injecting the malicious code into websites, which is then executed by unsuspecting users, resulting in the spread of malware.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Phishing&#039;&#039;&#039;: XSS can be employed to display fake login forms or deceptive content on legitimate websites, leading to phishing attacks.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Content Manipulation&#039;&#039;&#039;: Manipulation of website content to send users false information or carry out malicious actions on their behalf.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Reputation Damage&#039;&#039;&#039;: Cross-Site Scripting (XSS) attacks have the potential to damage user confidence in a website or application, particularly in cases where personal information is exposed.&lt;br /&gt;
== Prevention==&lt;br /&gt;
&lt;br /&gt;
The prevention of these vulnerabilities is the responsibility of the programmer. Programmers should adopt secure programming practices, such as context-sensitive server-side output encoding, to ensure the prevention of malicious script injections through incorrect or unchecked entries.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Effective prevention measures include:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input validation&#039;&#039;&#039;: Rigorous validation of user input before acceptance and processing by the server is crucial to prevent cross-site scripting attacks.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Output encoding&#039;&#039;&#039;: Encoding all output data (using HTML entities) is another effective measure to prevent cross-site scripting. This ensures proper display in the user&#039;s browser.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Content Security Policy (CSP)&#039;&#039;&#039;: Implementing a Content Security Policy defines rules for the types of content a website can load, contributing to preventing cross-site scripting attacks.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Use of tokens&#039;&#039;&#039;: Employing random character strings (tokens) to identify users can help prevent cross-site scripting attacks, ensuring that only authorized users access the website.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Disabling script execution&#039;&#039;&#039;: While disabling script execution on the server, especially for certain scripting languages like JavaScript or VBScript, can help prevent cross-site scripting, it is rarely used due to the widespread use of JavaScript.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Secure Password Policies&#039;&#039;&#039;: It is recommended to use complex passwords and consider introducing multi-factor authentication for an additional layer of security.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Session Management&#039;&#039;&#039;: The application of session management, such as session timeout, involves configuring actions related to sessions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Security Patching&#039;&#039;&#039;: Ensuring that all software, including web servers, databases and frameworks, are kept up to date with the latest security patches. Regular updates and patches should be applied to fix known vulnerabilities in the system.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Security Audits and Code Reviews&#039;&#039;&#039;: Conducting regular security audits and code reviews to help identify and remediate potential vulnerabilities. Third-party security assessments can provide an independent assessment of your application&#039;s security posture.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://owasp.org/www-community/attacks/xss/&lt;br /&gt;
* https://cheatsheetseries.owasp.org/cheatsheets/DOM_based_XSS_Prevention_Cheat_Sheet.html&lt;br /&gt;
* https://owasp.org/www-project-top-ten/2017/A7_2017-Cross-Site_Scripting_(XSS)&lt;br /&gt;
* https://portswigger.net/web-security/cross-site-scripting&lt;br /&gt;
* https://www.sans.org/white-papers/988/&lt;br /&gt;
* https://learn.microsoft.com/en-us/aspnet/core/security/cross-site-scripting?view=aspnetcore-8.0&lt;br /&gt;
* https://www.wallarm.com/what/a7-cross-site-scripting-xss-2017-owasp&lt;br /&gt;
* https://wiki.elvis.science/index.php?title=OWASP_Mutillidae_(2021)&lt;/div&gt;</summary>
		<author><name>MVucinic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Cross-Site_Scripting_(XSS)&amp;diff=17575</id>
		<title>Cross-Site Scripting (XSS)</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Cross-Site_Scripting_(XSS)&amp;diff=17575"/>
		<updated>2024-12-18T17:53:47Z</updated>

		<summary type="html">&lt;p&gt;MVucinic: /* Demonstrations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Basic]]&lt;br /&gt;
== Cross-Site Scripting (XSS) ==&lt;br /&gt;
&lt;br /&gt;
 [[Image:xss_diagram.png|300px|thumb| The operational principle of Cross-Site Scripting (XSS)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cross-Site Scripting is a class of web application vulnerabilities, which is still one of the most common security vulnerabilities in web applications and can be used to compromise the confidentiality, integrity, and availability of the application. In general, XSS vulnerabilities allow an attacker to execute script code in the web browser of the victim and can be used to gain data from users, like cookies or private information. The different types are listed below. It is also possible to trigger actions on websites, redirect to other sites or hide advertisements. A short game with which some options can be seen easily: [https://xss-game.appspot.com/ XSS game]&lt;br /&gt;
&lt;br /&gt;
== Types ==&lt;br /&gt;
There are two ways to classify XSS attacks. Up until 2012 the types DOM-based (Type 0), stored/persistent (Type I) and reflected/non-persistent (Type II) were used. However, due to the potential overlap among these three types, the research community introduced the terms Server XSS and Client XSS from 2012 onward.&lt;br /&gt;
[[File:Server-XSS_vs_Client-XSS_Chart.png|200px|thumb]]&lt;br /&gt;
&lt;br /&gt;
=== Stored (Type I) ===&lt;br /&gt;
Stored XSS, also known as persistent XSS, occurs when the application or API stores unvalidated user input on the server, for example, in a database, comment field, visitor log, etc. This stored input is later retrieved and displayed by another user or administrator who requests the stored information.&lt;br /&gt;
&lt;br /&gt;
=== Reflected (Type II) ===&lt;br /&gt;
Reflected XSS is a non-persistent attack and is used to steal session cookies from a user. With Reflected XSS, the application or API includes unchecked and unmasked input from the user as part of the HTML output. If the attack was successful, the attacker could execute arbitrary HTML and a scripting language such as Javascript in the victim&#039;s browser. Typically, a user will have to click on a malicious link to do this. The attacker tries to bring this harmful link to the victim, via advertising, e-mail etc. &lt;br /&gt;
&lt;br /&gt;
=== DOM Based (Type 0) ===&lt;br /&gt;
DOM-based Cross-Site Scripting (XSS) is a type of XSS attack that occurs when malicious code is injected directly into the Document Object Model (DOM) of the web application. DOM-based XSS attacks can occur when user-supplied data is used to generate client-side JavaScript code without proper input validation. The malicious code is then sent to a user&#039;s browser, where it is executed. DOM-based XSS attacks can be used to gain access to sensitive information, perform malicious activities, and even hijack the user’s browser.&lt;br /&gt;
&lt;br /&gt;
==Demonstrations==&lt;br /&gt;
&lt;br /&gt;
This section demonstrates the three Cross-Site Scripting (XSS) attacks using the intentionally vulnerable OWASP Mutillidae II platform. These demonstrations include Stored XSS, Reflected XSS, and DOM-based XSS attacks, showcasing how vulnerabilities can be exploited to steal sensitive information in real-world scenarios. Specifically, these examples focus on stealing the victim&#039;s cookies.&lt;br /&gt;
&lt;br /&gt;
If you want to recreate these attacks, refer to this article: https://wiki.elvis.science/index.php?title=OWASP_Mutillidae_(2021) for detailed instructions on installing and using OWASP Mutillidae II.&lt;br /&gt;
&lt;br /&gt;
===Preparation Steps=== &lt;br /&gt;
Before demonstrating the attacks, it&#039;s essential to understand the groundwork required for successful execution. This includes identifying vulnerabilities, inspecting cookies, and preparing the necessary scripts and files for the exploitation process.&lt;br /&gt;
&lt;br /&gt;
====Searching for Exploits====&lt;br /&gt;
&lt;br /&gt;
Identifying vulnerabilities is a the first step. Attackers exploit weaknesses in web applications to inject malicious scripts. Techniques include:&lt;br /&gt;
&lt;br /&gt;
* Analyzing the Page Source: Review the HTML and JavaScript code for insecure functions like innerHTML, document.write, or unescaped user inputs. These functions often process user-supplied data without proper sanitization, creating potential attack vectors.&lt;br /&gt;
* Testing Input Fields: Use simple script tags to test input validation. For example, &amp;lt;script&amp;gt;alert(&amp;quot;Yooooooo&amp;quot;)&amp;lt;/script&amp;gt; can reveal whether the application sanitizes or escapes user input. If the alert box appears, it indicates the input field is vulnerable.&lt;br /&gt;
* Using Developer Tools: Open developer tools (F12) in your browser to inspect how data is handled:&lt;br /&gt;
* Check the &amp;quot;Application&amp;quot; tab for cookies or local storage.&lt;br /&gt;
Inspect server responses and client-side behavior to understand how data flows between them.&lt;br /&gt;
&lt;br /&gt;
[[File:Innerhtml.PNG]] [[File:Test-script.PNG]]&lt;br /&gt;
&lt;br /&gt;
Exploring these areas helps pinpoint potential vulnerabilities that can be leveraged in the attacks.&lt;br /&gt;
&lt;br /&gt;
====Inspecting Cookies====&lt;br /&gt;
&lt;br /&gt;
Cookies are a primary target for XSS attacks because they often store sensitive session data like authentication tokens. To check their accessibility:&lt;br /&gt;
&lt;br /&gt;
* Developer Tools Navigation: Go to the &amp;quot;Application&amp;quot; tab in browser developer tools and locate the &amp;quot;Cookies&amp;quot; section under &amp;quot;Storage.&amp;quot;&lt;br /&gt;
* Check for Security Flags: Look for cookies missing protective flags such as HttpOnly (prevents client-side access), Secure (ensures transmission over HTTPS), or SameSite (restricts third-party context usage).&lt;br /&gt;
* Use the Console: Enter document.cookie in the browser console to see if cookies are accessible. If cookies are displayed, they are vulnerable to theft.&lt;br /&gt;
&lt;br /&gt;
[[File:Document-cookies.PNG]] [[File:Httponly-no.PNG]]&lt;br /&gt;
&lt;br /&gt;
Understanding how cookies are stored and secured provides critical insight into an application&#039;s vulnerability.&lt;br /&gt;
&lt;br /&gt;
====Required Files====&lt;br /&gt;
&lt;br /&gt;
To execute the XSS demonstrations successfully, the following files and scripts are essential:&lt;br /&gt;
&lt;br /&gt;
* Cookie Logger Script (cookie-logger.php): A PHP script hosted on the attacker’s server to log cookies sent by the malicious payload. It listens for a cookies parameter in the URL, extracts its value, and writes it to the stolen-cookies.txt file along with a timestamp.&lt;br /&gt;
* Stolen Cookies File (stolen-cookies.txt): A plain text file used to store intercepted cookies. Each entry includes the captured cookie data and the timestamp of when it was received.&lt;br /&gt;
* Malicious Script: A custom JavaScript payload crafted to exploit the identified vulnerabilities. This script retrieves cookies using document.cookie and sends them to the attacker’s cookie-logger.php script.&lt;br /&gt;
&lt;br /&gt;
[[File:Php-script.PNG]]  [[File:Stolen-cookies.PNG]]&lt;br /&gt;
&lt;br /&gt;
These files and scripts form the backbone of the XSS demonstrations. Ensure they are set up correctly and tested in a controlled environment to replicate the attacks.&lt;br /&gt;
&lt;br /&gt;
====Demonstrations====&lt;br /&gt;
=====Stored XSS=====&lt;br /&gt;
Stored XSS involves injecting malicious scripts that are permanently stored on the server, such as in a database or a comment field. These scripts execute whenever a victim accesses the vulnerable page. I used the ”Add to your blog” found under OWASP 2017/A7 - Cross-Site Scripting (XSS)/Persistent (Second Order) in Mutillidae II.&lt;br /&gt;
&lt;br /&gt;
This is the script we then send to the database to essentally &amp;quot;poison&amp;quot; the website:&lt;br /&gt;
&lt;br /&gt;
[[File:Stored-script.PNG]]&lt;br /&gt;
&lt;br /&gt;
Once this is uploaded one can check if its properly working by visiting this website from another device and also ckecking the stolen-cookies.txt file. If, after visiting the site, the file has something in it (the Cookie) then its properly working and you have successfully finshed/done a Stored XSS attack.&lt;br /&gt;
&lt;br /&gt;
=====Reflected XSS Attack=====&lt;br /&gt;
&lt;br /&gt;
Reflected XSS uses a crafted URL that directly includes the malicious payload, which is reflected back in the server&#039;s response. This attack relies on tricking the victim into clicking the URL. I used the ”DNS Lookup” found underOWASP 2017/A7 - Cross-Site Scripting (XSS)/Reflected (First Order) in Mutillidae II.&lt;br /&gt;
&lt;br /&gt;
This is the manipulated URL that one has to send(coded and decoded):&lt;br /&gt;
&lt;br /&gt;
[[File: Coded-reflected.PNG]] [[File: Decoded-reflected.PNG]]&lt;br /&gt;
&lt;br /&gt;
You can now send this URL to yourself to test it out and also ckeck the stolen-cookies.txt file out. If, after visiting the site through that URL, the file has something in it (the Cookie) then its properly working and you have successfully finshed/done a ReflectedXSS attack. Note:the second and thrid IP should be the attackers servers IP.&lt;br /&gt;
&lt;br /&gt;
=====DOM based XSS=====&lt;br /&gt;
&lt;br /&gt;
DOM-based XSS manipulates the client-side Document Object Model (DOM) without server interaction. The attack occurs entirely in the victim&#039;s browser. I used the ”Password Generator” found under OWASP 2017/A7 - Cross-Site Scripting (XSS)/DOM-Based in Mutillidae II.&lt;br /&gt;
&lt;br /&gt;
This is the manipulated URL that one has to send(coded and decoded):&lt;br /&gt;
&lt;br /&gt;
[[File: Dom-xss-coded.PNG]]    [[File:Decoded-dom-based.PNG]]&lt;br /&gt;
&lt;br /&gt;
You can now send this URL to yourself to test it out and also ckeck the stolen-cookies.txt file out. If, after visiting the site through that URL, the file has something in it (the Cookie) then its properly working and you have successfully finshed/done a DOM based XSS attack. ote:the second and thrid IP should be the attackers servers IP.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
These demonstrations illustrate the risks of XSS attacks and their potential to steal sensitive data like cookies. Understanding these methods is crucial for identifying and mitigating vulnerabilities. Always practice responsibly in controlled environments like OWASP Mutillidae II to promote safer web applications.&lt;br /&gt;
&lt;br /&gt;
== XSS attack consequences ==&lt;br /&gt;
&lt;br /&gt;
A Cross-Site Scripting (XSS) attack can have various severe consequences, including:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Data Theft&#039;&#039;&#039;: Stealing sensitive user data such as login credentials, session tokens, and personal information.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Identity Theft&#039;&#039;&#039;: Stealing user identities to take over their accounts, resulting in fraudulent activity.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Session Hijacking&#039;&#039;&#039;: Taking control of user sessions and accessing their accounts without the user&#039;s knowledge.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Malware Propagation&#039;&#039;&#039;: Injecting the malicious code into websites, which is then executed by unsuspecting users, resulting in the spread of malware.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Phishing&#039;&#039;&#039;: XSS can be employed to display fake login forms or deceptive content on legitimate websites, leading to phishing attacks.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Content Manipulation&#039;&#039;&#039;: Manipulation of website content to send users false information or carry out malicious actions on their behalf.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Reputation Damage&#039;&#039;&#039;: Cross-Site Scripting (XSS) attacks have the potential to damage user confidence in a website or application, particularly in cases where personal information is exposed.&lt;br /&gt;
== Prevention==&lt;br /&gt;
&lt;br /&gt;
The prevention of these vulnerabilities is the responsibility of the programmer. Programmers should adopt secure programming practices, such as context-sensitive server-side output encoding, to ensure the prevention of malicious script injections through incorrect or unchecked entries.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Effective prevention measures include:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input validation&#039;&#039;&#039;: Rigorous validation of user input before acceptance and processing by the server is crucial to prevent cross-site scripting attacks.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Output encoding&#039;&#039;&#039;: Encoding all output data (using HTML entities) is another effective measure to prevent cross-site scripting. This ensures proper display in the user&#039;s browser.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Content Security Policy (CSP)&#039;&#039;&#039;: Implementing a Content Security Policy defines rules for the types of content a website can load, contributing to preventing cross-site scripting attacks.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Use of tokens&#039;&#039;&#039;: Employing random character strings (tokens) to identify users can help prevent cross-site scripting attacks, ensuring that only authorized users access the website.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Disabling script execution&#039;&#039;&#039;: While disabling script execution on the server, especially for certain scripting languages like JavaScript or VBScript, can help prevent cross-site scripting, it is rarely used due to the widespread use of JavaScript.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Secure Password Policies&#039;&#039;&#039;: It is recommended to use complex passwords and consider introducing multi-factor authentication for an additional layer of security.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Session Management&#039;&#039;&#039;: The application of session management, such as session timeout, involves configuring actions related to sessions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Security Patching&#039;&#039;&#039;: Ensuring that all software, including web servers, databases and frameworks, are kept up to date with the latest security patches. Regular updates and patches should be applied to fix known vulnerabilities in the system.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Security Audits and Code Reviews&#039;&#039;&#039;: Conducting regular security audits and code reviews to help identify and remediate potential vulnerabilities. Third-party security assessments can provide an independent assessment of your application&#039;s security posture.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://owasp.org/www-community/attacks/xss/&lt;br /&gt;
* https://cheatsheetseries.owasp.org/cheatsheets/DOM_based_XSS_Prevention_Cheat_Sheet.html&lt;br /&gt;
* https://owasp.org/www-project-top-ten/2017/A7_2017-Cross-Site_Scripting_(XSS)&lt;br /&gt;
* https://portswigger.net/web-security/cross-site-scripting&lt;br /&gt;
* https://www.sans.org/white-papers/988/&lt;br /&gt;
* https://learn.microsoft.com/en-us/aspnet/core/security/cross-site-scripting?view=aspnetcore-8.0&lt;br /&gt;
* https://www.wallarm.com/what/a7-cross-site-scripting-xss-2017-owasp&lt;/div&gt;</summary>
		<author><name>MVucinic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Cross-Site_Scripting_(XSS)&amp;diff=17574</id>
		<title>Cross-Site Scripting (XSS)</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Cross-Site_Scripting_(XSS)&amp;diff=17574"/>
		<updated>2024-12-18T17:52:59Z</updated>

		<summary type="html">&lt;p&gt;MVucinic: /* Demonstrations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Basic]]&lt;br /&gt;
== Cross-Site Scripting (XSS) ==&lt;br /&gt;
&lt;br /&gt;
 [[Image:xss_diagram.png|300px|thumb| The operational principle of Cross-Site Scripting (XSS)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cross-Site Scripting is a class of web application vulnerabilities, which is still one of the most common security vulnerabilities in web applications and can be used to compromise the confidentiality, integrity, and availability of the application. In general, XSS vulnerabilities allow an attacker to execute script code in the web browser of the victim and can be used to gain data from users, like cookies or private information. The different types are listed below. It is also possible to trigger actions on websites, redirect to other sites or hide advertisements. A short game with which some options can be seen easily: [https://xss-game.appspot.com/ XSS game]&lt;br /&gt;
&lt;br /&gt;
== Types ==&lt;br /&gt;
There are two ways to classify XSS attacks. Up until 2012 the types DOM-based (Type 0), stored/persistent (Type I) and reflected/non-persistent (Type II) were used. However, due to the potential overlap among these three types, the research community introduced the terms Server XSS and Client XSS from 2012 onward.&lt;br /&gt;
[[File:Server-XSS_vs_Client-XSS_Chart.png|200px|thumb]]&lt;br /&gt;
&lt;br /&gt;
=== Stored (Type I) ===&lt;br /&gt;
Stored XSS, also known as persistent XSS, occurs when the application or API stores unvalidated user input on the server, for example, in a database, comment field, visitor log, etc. This stored input is later retrieved and displayed by another user or administrator who requests the stored information.&lt;br /&gt;
&lt;br /&gt;
=== Reflected (Type II) ===&lt;br /&gt;
Reflected XSS is a non-persistent attack and is used to steal session cookies from a user. With Reflected XSS, the application or API includes unchecked and unmasked input from the user as part of the HTML output. If the attack was successful, the attacker could execute arbitrary HTML and a scripting language such as Javascript in the victim&#039;s browser. Typically, a user will have to click on a malicious link to do this. The attacker tries to bring this harmful link to the victim, via advertising, e-mail etc. &lt;br /&gt;
&lt;br /&gt;
=== DOM Based (Type 0) ===&lt;br /&gt;
DOM-based Cross-Site Scripting (XSS) is a type of XSS attack that occurs when malicious code is injected directly into the Document Object Model (DOM) of the web application. DOM-based XSS attacks can occur when user-supplied data is used to generate client-side JavaScript code without proper input validation. The malicious code is then sent to a user&#039;s browser, where it is executed. DOM-based XSS attacks can be used to gain access to sensitive information, perform malicious activities, and even hijack the user’s browser.&lt;br /&gt;
&lt;br /&gt;
==Demonstrations==&lt;br /&gt;
&lt;br /&gt;
This section demonstrates the three Cross-Site Scripting (XSS) attacks using the intentionally vulnerable OWASP Mutillidae II platform. These demonstrations include Stored XSS, Reflected XSS, and DOM-based XSS attacks, showcasing how vulnerabilities can be exploited to steal sensitive information in real-world scenarios. Specifically, these examples focus on stealing the victim&#039;s cookies.&lt;br /&gt;
&lt;br /&gt;
If you want to recreate these attacks, refer to this article: OWASP Mutillidae (2021) for detailed instructions on installing and using OWASP Mutillidae II.&lt;br /&gt;
&lt;br /&gt;
===Preparation Steps=== &lt;br /&gt;
Before demonstrating the attacks, it&#039;s essential to understand the groundwork required for successful execution. This includes identifying vulnerabilities, inspecting cookies, and preparing the necessary scripts and files for the exploitation process.&lt;br /&gt;
&lt;br /&gt;
====Searching for Exploits====&lt;br /&gt;
&lt;br /&gt;
Identifying vulnerabilities is a the first step. Attackers exploit weaknesses in web applications to inject malicious scripts. Techniques include:&lt;br /&gt;
&lt;br /&gt;
* Analyzing the Page Source: Review the HTML and JavaScript code for insecure functions like innerHTML, document.write, or unescaped user inputs. These functions often process user-supplied data without proper sanitization, creating potential attack vectors.&lt;br /&gt;
* Testing Input Fields: Use simple script tags to test input validation. For example, &amp;lt;script&amp;gt;alert(&amp;quot;Yooooooo&amp;quot;)&amp;lt;/script&amp;gt; can reveal whether the application sanitizes or escapes user input. If the alert box appears, it indicates the input field is vulnerable.&lt;br /&gt;
* Using Developer Tools: Open developer tools (F12) in your browser to inspect how data is handled:&lt;br /&gt;
* Check the &amp;quot;Application&amp;quot; tab for cookies or local storage.&lt;br /&gt;
Inspect server responses and client-side behavior to understand how data flows between them.&lt;br /&gt;
&lt;br /&gt;
[[File:Innerhtml.PNG]] [[File:Test-script.PNG]]&lt;br /&gt;
&lt;br /&gt;
Exploring these areas helps pinpoint potential vulnerabilities that can be leveraged in the attacks.&lt;br /&gt;
&lt;br /&gt;
====Inspecting Cookies====&lt;br /&gt;
&lt;br /&gt;
Cookies are a primary target for XSS attacks because they often store sensitive session data like authentication tokens. To check their accessibility:&lt;br /&gt;
&lt;br /&gt;
* Developer Tools Navigation: Go to the &amp;quot;Application&amp;quot; tab in browser developer tools and locate the &amp;quot;Cookies&amp;quot; section under &amp;quot;Storage.&amp;quot;&lt;br /&gt;
* Check for Security Flags: Look for cookies missing protective flags such as HttpOnly (prevents client-side access), Secure (ensures transmission over HTTPS), or SameSite (restricts third-party context usage).&lt;br /&gt;
* Use the Console: Enter document.cookie in the browser console to see if cookies are accessible. If cookies are displayed, they are vulnerable to theft.&lt;br /&gt;
&lt;br /&gt;
[[File:Document-cookies.PNG]] [[File:Httponly-no.PNG]]&lt;br /&gt;
&lt;br /&gt;
Understanding how cookies are stored and secured provides critical insight into an application&#039;s vulnerability.&lt;br /&gt;
&lt;br /&gt;
====Required Files====&lt;br /&gt;
&lt;br /&gt;
To execute the XSS demonstrations successfully, the following files and scripts are essential:&lt;br /&gt;
&lt;br /&gt;
* Cookie Logger Script (cookie-logger.php): A PHP script hosted on the attacker’s server to log cookies sent by the malicious payload. It listens for a cookies parameter in the URL, extracts its value, and writes it to the stolen-cookies.txt file along with a timestamp.&lt;br /&gt;
* Stolen Cookies File (stolen-cookies.txt): A plain text file used to store intercepted cookies. Each entry includes the captured cookie data and the timestamp of when it was received.&lt;br /&gt;
* Malicious Script: A custom JavaScript payload crafted to exploit the identified vulnerabilities. This script retrieves cookies using document.cookie and sends them to the attacker’s cookie-logger.php script.&lt;br /&gt;
&lt;br /&gt;
[[File:Php-script.PNG]]  [[File:Stolen-cookies.PNG]]&lt;br /&gt;
&lt;br /&gt;
These files and scripts form the backbone of the XSS demonstrations. Ensure they are set up correctly and tested in a controlled environment to replicate the attacks.&lt;br /&gt;
&lt;br /&gt;
====Demonstrations====&lt;br /&gt;
=====Stored XSS=====&lt;br /&gt;
Stored XSS involves injecting malicious scripts that are permanently stored on the server, such as in a database or a comment field. These scripts execute whenever a victim accesses the vulnerable page. I used the ”Add to your blog” found under OWASP 2017/A7 - Cross-Site Scripting (XSS)/Persistent (Second Order) in Mutillidae II.&lt;br /&gt;
&lt;br /&gt;
This is the script we then send to the database to essentally &amp;quot;poison&amp;quot; the website:&lt;br /&gt;
&lt;br /&gt;
[[File:Stored-script.PNG]]&lt;br /&gt;
&lt;br /&gt;
Once this is uploaded one can check if its properly working by visiting this website from another device and also ckecking the stolen-cookies.txt file. If, after visiting the site, the file has something in it (the Cookie) then its properly working and you have successfully finshed/done a Stored XSS attack.&lt;br /&gt;
&lt;br /&gt;
=====Reflected XSS Attack=====&lt;br /&gt;
&lt;br /&gt;
Reflected XSS uses a crafted URL that directly includes the malicious payload, which is reflected back in the server&#039;s response. This attack relies on tricking the victim into clicking the URL. I used the ”DNS Lookup” found underOWASP 2017/A7 - Cross-Site Scripting (XSS)/Reflected (First Order) in Mutillidae II.&lt;br /&gt;
&lt;br /&gt;
This is the manipulated URL that one has to send(coded and decoded):&lt;br /&gt;
&lt;br /&gt;
[[File: Coded-reflected.PNG]] [[File: Decoded-reflected.PNG]]&lt;br /&gt;
&lt;br /&gt;
You can now send this URL to yourself to test it out and also ckeck the stolen-cookies.txt file out. If, after visiting the site through that URL, the file has something in it (the Cookie) then its properly working and you have successfully finshed/done a ReflectedXSS attack. Note:the second and thrid IP should be the attackers servers IP.&lt;br /&gt;
&lt;br /&gt;
=====DOM based XSS=====&lt;br /&gt;
&lt;br /&gt;
DOM-based XSS manipulates the client-side Document Object Model (DOM) without server interaction. The attack occurs entirely in the victim&#039;s browser. I used the ”Password Generator” found under OWASP 2017/A7 - Cross-Site Scripting (XSS)/DOM-Based in Mutillidae II.&lt;br /&gt;
&lt;br /&gt;
This is the manipulated URL that one has to send(coded and decoded):&lt;br /&gt;
&lt;br /&gt;
[[File: Dom-xss-coded.PNG]]    [[File:Decoded-dom-based.PNG]]&lt;br /&gt;
&lt;br /&gt;
You can now send this URL to yourself to test it out and also ckeck the stolen-cookies.txt file out. If, after visiting the site through that URL, the file has something in it (the Cookie) then its properly working and you have successfully finshed/done a DOM based XSS attack. ote:the second and thrid IP should be the attackers servers IP.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
These demonstrations illustrate the risks of XSS attacks and their potential to steal sensitive data like cookies. Understanding these methods is crucial for identifying and mitigating vulnerabilities. Always practice responsibly in controlled environments like OWASP Mutillidae II to promote safer web applications.&lt;br /&gt;
&lt;br /&gt;
== XSS attack consequences ==&lt;br /&gt;
&lt;br /&gt;
A Cross-Site Scripting (XSS) attack can have various severe consequences, including:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Data Theft&#039;&#039;&#039;: Stealing sensitive user data such as login credentials, session tokens, and personal information.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Identity Theft&#039;&#039;&#039;: Stealing user identities to take over their accounts, resulting in fraudulent activity.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Session Hijacking&#039;&#039;&#039;: Taking control of user sessions and accessing their accounts without the user&#039;s knowledge.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Malware Propagation&#039;&#039;&#039;: Injecting the malicious code into websites, which is then executed by unsuspecting users, resulting in the spread of malware.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Phishing&#039;&#039;&#039;: XSS can be employed to display fake login forms or deceptive content on legitimate websites, leading to phishing attacks.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Content Manipulation&#039;&#039;&#039;: Manipulation of website content to send users false information or carry out malicious actions on their behalf.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Reputation Damage&#039;&#039;&#039;: Cross-Site Scripting (XSS) attacks have the potential to damage user confidence in a website or application, particularly in cases where personal information is exposed.&lt;br /&gt;
== Prevention==&lt;br /&gt;
&lt;br /&gt;
The prevention of these vulnerabilities is the responsibility of the programmer. Programmers should adopt secure programming practices, such as context-sensitive server-side output encoding, to ensure the prevention of malicious script injections through incorrect or unchecked entries.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Effective prevention measures include:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input validation&#039;&#039;&#039;: Rigorous validation of user input before acceptance and processing by the server is crucial to prevent cross-site scripting attacks.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Output encoding&#039;&#039;&#039;: Encoding all output data (using HTML entities) is another effective measure to prevent cross-site scripting. This ensures proper display in the user&#039;s browser.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Content Security Policy (CSP)&#039;&#039;&#039;: Implementing a Content Security Policy defines rules for the types of content a website can load, contributing to preventing cross-site scripting attacks.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Use of tokens&#039;&#039;&#039;: Employing random character strings (tokens) to identify users can help prevent cross-site scripting attacks, ensuring that only authorized users access the website.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Disabling script execution&#039;&#039;&#039;: While disabling script execution on the server, especially for certain scripting languages like JavaScript or VBScript, can help prevent cross-site scripting, it is rarely used due to the widespread use of JavaScript.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Secure Password Policies&#039;&#039;&#039;: It is recommended to use complex passwords and consider introducing multi-factor authentication for an additional layer of security.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Session Management&#039;&#039;&#039;: The application of session management, such as session timeout, involves configuring actions related to sessions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Security Patching&#039;&#039;&#039;: Ensuring that all software, including web servers, databases and frameworks, are kept up to date with the latest security patches. Regular updates and patches should be applied to fix known vulnerabilities in the system.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Security Audits and Code Reviews&#039;&#039;&#039;: Conducting regular security audits and code reviews to help identify and remediate potential vulnerabilities. Third-party security assessments can provide an independent assessment of your application&#039;s security posture.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://owasp.org/www-community/attacks/xss/&lt;br /&gt;
* https://cheatsheetseries.owasp.org/cheatsheets/DOM_based_XSS_Prevention_Cheat_Sheet.html&lt;br /&gt;
* https://owasp.org/www-project-top-ten/2017/A7_2017-Cross-Site_Scripting_(XSS)&lt;br /&gt;
* https://portswigger.net/web-security/cross-site-scripting&lt;br /&gt;
* https://www.sans.org/white-papers/988/&lt;br /&gt;
* https://learn.microsoft.com/en-us/aspnet/core/security/cross-site-scripting?view=aspnetcore-8.0&lt;br /&gt;
* https://www.wallarm.com/what/a7-cross-site-scripting-xss-2017-owasp&lt;/div&gt;</summary>
		<author><name>MVucinic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Cross-Site_Scripting_(XSS)&amp;diff=17571</id>
		<title>Cross-Site Scripting (XSS)</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Cross-Site_Scripting_(XSS)&amp;diff=17571"/>
		<updated>2024-12-18T17:51:37Z</updated>

		<summary type="html">&lt;p&gt;MVucinic: /* Reflected XSS Attack */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Basic]]&lt;br /&gt;
== Cross-Site Scripting (XSS) ==&lt;br /&gt;
&lt;br /&gt;
 [[Image:xss_diagram.png|300px|thumb| The operational principle of Cross-Site Scripting (XSS)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cross-Site Scripting is a class of web application vulnerabilities, which is still one of the most common security vulnerabilities in web applications and can be used to compromise the confidentiality, integrity, and availability of the application. In general, XSS vulnerabilities allow an attacker to execute script code in the web browser of the victim and can be used to gain data from users, like cookies or private information. The different types are listed below. It is also possible to trigger actions on websites, redirect to other sites or hide advertisements. A short game with which some options can be seen easily: [https://xss-game.appspot.com/ XSS game]&lt;br /&gt;
&lt;br /&gt;
== Types ==&lt;br /&gt;
There are two ways to classify XSS attacks. Up until 2012 the types DOM-based (Type 0), stored/persistent (Type I) and reflected/non-persistent (Type II) were used. However, due to the potential overlap among these three types, the research community introduced the terms Server XSS and Client XSS from 2012 onward.&lt;br /&gt;
[[File:Server-XSS_vs_Client-XSS_Chart.png|200px|thumb]]&lt;br /&gt;
&lt;br /&gt;
=== Stored (Type I) ===&lt;br /&gt;
Stored XSS, also known as persistent XSS, occurs when the application or API stores unvalidated user input on the server, for example, in a database, comment field, visitor log, etc. This stored input is later retrieved and displayed by another user or administrator who requests the stored information.&lt;br /&gt;
&lt;br /&gt;
=== Reflected (Type II) ===&lt;br /&gt;
Reflected XSS is a non-persistent attack and is used to steal session cookies from a user. With Reflected XSS, the application or API includes unchecked and unmasked input from the user as part of the HTML output. If the attack was successful, the attacker could execute arbitrary HTML and a scripting language such as Javascript in the victim&#039;s browser. Typically, a user will have to click on a malicious link to do this. The attacker tries to bring this harmful link to the victim, via advertising, e-mail etc. &lt;br /&gt;
&lt;br /&gt;
=== DOM Based (Type 0) ===&lt;br /&gt;
DOM-based Cross-Site Scripting (XSS) is a type of XSS attack that occurs when malicious code is injected directly into the Document Object Model (DOM) of the web application. DOM-based XSS attacks can occur when user-supplied data is used to generate client-side JavaScript code without proper input validation. The malicious code is then sent to a user&#039;s browser, where it is executed. DOM-based XSS attacks can be used to gain access to sensitive information, perform malicious activities, and even hijack the user’s browser.&lt;br /&gt;
&lt;br /&gt;
==Demonstrations==&lt;br /&gt;
&lt;br /&gt;
This section demonstrates three Cross-Site Scripting (XSS) attacks using the intentionally vulnerable OWASP Mutillidae II platform. These demonstrations include Stored XSS, Reflected XSS, and DOM-based XSS attacks, showcasing how vulnerabilities can be exploited to steal sensitive information in real-world scenarios. Specifically, these examples focus on stealing the victim&#039;s cookies.&lt;br /&gt;
&lt;br /&gt;
If you want to recreate these attacks, refer to this article: OWASP Mutillidae (2021) for detailed instructions on installing and using OWASP Mutillidae II.&lt;br /&gt;
&lt;br /&gt;
===Preparation Steps=== &lt;br /&gt;
Before demonstrating the attacks, it&#039;s essential to understand the groundwork required for successful execution. This includes identifying vulnerabilities, inspecting cookies, and preparing the necessary scripts and files for the exploitation process.&lt;br /&gt;
&lt;br /&gt;
====Searching for Exploits====&lt;br /&gt;
&lt;br /&gt;
Identifying vulnerabilities is a the first step. Attackers exploit weaknesses in web applications to inject malicious scripts. Techniques include:&lt;br /&gt;
&lt;br /&gt;
* Analyzing the Page Source: Review the HTML and JavaScript code for insecure functions like innerHTML, document.write, or unescaped user inputs. These functions often process user-supplied data without proper sanitization, creating potential attack vectors.&lt;br /&gt;
* Testing Input Fields: Use simple script tags to test input validation. For example, &amp;lt;script&amp;gt;alert(&amp;quot;Yooooooo&amp;quot;)&amp;lt;/script&amp;gt; can reveal whether the application sanitizes or escapes user input. If the alert box appears, it indicates the input field is vulnerable.&lt;br /&gt;
* Using Developer Tools: Open developer tools (F12) in your browser to inspect how data is handled:&lt;br /&gt;
* Check the &amp;quot;Application&amp;quot; tab for cookies or local storage.&lt;br /&gt;
Inspect server responses and client-side behavior to understand how data flows between them.&lt;br /&gt;
&lt;br /&gt;
[[File:Innerhtml.PNG]] [[File:Test-script.PNG]]&lt;br /&gt;
&lt;br /&gt;
Exploring these areas helps pinpoint potential vulnerabilities that can be leveraged in the attacks.&lt;br /&gt;
&lt;br /&gt;
====Inspecting Cookies====&lt;br /&gt;
&lt;br /&gt;
Cookies are a primary target for XSS attacks because they often store sensitive session data like authentication tokens. To check their accessibility:&lt;br /&gt;
&lt;br /&gt;
* Developer Tools Navigation: Go to the &amp;quot;Application&amp;quot; tab in browser developer tools and locate the &amp;quot;Cookies&amp;quot; section under &amp;quot;Storage.&amp;quot;&lt;br /&gt;
* Check for Security Flags: Look for cookies missing protective flags such as HttpOnly (prevents client-side access), Secure (ensures transmission over HTTPS), or SameSite (restricts third-party context usage).&lt;br /&gt;
* Use the Console: Enter document.cookie in the browser console to see if cookies are accessible. If cookies are displayed, they are vulnerable to theft.&lt;br /&gt;
&lt;br /&gt;
[[File:Document-cookies.PNG]] [[File:Httponly-no.PNG]]&lt;br /&gt;
&lt;br /&gt;
Understanding how cookies are stored and secured provides critical insight into an application&#039;s vulnerability.&lt;br /&gt;
&lt;br /&gt;
====Required Files====&lt;br /&gt;
&lt;br /&gt;
To execute the XSS demonstrations successfully, the following files and scripts are essential:&lt;br /&gt;
&lt;br /&gt;
* Cookie Logger Script (cookie-logger.php): A PHP script hosted on the attacker’s server to log cookies sent by the malicious payload. It listens for a cookies parameter in the URL, extracts its value, and writes it to the stolen-cookies.txt file along with a timestamp.&lt;br /&gt;
* Stolen Cookies File (stolen-cookies.txt): A plain text file used to store intercepted cookies. Each entry includes the captured cookie data and the timestamp of when it was received.&lt;br /&gt;
* Malicious Script: A custom JavaScript payload crafted to exploit the identified vulnerabilities. This script retrieves cookies using document.cookie and sends them to the attacker’s cookie-logger.php script.&lt;br /&gt;
&lt;br /&gt;
[[File:Php-script.PNG]]  [[File:Stolen-cookies.PNG]]&lt;br /&gt;
&lt;br /&gt;
These files and scripts form the backbone of the XSS demonstrations. Ensure they are set up correctly and tested in a controlled environment to replicate the attacks.&lt;br /&gt;
&lt;br /&gt;
====Demonstrations====&lt;br /&gt;
=====Stored XSS=====&lt;br /&gt;
Stored XSS involves injecting malicious scripts that are permanently stored on the server, such as in a database or a comment field. These scripts execute whenever a victim accesses the vulnerable page. I used the ”Add to your blog” found under OWASP 2017/A7 - Cross-Site Scripting (XSS)/Persistent (Second Order) in Mutillidae II.&lt;br /&gt;
&lt;br /&gt;
This is the script we then send to the database to essentally &amp;quot;poison&amp;quot; the website:&lt;br /&gt;
&lt;br /&gt;
[[File:Stored-script.PNG]]&lt;br /&gt;
&lt;br /&gt;
Once this is uploaded one can check if its properly working by visiting this website from another device and also ckecking the stolen-cookies.txt file. If, after visiting the site, the file has something in it (the Cookie) then its properly working and you have successfully finshed/done a Stored XSS attack.&lt;br /&gt;
&lt;br /&gt;
=====Reflected XSS Attack=====&lt;br /&gt;
&lt;br /&gt;
Reflected XSS uses a crafted URL that directly includes the malicious payload, which is reflected back in the server&#039;s response. This attack relies on tricking the victim into clicking the URL. I used the ”DNS Lookup” found underOWASP 2017/A7 - Cross-Site Scripting (XSS)/Reflected (First Order) in Mutillidae II.&lt;br /&gt;
&lt;br /&gt;
This is the manipulated URL that one has to send(coded and decoded):&lt;br /&gt;
&lt;br /&gt;
[[File: Coded-reflected.PNG]] [[File: Decoded-reflected.PNG]]&lt;br /&gt;
&lt;br /&gt;
You can now send this URL to yourself to test it out and also ckeck the stolen-cookies.txt file out. If, after visiting the site through that URL, the file has something in it (the Cookie) then its properly working and you have successfully finshed/done a ReflectedXSS attack. Note:the second and thrid IP should be the attackers servers IP.&lt;br /&gt;
&lt;br /&gt;
=====DOM based XSS=====&lt;br /&gt;
&lt;br /&gt;
DOM-based XSS manipulates the client-side Document Object Model (DOM) without server interaction. The attack occurs entirely in the victim&#039;s browser. I used the ”Password Generator” found under OWASP 2017/A7 - Cross-Site Scripting (XSS)/DOM-Based in Mutillidae II.&lt;br /&gt;
&lt;br /&gt;
This is the manipulated URL that one has to send(coded and decoded):&lt;br /&gt;
&lt;br /&gt;
[[File: Dom-xss-coded.PNG]]    [[File:Decoded-dom-based.PNG]]&lt;br /&gt;
&lt;br /&gt;
You can now send this URL to yourself to test it out and also ckeck the stolen-cookies.txt file out. If, after visiting the site through that URL, the file has something in it (the Cookie) then its properly working and you have successfully finshed/done a DOM based XSS attack. ote:the second and thrid IP should be the attackers servers IP.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
These demonstrations illustrate the risks of XSS attacks and their potential to steal sensitive data like cookies. Understanding these methods is crucial for identifying and mitigating vulnerabilities. Always practice responsibly in controlled environments like OWASP Mutillidae II to promote safer web applications.&lt;br /&gt;
&lt;br /&gt;
== XSS attack consequences ==&lt;br /&gt;
&lt;br /&gt;
A Cross-Site Scripting (XSS) attack can have various severe consequences, including:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Data Theft&#039;&#039;&#039;: Stealing sensitive user data such as login credentials, session tokens, and personal information.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Identity Theft&#039;&#039;&#039;: Stealing user identities to take over their accounts, resulting in fraudulent activity.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Session Hijacking&#039;&#039;&#039;: Taking control of user sessions and accessing their accounts without the user&#039;s knowledge.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Malware Propagation&#039;&#039;&#039;: Injecting the malicious code into websites, which is then executed by unsuspecting users, resulting in the spread of malware.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Phishing&#039;&#039;&#039;: XSS can be employed to display fake login forms or deceptive content on legitimate websites, leading to phishing attacks.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Content Manipulation&#039;&#039;&#039;: Manipulation of website content to send users false information or carry out malicious actions on their behalf.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Reputation Damage&#039;&#039;&#039;: Cross-Site Scripting (XSS) attacks have the potential to damage user confidence in a website or application, particularly in cases where personal information is exposed.&lt;br /&gt;
== Prevention==&lt;br /&gt;
&lt;br /&gt;
The prevention of these vulnerabilities is the responsibility of the programmer. Programmers should adopt secure programming practices, such as context-sensitive server-side output encoding, to ensure the prevention of malicious script injections through incorrect or unchecked entries.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Effective prevention measures include:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input validation&#039;&#039;&#039;: Rigorous validation of user input before acceptance and processing by the server is crucial to prevent cross-site scripting attacks.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Output encoding&#039;&#039;&#039;: Encoding all output data (using HTML entities) is another effective measure to prevent cross-site scripting. This ensures proper display in the user&#039;s browser.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Content Security Policy (CSP)&#039;&#039;&#039;: Implementing a Content Security Policy defines rules for the types of content a website can load, contributing to preventing cross-site scripting attacks.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Use of tokens&#039;&#039;&#039;: Employing random character strings (tokens) to identify users can help prevent cross-site scripting attacks, ensuring that only authorized users access the website.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Disabling script execution&#039;&#039;&#039;: While disabling script execution on the server, especially for certain scripting languages like JavaScript or VBScript, can help prevent cross-site scripting, it is rarely used due to the widespread use of JavaScript.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Secure Password Policies&#039;&#039;&#039;: It is recommended to use complex passwords and consider introducing multi-factor authentication for an additional layer of security.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Session Management&#039;&#039;&#039;: The application of session management, such as session timeout, involves configuring actions related to sessions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Security Patching&#039;&#039;&#039;: Ensuring that all software, including web servers, databases and frameworks, are kept up to date with the latest security patches. Regular updates and patches should be applied to fix known vulnerabilities in the system.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Security Audits and Code Reviews&#039;&#039;&#039;: Conducting regular security audits and code reviews to help identify and remediate potential vulnerabilities. Third-party security assessments can provide an independent assessment of your application&#039;s security posture.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://owasp.org/www-community/attacks/xss/&lt;br /&gt;
* https://cheatsheetseries.owasp.org/cheatsheets/DOM_based_XSS_Prevention_Cheat_Sheet.html&lt;br /&gt;
* https://owasp.org/www-project-top-ten/2017/A7_2017-Cross-Site_Scripting_(XSS)&lt;br /&gt;
* https://portswigger.net/web-security/cross-site-scripting&lt;br /&gt;
* https://www.sans.org/white-papers/988/&lt;br /&gt;
* https://learn.microsoft.com/en-us/aspnet/core/security/cross-site-scripting?view=aspnetcore-8.0&lt;br /&gt;
* https://www.wallarm.com/what/a7-cross-site-scripting-xss-2017-owasp&lt;/div&gt;</summary>
		<author><name>MVucinic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Cross-Site_Scripting_(XSS)&amp;diff=17569</id>
		<title>Cross-Site Scripting (XSS)</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Cross-Site_Scripting_(XSS)&amp;diff=17569"/>
		<updated>2024-12-18T17:50:55Z</updated>

		<summary type="html">&lt;p&gt;MVucinic: /* Types */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:Basic]]&lt;br /&gt;
== Cross-Site Scripting (XSS) ==&lt;br /&gt;
&lt;br /&gt;
 [[Image:xss_diagram.png|300px|thumb| The operational principle of Cross-Site Scripting (XSS)]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cross-Site Scripting is a class of web application vulnerabilities, which is still one of the most common security vulnerabilities in web applications and can be used to compromise the confidentiality, integrity, and availability of the application. In general, XSS vulnerabilities allow an attacker to execute script code in the web browser of the victim and can be used to gain data from users, like cookies or private information. The different types are listed below. It is also possible to trigger actions on websites, redirect to other sites or hide advertisements. A short game with which some options can be seen easily: [https://xss-game.appspot.com/ XSS game]&lt;br /&gt;
&lt;br /&gt;
== Types ==&lt;br /&gt;
There are two ways to classify XSS attacks. Up until 2012 the types DOM-based (Type 0), stored/persistent (Type I) and reflected/non-persistent (Type II) were used. However, due to the potential overlap among these three types, the research community introduced the terms Server XSS and Client XSS from 2012 onward.&lt;br /&gt;
[[File:Server-XSS_vs_Client-XSS_Chart.png|200px|thumb]]&lt;br /&gt;
&lt;br /&gt;
=== Stored (Type I) ===&lt;br /&gt;
Stored XSS, also known as persistent XSS, occurs when the application or API stores unvalidated user input on the server, for example, in a database, comment field, visitor log, etc. This stored input is later retrieved and displayed by another user or administrator who requests the stored information.&lt;br /&gt;
&lt;br /&gt;
=== Reflected (Type II) ===&lt;br /&gt;
Reflected XSS is a non-persistent attack and is used to steal session cookies from a user. With Reflected XSS, the application or API includes unchecked and unmasked input from the user as part of the HTML output. If the attack was successful, the attacker could execute arbitrary HTML and a scripting language such as Javascript in the victim&#039;s browser. Typically, a user will have to click on a malicious link to do this. The attacker tries to bring this harmful link to the victim, via advertising, e-mail etc. &lt;br /&gt;
&lt;br /&gt;
=== DOM Based (Type 0) ===&lt;br /&gt;
DOM-based Cross-Site Scripting (XSS) is a type of XSS attack that occurs when malicious code is injected directly into the Document Object Model (DOM) of the web application. DOM-based XSS attacks can occur when user-supplied data is used to generate client-side JavaScript code without proper input validation. The malicious code is then sent to a user&#039;s browser, where it is executed. DOM-based XSS attacks can be used to gain access to sensitive information, perform malicious activities, and even hijack the user’s browser.&lt;br /&gt;
&lt;br /&gt;
==Demonstrations==&lt;br /&gt;
&lt;br /&gt;
This section demonstrates three Cross-Site Scripting (XSS) attacks using the intentionally vulnerable OWASP Mutillidae II platform. These demonstrations include Stored XSS, Reflected XSS, and DOM-based XSS attacks, showcasing how vulnerabilities can be exploited to steal sensitive information in real-world scenarios. Specifically, these examples focus on stealing the victim&#039;s cookies.&lt;br /&gt;
&lt;br /&gt;
If you want to recreate these attacks, refer to this article: OWASP Mutillidae (2021) for detailed instructions on installing and using OWASP Mutillidae II.&lt;br /&gt;
&lt;br /&gt;
===Preparation Steps=== &lt;br /&gt;
Before demonstrating the attacks, it&#039;s essential to understand the groundwork required for successful execution. This includes identifying vulnerabilities, inspecting cookies, and preparing the necessary scripts and files for the exploitation process.&lt;br /&gt;
&lt;br /&gt;
====Searching for Exploits====&lt;br /&gt;
&lt;br /&gt;
Identifying vulnerabilities is a the first step. Attackers exploit weaknesses in web applications to inject malicious scripts. Techniques include:&lt;br /&gt;
&lt;br /&gt;
* Analyzing the Page Source: Review the HTML and JavaScript code for insecure functions like innerHTML, document.write, or unescaped user inputs. These functions often process user-supplied data without proper sanitization, creating potential attack vectors.&lt;br /&gt;
* Testing Input Fields: Use simple script tags to test input validation. For example, &amp;lt;script&amp;gt;alert(&amp;quot;Yooooooo&amp;quot;)&amp;lt;/script&amp;gt; can reveal whether the application sanitizes or escapes user input. If the alert box appears, it indicates the input field is vulnerable.&lt;br /&gt;
* Using Developer Tools: Open developer tools (F12) in your browser to inspect how data is handled:&lt;br /&gt;
* Check the &amp;quot;Application&amp;quot; tab for cookies or local storage.&lt;br /&gt;
Inspect server responses and client-side behavior to understand how data flows between them.&lt;br /&gt;
&lt;br /&gt;
[[File:Innerhtml.PNG]] [[File:Test-script.PNG]]&lt;br /&gt;
&lt;br /&gt;
Exploring these areas helps pinpoint potential vulnerabilities that can be leveraged in the attacks.&lt;br /&gt;
&lt;br /&gt;
====Inspecting Cookies====&lt;br /&gt;
&lt;br /&gt;
Cookies are a primary target for XSS attacks because they often store sensitive session data like authentication tokens. To check their accessibility:&lt;br /&gt;
&lt;br /&gt;
* Developer Tools Navigation: Go to the &amp;quot;Application&amp;quot; tab in browser developer tools and locate the &amp;quot;Cookies&amp;quot; section under &amp;quot;Storage.&amp;quot;&lt;br /&gt;
* Check for Security Flags: Look for cookies missing protective flags such as HttpOnly (prevents client-side access), Secure (ensures transmission over HTTPS), or SameSite (restricts third-party context usage).&lt;br /&gt;
* Use the Console: Enter document.cookie in the browser console to see if cookies are accessible. If cookies are displayed, they are vulnerable to theft.&lt;br /&gt;
&lt;br /&gt;
[[File:Document-cookies.PNG]] [[File:Httponly-no.PNG]]&lt;br /&gt;
&lt;br /&gt;
Understanding how cookies are stored and secured provides critical insight into an application&#039;s vulnerability.&lt;br /&gt;
&lt;br /&gt;
====Required Files====&lt;br /&gt;
&lt;br /&gt;
To execute the XSS demonstrations successfully, the following files and scripts are essential:&lt;br /&gt;
&lt;br /&gt;
* Cookie Logger Script (cookie-logger.php): A PHP script hosted on the attacker’s server to log cookies sent by the malicious payload. It listens for a cookies parameter in the URL, extracts its value, and writes it to the stolen-cookies.txt file along with a timestamp.&lt;br /&gt;
* Stolen Cookies File (stolen-cookies.txt): A plain text file used to store intercepted cookies. Each entry includes the captured cookie data and the timestamp of when it was received.&lt;br /&gt;
* Malicious Script: A custom JavaScript payload crafted to exploit the identified vulnerabilities. This script retrieves cookies using document.cookie and sends them to the attacker’s cookie-logger.php script.&lt;br /&gt;
&lt;br /&gt;
[[File:Php-script.PNG]]  [[File:Stolen-cookies.PNG]]&lt;br /&gt;
&lt;br /&gt;
These files and scripts form the backbone of the XSS demonstrations. Ensure they are set up correctly and tested in a controlled environment to replicate the attacks.&lt;br /&gt;
&lt;br /&gt;
====Demonstrations====&lt;br /&gt;
=====Stored XSS=====&lt;br /&gt;
Stored XSS involves injecting malicious scripts that are permanently stored on the server, such as in a database or a comment field. These scripts execute whenever a victim accesses the vulnerable page. I used the ”Add to your blog” found under OWASP 2017/A7 - Cross-Site Scripting (XSS)/Persistent (Second Order) in Mutillidae II.&lt;br /&gt;
&lt;br /&gt;
This is the script we then send to the database to essentally &amp;quot;poison&amp;quot; the website:&lt;br /&gt;
&lt;br /&gt;
[[File:Stored-script.PNG]]&lt;br /&gt;
&lt;br /&gt;
Once this is uploaded one can check if its properly working by visiting this website from another device and also ckecking the stolen-cookies.txt file. If, after visiting the site, the file has something in it (the Cookie) then its properly working and you have successfully finshed/done a Stored XSS attack.&lt;br /&gt;
&lt;br /&gt;
=====Reflected XSS Attack=====&lt;br /&gt;
&lt;br /&gt;
Reflected XSS uses a crafted URL that directly includes the malicious payload, which is reflected back in the server&#039;s response. This attack relies on tricking the victim into clicking the URL. I used the ”DNS Lookup” found underOWASP 2017/A7 - Cross-Site Scripting (XSS)/Reflected (First Order) in Mutillidae II.&lt;br /&gt;
&lt;br /&gt;
This is the manipulated URL that one has to send(coded and decoded):&lt;br /&gt;
&lt;br /&gt;
[[File: Coded-reflected.PNG]] [[File: Decoded-reflected.PNG]]&lt;br /&gt;
&lt;br /&gt;
You can now send this URL to yourself to test it out and also ckeck the stolen-cookies.txt file out. If, after visiting the site through that URL, the file has something in it (the Cookie) then its properly working and you have successfully finshed/done a ReflectedXSS attack. Note:the second and thrid IP should be the attackers servers IP&lt;br /&gt;
&lt;br /&gt;
=====DOM based XSS=====&lt;br /&gt;
&lt;br /&gt;
DOM-based XSS manipulates the client-side Document Object Model (DOM) without server interaction. The attack occurs entirely in the victim&#039;s browser. I used the ”Password Generator” found under OWASP 2017/A7 - Cross-Site Scripting (XSS)/DOM-Based in Mutillidae II.&lt;br /&gt;
&lt;br /&gt;
This is the manipulated URL that one has to send(coded and decoded):&lt;br /&gt;
&lt;br /&gt;
[[File: Dom-xss-coded.PNG]]    [[File:Decoded-dom-based.PNG]]&lt;br /&gt;
&lt;br /&gt;
You can now send this URL to yourself to test it out and also ckeck the stolen-cookies.txt file out. If, after visiting the site through that URL, the file has something in it (the Cookie) then its properly working and you have successfully finshed/done a DOM based XSS attack. ote:the second and thrid IP should be the attackers servers IP.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
These demonstrations illustrate the risks of XSS attacks and their potential to steal sensitive data like cookies. Understanding these methods is crucial for identifying and mitigating vulnerabilities. Always practice responsibly in controlled environments like OWASP Mutillidae II to promote safer web applications.&lt;br /&gt;
&lt;br /&gt;
== XSS attack consequences ==&lt;br /&gt;
&lt;br /&gt;
A Cross-Site Scripting (XSS) attack can have various severe consequences, including:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Data Theft&#039;&#039;&#039;: Stealing sensitive user data such as login credentials, session tokens, and personal information.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Identity Theft&#039;&#039;&#039;: Stealing user identities to take over their accounts, resulting in fraudulent activity.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Session Hijacking&#039;&#039;&#039;: Taking control of user sessions and accessing their accounts without the user&#039;s knowledge.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Malware Propagation&#039;&#039;&#039;: Injecting the malicious code into websites, which is then executed by unsuspecting users, resulting in the spread of malware.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Phishing&#039;&#039;&#039;: XSS can be employed to display fake login forms or deceptive content on legitimate websites, leading to phishing attacks.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Content Manipulation&#039;&#039;&#039;: Manipulation of website content to send users false information or carry out malicious actions on their behalf.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Reputation Damage&#039;&#039;&#039;: Cross-Site Scripting (XSS) attacks have the potential to damage user confidence in a website or application, particularly in cases where personal information is exposed.&lt;br /&gt;
== Prevention==&lt;br /&gt;
&lt;br /&gt;
The prevention of these vulnerabilities is the responsibility of the programmer. Programmers should adopt secure programming practices, such as context-sensitive server-side output encoding, to ensure the prevention of malicious script injections through incorrect or unchecked entries.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Effective prevention measures include:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Input validation&#039;&#039;&#039;: Rigorous validation of user input before acceptance and processing by the server is crucial to prevent cross-site scripting attacks.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Output encoding&#039;&#039;&#039;: Encoding all output data (using HTML entities) is another effective measure to prevent cross-site scripting. This ensures proper display in the user&#039;s browser.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Content Security Policy (CSP)&#039;&#039;&#039;: Implementing a Content Security Policy defines rules for the types of content a website can load, contributing to preventing cross-site scripting attacks.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Use of tokens&#039;&#039;&#039;: Employing random character strings (tokens) to identify users can help prevent cross-site scripting attacks, ensuring that only authorized users access the website.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Disabling script execution&#039;&#039;&#039;: While disabling script execution on the server, especially for certain scripting languages like JavaScript or VBScript, can help prevent cross-site scripting, it is rarely used due to the widespread use of JavaScript.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Secure Password Policies&#039;&#039;&#039;: It is recommended to use complex passwords and consider introducing multi-factor authentication for an additional layer of security.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Session Management&#039;&#039;&#039;: The application of session management, such as session timeout, involves configuring actions related to sessions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Security Patching&#039;&#039;&#039;: Ensuring that all software, including web servers, databases and frameworks, are kept up to date with the latest security patches. Regular updates and patches should be applied to fix known vulnerabilities in the system.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Security Audits and Code Reviews&#039;&#039;&#039;: Conducting regular security audits and code reviews to help identify and remediate potential vulnerabilities. Third-party security assessments can provide an independent assessment of your application&#039;s security posture.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://owasp.org/www-community/attacks/xss/&lt;br /&gt;
* https://cheatsheetseries.owasp.org/cheatsheets/DOM_based_XSS_Prevention_Cheat_Sheet.html&lt;br /&gt;
* https://owasp.org/www-project-top-ten/2017/A7_2017-Cross-Site_Scripting_(XSS)&lt;br /&gt;
* https://portswigger.net/web-security/cross-site-scripting&lt;br /&gt;
* https://www.sans.org/white-papers/988/&lt;br /&gt;
* https://learn.microsoft.com/en-us/aspnet/core/security/cross-site-scripting?view=aspnetcore-8.0&lt;br /&gt;
* https://www.wallarm.com/what/a7-cross-site-scripting-xss-2017-owasp&lt;/div&gt;</summary>
		<author><name>MVucinic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=OWASP_Mutillidae_(2021)&amp;diff=17561</id>
		<title>OWASP Mutillidae (2021)</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=OWASP_Mutillidae_(2021)&amp;diff=17561"/>
		<updated>2024-12-18T17:42:41Z</updated>

		<summary type="html">&lt;p&gt;MVucinic: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
OWASP Mutillidae is a free open source tool created for Pentesting of Web Applications. It is a &amp;quot;Vulnerable Web Application&amp;quot; that offers a Platform where the provided Exploits and Security flaws can be executed within a local environment. With over 40 different vulnerabilities and related training challenges, it provides a platform that shows the most common flaws of the last 15 years of web development. The main goal is to to offer security training for a wide range of uses, from teaching in classrooms to security enthusiasts exploring to functioning as testing ground for vulnerability assessment targets. The vulnerabilities shown in the program are actual vulnerabilities within the application, so the application should only be run in a protected environment - such as a virtual machine. Most of the Vulnerabilities are structured around the OWASP Top Ten List[https://wiki.elvis.science/index.php?title=Thread_Modelling#Top_10_Web_Application_Security_Risks]. The current Version Mutillidae II was created by Jeremy Druin [https://www.youtube.com/c/webpwnized/featured] (pseudonym: webpwnized), who also created the Tutorials for the Challanges and Installation Guides. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How it Operates ==&lt;br /&gt;
&lt;br /&gt;
Every Vulnerability contained in the application is build in within a Webpage. By selecting the Exploit from a List (e.g. Authentication Bypass) a site with the corresponding explotable Webpage is loaded and ready to get &amp;quot;hacked&amp;quot;. Since everything run at your local machine you can not harm anyone. The data such as &amp;quot;User Data&amp;quot; are stored in a Database which you set up when you install the Application (see Installation for more Information).&lt;br /&gt;
&lt;br /&gt;
[[File:Muti-Dropdown.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== A1 SQL Injection Example ==&lt;br /&gt;
[[SQL_Injection]]-&amp;gt; SQLi Extract Data&lt;br /&gt;
&lt;br /&gt;
Now here is a short example how one vulnerability exploit could look like. In this case there is a query where user can request their userinformation by providing their credentials.&lt;br /&gt;
&lt;br /&gt;
[[File:Mutillidae-login.png]]&lt;br /&gt;
&lt;br /&gt;
Normally the query should only retrun only on record when correct credentials are entered.&lt;br /&gt;
&lt;br /&gt;
But this website is totally unsecure so we can easily rewrite the SQL query to give us a list of every user in the database. But how can we do this?&lt;br /&gt;
&lt;br /&gt;
===Step 1:===&lt;br /&gt;
get an Exception by typing in invalid characters such as (&#039;, #, --)&lt;br /&gt;
&lt;br /&gt;
[[File:Mutillidae-Exception.png]]&lt;br /&gt;
&lt;br /&gt;
===Step 2:===&lt;br /&gt;
&lt;br /&gt;
Since we got an error message with the syntax how the sql statement is written we can alter the statement by simply put another statement in the form.&lt;br /&gt;
&lt;br /&gt;
In this case i wrote ’OR 1# in the username fields to alter the query which should be now&lt;br /&gt;
&lt;br /&gt;
SELECT * FROM acccounts where username= ’ ’OR 1# AND password = ’’&lt;br /&gt;
&lt;br /&gt;
1 means true in SQL language and # is a comment so it ignores the password query. So our SQL String says now that it should gives as all datasets for which the condition is true which lead to following output:&lt;br /&gt;
&lt;br /&gt;
[[File:Mutillidae-Extract-Data.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== A5 Cross-Site-Request Forgery Example ==&lt;br /&gt;
[[Cross-Site-Request_Forgery_(CSRF)]]-&amp;gt; Cross-Site-Request Forgery&lt;br /&gt;
This example can be found in the A5 section from the Owasp Top 10 examples, which is called &#039;Add to your blog&#039;.&lt;br /&gt;
Here we simulating an attack to vote for a security tool but without actually voting for it.&lt;br /&gt;
In the screenshot below you can see the site which we are attacking. So this site is basically the good site.&lt;br /&gt;
&lt;br /&gt;
[[File:UserPoll.PNG]]&lt;br /&gt;
&lt;br /&gt;
The evil site is in this case the &#039;Add to your blog&#039; site. Users can save a blog to a blog table. An attacker can you use this mechanism to manipulate a blog to fire an action.&lt;br /&gt;
Instead of a normal blog you can also add a script to the blog table. This script calls a method when you hover over the blog and it redirects to the voting site and votes for a security tool.&lt;br /&gt;
&lt;br /&gt;
[[File:Blogs.PNG]]&lt;br /&gt;
&lt;br /&gt;
The script can be found on the official github website for Mutillidae https://github.com/webpwnized/mutillidae/blob/master/src/labs/lab-files/cross-site-request-forgery-lab-files/vote-for-nmap-onmouseover-csrf.txt&lt;br /&gt;
This script creates a form object in the background and sets some specific fields. Those fields are being sent over the URL to the voting site.&lt;br /&gt;
Because how the site is constructed, it reads the parameter from the url to decide which security tool should be voted. This means that the form object consists of some input fields and those input fields contain some values.&lt;br /&gt;
One input field is responsible for redirecting to the voting site. The other one is setting the value for security tool. A form also should have a submit button which is also set with the input fields.&lt;br /&gt;
This whole script is contained in a method. This method gets fired when you hover over the mouse. You basically save a html tag with the name of the blog but this html tag calls the method which is containing the malicious script.&lt;br /&gt;
&lt;br /&gt;
== Features ==&lt;br /&gt;
&lt;br /&gt;
* over 40 vulnerabilities (OWASP Top Ten 2007, 2010, 2013 and 2017[https://owasp.org/www-project-top-ten/])&lt;br /&gt;
* Actually Vulnerable&lt;br /&gt;
* Simple Intallation and Maintaining&lt;br /&gt;
* User can switch between 3 security levels (no security, Client-side Security, Server-side Security)&lt;br /&gt;
* Used in web security courses&lt;br /&gt;
* Tutorials and Guides included in Application&lt;br /&gt;
* Updated frequently&lt;br /&gt;
&lt;br /&gt;
== Interface ==&lt;br /&gt;
[[File:Mutillidae-Interface.png]]&lt;br /&gt;
&lt;br /&gt;
By clicking on any Item on the right dropdown menu, you can select any of the OWASP Top Ten Challanges from the last 15 years.&lt;br /&gt;
&lt;br /&gt;
* Hints and Videos - leads you directly to a structured guide how the exercise could be completed.&lt;br /&gt;
* Toggle Security - you can choose between 3 Security levels for each exercise&lt;br /&gt;
* Reset DB - Clear all user Data &lt;br /&gt;
* Labs - Study Questions associated with the Exercises&lt;br /&gt;
&lt;br /&gt;
== Examples of Vulnerabilities ==&lt;br /&gt;
&lt;br /&gt;
* SQL Injections (SQLi)[https://wiki.elvis.science/index.php?title=SQL_Injection]&lt;br /&gt;
* Cross-Site-Scripting [https://wiki.elvis.science/index.php?title=Cross-Site-Scripting_(XSS)]&lt;br /&gt;
* Sensitive Data Exposure&lt;br /&gt;
* other Injection (CSS, HTML, JavaScript)&lt;br /&gt;
* and many more...&lt;br /&gt;
&lt;br /&gt;
== Comparable Vulnerable Web Applications ==&lt;br /&gt;
&lt;br /&gt;
* WebGoat [https://wiki.elvis.science/index.php?title=WebGoat]&lt;br /&gt;
* bWAPP [https://wiki.elvis.science/index.php?title=BWAPP]&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Apache Webserver&lt;br /&gt;
* Database (MySQL/MariaDb)&lt;br /&gt;
* Packages: Sourcecode from git (https://github.com/webpwnized/mutillidae)&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
* Install Apache Webserver on your local Machine&lt;br /&gt;
* Install PHP on your local Machine&lt;br /&gt;
* Install a supported Database (e.g. MySQL, MariaDB) (This installationguide will cover MySQL)&lt;br /&gt;
* Install three PHP Libraries (php-xml, php-curl, php-mbstring)&lt;br /&gt;
* Install Git&lt;br /&gt;
&lt;br /&gt;
If you have a XAMPP/LAMPP stack set up aleady, you might skip directly to installing Mutillidae. Alternativly you can also use a docker build to run Mutillidae.&lt;br /&gt;
There is a Videoseries from the creator which gives a Step-by-Step video tutorialfor the installation.&lt;br /&gt;
&lt;br /&gt;
=== Installing Mutillidae ===&lt;br /&gt;
This section provides a detailed installation guide for OWASP Mutillidae II. The only prerequisite for this guide is a functioning Ubuntu server (or a similar Linux-based environment).&lt;br /&gt;
&lt;br /&gt;
====Apache Webserver====&lt;br /&gt;
&lt;br /&gt;
The first thing to install is the Apache Webserver. Run the following command:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo apt install apache2 -y&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
After installation, allow URL Rewrites:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo a2enmod rewrite&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Restart the Apache server:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo systemctl restart apache2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Next, edit the apache2.conf file to enable AllowOverride All:.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo nano /etc/apache2/apache2.conf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Conf-file.PNG]]&lt;br /&gt;
&lt;br /&gt;
Afterwards restart the server again and with http://ip-address-of-your-server this page should be seen.&lt;br /&gt;
&lt;br /&gt;
[[File:Apache2-page.PNG]]&lt;br /&gt;
====PHP====&lt;br /&gt;
&lt;br /&gt;
If the Apache2 page is visible, Apache has been successfully installed. Now, install PHP with this command:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo apt install php libapache2-mod-php -y&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To test PHP, create an index.php file:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo nano /var/www/html/index.php&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Add the following content:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&amp;lt;?php echo &amp;quot;Hello, PHP!&amp;quot;; ?&amp;gt;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Save the file and visit http://ip-address-of-your-server/index.php. You should see this result:&lt;br /&gt;
&lt;br /&gt;
[[file:Index-php.PNG]]&lt;br /&gt;
====MySQL Server====&lt;br /&gt;
&lt;br /&gt;
Next, install the MySQL Server and the PHP-MySQL plugin with this command:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo apt install mysql-server php-mysql -y&#039;&#039;&lt;br /&gt;
====Change root password====&lt;br /&gt;
&lt;br /&gt;
Mutillidae II uses the root user with the password mutillidae. To ensure it works properly, set the root password as follows:&lt;br /&gt;
&lt;br /&gt;
1) Access the MySQL database as root:&lt;br /&gt;
* &#039;&#039;sudo mysql -u root&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
2) Once on it use this command to make changes in the database:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo mysql;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
3) In the MySQL shell, update the root password:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;ALTER USER &#039;root&#039;@&#039;localhost&#039; IDENTIFIED WITH mysql_native_password BY &#039;mutillidae&#039;;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Once done, flush the old privilages with:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;FLUSH PRIVILEGES;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Then write EXIT; to exit the database.&lt;br /&gt;
====PHP Libraries====&lt;br /&gt;
&lt;br /&gt;
With these steps done, we can now go and install the three PHP libraries. The first one will be the PHP XML Library.&lt;br /&gt;
Run these commands:&lt;br /&gt;
&lt;br /&gt;
This in order to know which PHP Verion one has:&lt;br /&gt;
* &#039;&#039;php --version (to now which version of PHP one has)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
After having figured out whcih version of PHP is installed run this:&lt;br /&gt;
* &#039;&#039;sudo apt-get install php8.1-xml&#039;&#039; (my verison is 8.1, yours could be different)&lt;br /&gt;
&lt;br /&gt;
After the XML Library, the Curl Library will be installed next:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo apt-get install php8.1-curl&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The last Library will be the mbstring Library.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo apt-get install php8.1-mbstring&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====Git====&lt;br /&gt;
&lt;br /&gt;
Install Git to download the OWASP Mutillidae II repository:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo apt install git -y&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====Final step====&lt;br /&gt;
&lt;br /&gt;
Finally, install OWASP Mutillidae II:&lt;br /&gt;
&lt;br /&gt;
1) Move to the Apache webserver folder:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;cd /var/www/html&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
2) Clone the repository:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo git clone https://github.com/webpwnized/mutillidae.git&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
After its done cloning, visit http://ip-address-of-your-server/mutillidae/src. There, if everythin worked, you should be greeted by this site:&lt;br /&gt;
&lt;br /&gt;
[[file:Owasp-page.PNG]]&lt;br /&gt;
&lt;br /&gt;
On the page, press Reset DB. If everything worked correctly, the installation is successful.&lt;br /&gt;
&lt;br /&gt;
=== Installing Mutillidae with Metasploit ===&lt;br /&gt;
A different method for installing Mutillidae is to install Metasploit. Metasploit is a penetration testing software which inlcudes everything you need to set up and run Mutillidae.&lt;br /&gt;
This means that you don&#039;t have to install all the other components you need for example a database, because Metasploit is doing this for.&lt;br /&gt;
After installing you can use the credentials msfadmin for the username and password in order to login into Metasploit.&lt;br /&gt;
When Metasploit is running Mutillidae is also accessible and for that you use the ip address of the machine where Metasploit is running on.&lt;br /&gt;
To look up the ip address you can use the &#039;ip a&#039; command in the CLI to find the ip address.&lt;br /&gt;
Sometimes it happens that Mutillidae cannot access the database. This problem occurs when the database name in the config file is not set.&lt;br /&gt;
To fix this problem you have to navigate to this config file which is found in this destination &#039;/var/www/mutillidae/config.inc&#039;.&lt;br /&gt;
In this config file you change the value of the variable called &#039;$dbname&#039; to &#039;owasp10&#039;. After this configuration Mutillidae can access the database.&lt;br /&gt;
&lt;br /&gt;
[[File:Config.PNG]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://owasp.org/www-project-top-ten/&lt;br /&gt;
* https://github.com/webpwnized/mutillidae.git&lt;br /&gt;
* https://www.youtube.com/c/webpwnized/featured&lt;br /&gt;
* https://github.com/webpwnized/mutillidae/blob/master/README-INSTALLATION.md Step-by-Step video tutorial&lt;br /&gt;
&lt;br /&gt;
Internal Links&lt;br /&gt;
* https://wiki.elvis.science/index.php?title=SQL_Injection&lt;br /&gt;
* https://wiki.elvis.science/index.php?title=Cross-Site-Scripting_(XSS)&lt;br /&gt;
* https://wiki.elvis.science/index.php?title=SQL_Injection_Examples_on_Known_Vulnerable_Web_Applications&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>MVucinic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Decoded-dom-based.PNG&amp;diff=17553</id>
		<title>File:Decoded-dom-based.PNG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Decoded-dom-based.PNG&amp;diff=17553"/>
		<updated>2024-12-18T17:37:00Z</updated>

		<summary type="html">&lt;p&gt;MVucinic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>MVucinic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Dom-xss-coded.PNG&amp;diff=17552</id>
		<title>File:Dom-xss-coded.PNG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Dom-xss-coded.PNG&amp;diff=17552"/>
		<updated>2024-12-18T17:36:44Z</updated>

		<summary type="html">&lt;p&gt;MVucinic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>MVucinic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Decoded-reflected.PNG&amp;diff=17544</id>
		<title>File:Decoded-reflected.PNG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Decoded-reflected.PNG&amp;diff=17544"/>
		<updated>2024-12-18T17:30:10Z</updated>

		<summary type="html">&lt;p&gt;MVucinic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>MVucinic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Coded-reflected.PNG&amp;diff=17542</id>
		<title>File:Coded-reflected.PNG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Coded-reflected.PNG&amp;diff=17542"/>
		<updated>2024-12-18T17:29:25Z</updated>

		<summary type="html">&lt;p&gt;MVucinic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>MVucinic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Stored-script.PNG&amp;diff=17532</id>
		<title>File:Stored-script.PNG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Stored-script.PNG&amp;diff=17532"/>
		<updated>2024-12-18T17:21:35Z</updated>

		<summary type="html">&lt;p&gt;MVucinic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>MVucinic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Stolen-cookies.PNG&amp;diff=17469</id>
		<title>File:Stolen-cookies.PNG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Stolen-cookies.PNG&amp;diff=17469"/>
		<updated>2024-12-18T16:38:48Z</updated>

		<summary type="html">&lt;p&gt;MVucinic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>MVucinic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Php-script.PNG&amp;diff=17465</id>
		<title>File:Php-script.PNG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Php-script.PNG&amp;diff=17465"/>
		<updated>2024-12-18T16:37:28Z</updated>

		<summary type="html">&lt;p&gt;MVucinic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>MVucinic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Test-script.PNG&amp;diff=17457</id>
		<title>File:Test-script.PNG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Test-script.PNG&amp;diff=17457"/>
		<updated>2024-12-18T16:34:22Z</updated>

		<summary type="html">&lt;p&gt;MVucinic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>MVucinic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Innerhtml.PNG&amp;diff=17449</id>
		<title>File:Innerhtml.PNG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Innerhtml.PNG&amp;diff=17449"/>
		<updated>2024-12-18T16:30:18Z</updated>

		<summary type="html">&lt;p&gt;MVucinic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>MVucinic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Httponly-no.PNG&amp;diff=17448</id>
		<title>File:Httponly-no.PNG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Httponly-no.PNG&amp;diff=17448"/>
		<updated>2024-12-18T16:28:54Z</updated>

		<summary type="html">&lt;p&gt;MVucinic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>MVucinic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Document-cookies.PNG&amp;diff=17446</id>
		<title>File:Document-cookies.PNG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Document-cookies.PNG&amp;diff=17446"/>
		<updated>2024-12-18T16:28:02Z</updated>

		<summary type="html">&lt;p&gt;MVucinic: MVucinic uploaded a new version of File:Document-cookies.PNG&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>MVucinic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Document-cookies.PNG&amp;diff=17445</id>
		<title>File:Document-cookies.PNG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Document-cookies.PNG&amp;diff=17445"/>
		<updated>2024-12-18T16:26:37Z</updated>

		<summary type="html">&lt;p&gt;MVucinic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>MVucinic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=OWASP_Mutillidae_(2021)&amp;diff=17399</id>
		<title>OWASP Mutillidae (2021)</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=OWASP_Mutillidae_(2021)&amp;diff=17399"/>
		<updated>2024-12-18T15:52:22Z</updated>

		<summary type="html">&lt;p&gt;MVucinic: /* Installing Mutillidae */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
OWASP Mutillidae is a free open source tool created for Pentesting of Web Applications. It is a &amp;quot;Vulnerable Web Application&amp;quot; that offers a Platform where the provided Exploits and Security flaws can be executed within a local environment. With over 40 different vulnerabilities and related training challenges, it provides a platform that shows the most common flaws of the last 15 years of web development. The main goal is to to offer security training for a wide range of uses, from teaching in classrooms to security enthusiasts exploring to functioning as testing ground for vulnerability assessment targets. The vulnerabilities shown in the program are actual vulnerabilities within the application, so the application should only be run in a protected environment - such as a virtual machine. Most of the Vulnerabilities are structured around the OWASP Top Ten List[https://wiki.elvis.science/index.php?title=Thread_Modelling#Top_10_Web_Application_Security_Risks]. The current Version Mutillidae II was created by Jeremy Druin [https://www.youtube.com/c/webpwnized/featured] (pseudonym: webpwnized), who also created the Tutorials for the Challanges and Installation Guides. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How it Operates ==&lt;br /&gt;
&lt;br /&gt;
Every Vulnerability contained in the application is build in within a Webpage. By selecting the Exploit from a List (e.g. Authentication Bypass) a site with the corresponding explotable Webpage is loaded and ready to get &amp;quot;hacked&amp;quot;. Since everything run at your local machine you can not harm anyone. The data such as &amp;quot;User Data&amp;quot; are stored in a Database which you set up when you install the Application (see Installation for more Information).&lt;br /&gt;
&lt;br /&gt;
[[File:Muti-Dropdown.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== A1 SQL Injection Example ==&lt;br /&gt;
[[SQL_Injection]]-&amp;gt; SQLi Extract Data&lt;br /&gt;
&lt;br /&gt;
Now here is a short example how one vulnerability exploit could look like. In this case there is a query where user can request their userinformation by providing their credentials.&lt;br /&gt;
&lt;br /&gt;
[[File:Mutillidae-login.png]]&lt;br /&gt;
&lt;br /&gt;
Normally the query should only retrun only on record when correct credentials are entered.&lt;br /&gt;
&lt;br /&gt;
But this website is totally unsecure so we can easily rewrite the SQL query to give us a list of every user in the database. But how can we do this?&lt;br /&gt;
&lt;br /&gt;
===Step 1:===&lt;br /&gt;
get an Exception by typing in invalid characters such as (&#039;, #, --)&lt;br /&gt;
&lt;br /&gt;
[[File:Mutillidae-Exception.png]]&lt;br /&gt;
&lt;br /&gt;
===Step 2:===&lt;br /&gt;
&lt;br /&gt;
Since we got an error message with the syntax how the sql statement is written we can alter the statement by simply put another statement in the form.&lt;br /&gt;
&lt;br /&gt;
In this case i wrote ’OR 1# in the username fields to alter the query which should be now&lt;br /&gt;
&lt;br /&gt;
SELECT * FROM acccounts where username= ’ ’OR 1# AND password = ’’&lt;br /&gt;
&lt;br /&gt;
1 means true in SQL language and # is a comment so it ignores the password query. So our SQL String says now that it should gives as all datasets for which the condition is true which lead to following output:&lt;br /&gt;
&lt;br /&gt;
[[File:Mutillidae-Extract-Data.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== A5 Cross-Site-Request Forgery Example ==&lt;br /&gt;
[[Cross-Site-Request_Forgery_(CSRF)]]-&amp;gt; Cross-Site-Request Forgery&lt;br /&gt;
This example can be found in the A5 section from the Owasp Top 10 examples, which is called &#039;Add to your blog&#039;.&lt;br /&gt;
Here we simulating an attack to vote for a security tool but without actually voting for it.&lt;br /&gt;
In the screenshot below you can see the site which we are attacking. So this site is basically the good site.&lt;br /&gt;
&lt;br /&gt;
[[File:UserPoll.PNG]]&lt;br /&gt;
&lt;br /&gt;
The evil site is in this case the &#039;Add to your blog&#039; site. Users can save a blog to a blog table. An attacker can you use this mechanism to manipulate a blog to fire an action.&lt;br /&gt;
Instead of a normal blog you can also add a script to the blog table. This script calls a method when you hover over the blog and it redirects to the voting site and votes for a security tool.&lt;br /&gt;
&lt;br /&gt;
[[File:Blogs.PNG]]&lt;br /&gt;
&lt;br /&gt;
The script can be found on the official github website for Mutillidae https://github.com/webpwnized/mutillidae/blob/master/src/labs/lab-files/cross-site-request-forgery-lab-files/vote-for-nmap-onmouseover-csrf.txt&lt;br /&gt;
This script creates a form object in the background and sets some specific fields. Those fields are being sent over the URL to the voting site.&lt;br /&gt;
Because how the site is constructed, it reads the parameter from the url to decide which security tool should be voted. This means that the form object consists of some input fields and those input fields contain some values.&lt;br /&gt;
One input field is responsible for redirecting to the voting site. The other one is setting the value for security tool. A form also should have a submit button which is also set with the input fields.&lt;br /&gt;
This whole script is contained in a method. This method gets fired when you hover over the mouse. You basically save a html tag with the name of the blog but this html tag calls the method which is containing the malicious script.&lt;br /&gt;
&lt;br /&gt;
== Features ==&lt;br /&gt;
&lt;br /&gt;
* over 40 vulnerabilities (OWASP Top Ten 2007, 2010, 2013 and 2017[https://owasp.org/www-project-top-ten/])&lt;br /&gt;
* Actually Vulnerable&lt;br /&gt;
* Simple Intallation and Maintaining&lt;br /&gt;
* User can switch between 3 security levels (no security, Client-side Security, Server-side Security)&lt;br /&gt;
* Used in web security courses&lt;br /&gt;
* Tutorials and Guides included in Application&lt;br /&gt;
* Updated frequently&lt;br /&gt;
&lt;br /&gt;
== Interface ==&lt;br /&gt;
[[File:Mutillidae-Interface.png]]&lt;br /&gt;
&lt;br /&gt;
By clicking on any Item on the right dropdown menu, you can select any of the OWASP Top Ten Challanges from the last 15 years.&lt;br /&gt;
&lt;br /&gt;
* Hints and Videos - leads you directly to a structured guide how the exercise could be completed.&lt;br /&gt;
* Toggle Security - you can choose between 3 Security levels for each exercise&lt;br /&gt;
* Reset DB - Clear all user Data &lt;br /&gt;
* Labs - Study Questions associated with the Exercises&lt;br /&gt;
&lt;br /&gt;
== Examples of Vulnerabilities ==&lt;br /&gt;
&lt;br /&gt;
* SQL Injections (SQLi)[https://wiki.elvis.science/index.php?title=SQL_Injection]&lt;br /&gt;
* Cross-Site-Scripting [https://wiki.elvis.science/index.php?title=Cross-Site-Scripting_(XSS)]&lt;br /&gt;
* Sensitive Data Exposure&lt;br /&gt;
* other Injection (CSS, HTML, JavaScript)&lt;br /&gt;
* and many more...&lt;br /&gt;
&lt;br /&gt;
== Comparable Vulnerable Web Applications ==&lt;br /&gt;
&lt;br /&gt;
* WebGoat [https://wiki.elvis.science/index.php?title=WebGoat]&lt;br /&gt;
* bWAPP [https://wiki.elvis.science/index.php?title=BWAPP]&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Apache Webserver&lt;br /&gt;
* Database (MySQL/MariaDb)&lt;br /&gt;
* Packages: Sourcecode from git (https://github.com/webpwnized/mutillidae)&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
* Install Apache Webserver on your local Machine&lt;br /&gt;
* Install PHP on your local Machine&lt;br /&gt;
* Install a supported Database (e.g. MySQL, MariaDB) (This installationguide will cover MySQL)&lt;br /&gt;
* Install three PHP Libraries (php-xml, php-curl, php-mbstring)&lt;br /&gt;
* Install Git&lt;br /&gt;
&lt;br /&gt;
If you have a XAMPP/LAMPP stack set up aleady, you might skip directly to installing Mutillidae. Alternativly you can also use a docker build to run Mutillidae.&lt;br /&gt;
There is a Videoseries from the creator which gives a Step-by-Step video tutorialfor the installation.&lt;br /&gt;
&lt;br /&gt;
=== Installing Mutillidae ===&lt;br /&gt;
This section provides a detailed installation guide for OWASP Mutillidae II. The only prerequisite for this guide is a functioning Ubuntu server (or a similar Linux-based environment).&lt;br /&gt;
&lt;br /&gt;
====Apache Webserver====&lt;br /&gt;
&lt;br /&gt;
The first thing to install is the Apache Webserver. Run the following command:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo apt install apache2 -y&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
After installation, allow URL Rewrites:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo a2enmod rewrite&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Restart the Apache server:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo systemctl restart apache2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Next, edit the apache2.conf file to enable AllowOverride All:.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo nano /etc/apache2/apache2.conf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Conf-file.PNG]]&lt;br /&gt;
&lt;br /&gt;
Afterwards restart the server again and with http://ip-address-of-your-server this page should be seen.&lt;br /&gt;
&lt;br /&gt;
[[File:Apache2-page.PNG]]&lt;br /&gt;
====PHP====&lt;br /&gt;
&lt;br /&gt;
If the Apache2 page is visible, Apache has been successfully installed. Now, install PHP with this command:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo apt install php libapache2-mod-php -y&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To test PHP, create an index.php file:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo nano /var/www/html/index.php&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Add the following content:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&amp;lt;?php echo &amp;quot;Hello, PHP!&amp;quot;; ?&amp;gt;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Save the file and visit http://ip-address-of-your-server/index.php. You should see this result:&lt;br /&gt;
&lt;br /&gt;
[[file:Index-php.PNG]]&lt;br /&gt;
====MySQL Server====&lt;br /&gt;
&lt;br /&gt;
Next, install the MySQL Server and the PHP-MySQL plugin with this command:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo apt install mysql-server php-mysql -y&#039;&#039;&lt;br /&gt;
====Change root password====&lt;br /&gt;
&lt;br /&gt;
Mutillidae II uses the root user with the password mutillidae. To ensure it works properly, set the root password as follows:&lt;br /&gt;
&lt;br /&gt;
1) Access the MySQL database as root:&lt;br /&gt;
* &#039;&#039;sudo mysql -u root&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
2) Once on it use this command to make changes in the database:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo mysql;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
3) In the MySQL shell, update the root password:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;ALTER USER &#039;root&#039;@&#039;localhost&#039; IDENTIFIED WITH mysql_native_password BY &#039;mutillidae&#039;;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Once done, flush the old privilages with:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;FLUSH PRIVILEGES;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Then write EXIT; to exit the database.&lt;br /&gt;
====PHP Libraries====&lt;br /&gt;
&lt;br /&gt;
With these steps done, we can now go and install the three PHP libraries. The first one will be the PHP XML Library.&lt;br /&gt;
Run these commands:&lt;br /&gt;
&lt;br /&gt;
This in order to know which PHP Verion one has:&lt;br /&gt;
* &#039;&#039;php --version (to now which version of PHP one has)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
After having figured out whcih version of PHP is installed run this:&lt;br /&gt;
* &#039;&#039;sudo apt-get install php8.1-xml&#039;&#039; (my verison is 8.1, yours could be different)&lt;br /&gt;
&lt;br /&gt;
After the XML Library, the Curl Library will be installed next:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo apt-get install php8.1-curl&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The last Library will be the mbstring Library.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo apt-get install php8.1-mbstring&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====Git====&lt;br /&gt;
&lt;br /&gt;
Install Git to download the OWASP Mutillidae II repository:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo apt install git -y&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====Final step====&lt;br /&gt;
&lt;br /&gt;
Finally, install OWASP Mutillidae II:&lt;br /&gt;
&lt;br /&gt;
1) Move to the Apache webserver folder:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;cd /var/www/html&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
2) Clone the repository:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo git clone https://github.com/webpwnized/mutillidae.git&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
After its done cloning, visit http://ip-address-of-your-server/mutillidae/src. There, if everythin worked, you should be greeted by this site:&lt;br /&gt;
&lt;br /&gt;
[[file:Owasp-page.PNG]]&lt;br /&gt;
&lt;br /&gt;
On the page, press Reset DB. If everything worked correctly, the installation is successful.&lt;br /&gt;
&lt;br /&gt;
=== Installing Mutillidae with Metasploit ===&lt;br /&gt;
A different method for installing Mutillidae is to install Metasploit. Metasploit is a penetration testing software which inlcudes everything you need to set up and run Mutillidae.&lt;br /&gt;
This means that you don&#039;t have to install all the other components you need for example a database, because Metasploit is doing this for.&lt;br /&gt;
After installing you can use the credentials msfadmin for the username and password in order to login into Metasploit.&lt;br /&gt;
When Metasploit is running Mutillidae is also accessible and for that you use the ip address of the machine where Metasploit is running on.&lt;br /&gt;
To look up the ip address you can use the &#039;ip a&#039; command in the CLI to find the ip address.&lt;br /&gt;
Sometimes it happens that Mutillidae cannot access the database. This problem occurs when the database name in the config file is not set.&lt;br /&gt;
To fix this problem you have to navigate to this config file which is found in this destination &#039;/var/www/mutillidae/config.inc&#039;.&lt;br /&gt;
In this config file you change the value of the variable called &#039;$dbname&#039; to &#039;owasp10&#039;. After this configuration Mutillidae can access the database.&lt;br /&gt;
&lt;br /&gt;
[[File:Config.PNG]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://owasp.org/www-project-top-ten/&lt;br /&gt;
* https://github.com/webpwnized/mutillidae&lt;br /&gt;
* https://www.youtube.com/c/webpwnized/featured&lt;br /&gt;
* https://github.com/webpwnized/mutillidae/blob/master/README-INSTALLATION.md Step-by-Step video tutorial&lt;br /&gt;
&lt;br /&gt;
Internal Links&lt;br /&gt;
* https://wiki.elvis.science/index.php?title=SQL_Injection&lt;br /&gt;
* https://wiki.elvis.science/index.php?title=Cross-Site-Scripting_(XSS)&lt;br /&gt;
* https://wiki.elvis.science/index.php?title=SQL_Injection_Examples_on_Known_Vulnerable_Web_Applications&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>MVucinic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=OWASP_Mutillidae_(2021)&amp;diff=17398</id>
		<title>OWASP Mutillidae (2021)</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=OWASP_Mutillidae_(2021)&amp;diff=17398"/>
		<updated>2024-12-18T15:52:10Z</updated>

		<summary type="html">&lt;p&gt;MVucinic: /* Installing Mutillidae */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
OWASP Mutillidae is a free open source tool created for Pentesting of Web Applications. It is a &amp;quot;Vulnerable Web Application&amp;quot; that offers a Platform where the provided Exploits and Security flaws can be executed within a local environment. With over 40 different vulnerabilities and related training challenges, it provides a platform that shows the most common flaws of the last 15 years of web development. The main goal is to to offer security training for a wide range of uses, from teaching in classrooms to security enthusiasts exploring to functioning as testing ground for vulnerability assessment targets. The vulnerabilities shown in the program are actual vulnerabilities within the application, so the application should only be run in a protected environment - such as a virtual machine. Most of the Vulnerabilities are structured around the OWASP Top Ten List[https://wiki.elvis.science/index.php?title=Thread_Modelling#Top_10_Web_Application_Security_Risks]. The current Version Mutillidae II was created by Jeremy Druin [https://www.youtube.com/c/webpwnized/featured] (pseudonym: webpwnized), who also created the Tutorials for the Challanges and Installation Guides. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How it Operates ==&lt;br /&gt;
&lt;br /&gt;
Every Vulnerability contained in the application is build in within a Webpage. By selecting the Exploit from a List (e.g. Authentication Bypass) a site with the corresponding explotable Webpage is loaded and ready to get &amp;quot;hacked&amp;quot;. Since everything run at your local machine you can not harm anyone. The data such as &amp;quot;User Data&amp;quot; are stored in a Database which you set up when you install the Application (see Installation for more Information).&lt;br /&gt;
&lt;br /&gt;
[[File:Muti-Dropdown.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== A1 SQL Injection Example ==&lt;br /&gt;
[[SQL_Injection]]-&amp;gt; SQLi Extract Data&lt;br /&gt;
&lt;br /&gt;
Now here is a short example how one vulnerability exploit could look like. In this case there is a query where user can request their userinformation by providing their credentials.&lt;br /&gt;
&lt;br /&gt;
[[File:Mutillidae-login.png]]&lt;br /&gt;
&lt;br /&gt;
Normally the query should only retrun only on record when correct credentials are entered.&lt;br /&gt;
&lt;br /&gt;
But this website is totally unsecure so we can easily rewrite the SQL query to give us a list of every user in the database. But how can we do this?&lt;br /&gt;
&lt;br /&gt;
===Step 1:===&lt;br /&gt;
get an Exception by typing in invalid characters such as (&#039;, #, --)&lt;br /&gt;
&lt;br /&gt;
[[File:Mutillidae-Exception.png]]&lt;br /&gt;
&lt;br /&gt;
===Step 2:===&lt;br /&gt;
&lt;br /&gt;
Since we got an error message with the syntax how the sql statement is written we can alter the statement by simply put another statement in the form.&lt;br /&gt;
&lt;br /&gt;
In this case i wrote ’OR 1# in the username fields to alter the query which should be now&lt;br /&gt;
&lt;br /&gt;
SELECT * FROM acccounts where username= ’ ’OR 1# AND password = ’’&lt;br /&gt;
&lt;br /&gt;
1 means true in SQL language and # is a comment so it ignores the password query. So our SQL String says now that it should gives as all datasets for which the condition is true which lead to following output:&lt;br /&gt;
&lt;br /&gt;
[[File:Mutillidae-Extract-Data.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== A5 Cross-Site-Request Forgery Example ==&lt;br /&gt;
[[Cross-Site-Request_Forgery_(CSRF)]]-&amp;gt; Cross-Site-Request Forgery&lt;br /&gt;
This example can be found in the A5 section from the Owasp Top 10 examples, which is called &#039;Add to your blog&#039;.&lt;br /&gt;
Here we simulating an attack to vote for a security tool but without actually voting for it.&lt;br /&gt;
In the screenshot below you can see the site which we are attacking. So this site is basically the good site.&lt;br /&gt;
&lt;br /&gt;
[[File:UserPoll.PNG]]&lt;br /&gt;
&lt;br /&gt;
The evil site is in this case the &#039;Add to your blog&#039; site. Users can save a blog to a blog table. An attacker can you use this mechanism to manipulate a blog to fire an action.&lt;br /&gt;
Instead of a normal blog you can also add a script to the blog table. This script calls a method when you hover over the blog and it redirects to the voting site and votes for a security tool.&lt;br /&gt;
&lt;br /&gt;
[[File:Blogs.PNG]]&lt;br /&gt;
&lt;br /&gt;
The script can be found on the official github website for Mutillidae https://github.com/webpwnized/mutillidae/blob/master/src/labs/lab-files/cross-site-request-forgery-lab-files/vote-for-nmap-onmouseover-csrf.txt&lt;br /&gt;
This script creates a form object in the background and sets some specific fields. Those fields are being sent over the URL to the voting site.&lt;br /&gt;
Because how the site is constructed, it reads the parameter from the url to decide which security tool should be voted. This means that the form object consists of some input fields and those input fields contain some values.&lt;br /&gt;
One input field is responsible for redirecting to the voting site. The other one is setting the value for security tool. A form also should have a submit button which is also set with the input fields.&lt;br /&gt;
This whole script is contained in a method. This method gets fired when you hover over the mouse. You basically save a html tag with the name of the blog but this html tag calls the method which is containing the malicious script.&lt;br /&gt;
&lt;br /&gt;
== Features ==&lt;br /&gt;
&lt;br /&gt;
* over 40 vulnerabilities (OWASP Top Ten 2007, 2010, 2013 and 2017[https://owasp.org/www-project-top-ten/])&lt;br /&gt;
* Actually Vulnerable&lt;br /&gt;
* Simple Intallation and Maintaining&lt;br /&gt;
* User can switch between 3 security levels (no security, Client-side Security, Server-side Security)&lt;br /&gt;
* Used in web security courses&lt;br /&gt;
* Tutorials and Guides included in Application&lt;br /&gt;
* Updated frequently&lt;br /&gt;
&lt;br /&gt;
== Interface ==&lt;br /&gt;
[[File:Mutillidae-Interface.png]]&lt;br /&gt;
&lt;br /&gt;
By clicking on any Item on the right dropdown menu, you can select any of the OWASP Top Ten Challanges from the last 15 years.&lt;br /&gt;
&lt;br /&gt;
* Hints and Videos - leads you directly to a structured guide how the exercise could be completed.&lt;br /&gt;
* Toggle Security - you can choose between 3 Security levels for each exercise&lt;br /&gt;
* Reset DB - Clear all user Data &lt;br /&gt;
* Labs - Study Questions associated with the Exercises&lt;br /&gt;
&lt;br /&gt;
== Examples of Vulnerabilities ==&lt;br /&gt;
&lt;br /&gt;
* SQL Injections (SQLi)[https://wiki.elvis.science/index.php?title=SQL_Injection]&lt;br /&gt;
* Cross-Site-Scripting [https://wiki.elvis.science/index.php?title=Cross-Site-Scripting_(XSS)]&lt;br /&gt;
* Sensitive Data Exposure&lt;br /&gt;
* other Injection (CSS, HTML, JavaScript)&lt;br /&gt;
* and many more...&lt;br /&gt;
&lt;br /&gt;
== Comparable Vulnerable Web Applications ==&lt;br /&gt;
&lt;br /&gt;
* WebGoat [https://wiki.elvis.science/index.php?title=WebGoat]&lt;br /&gt;
* bWAPP [https://wiki.elvis.science/index.php?title=BWAPP]&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Apache Webserver&lt;br /&gt;
* Database (MySQL/MariaDb)&lt;br /&gt;
* Packages: Sourcecode from git (https://github.com/webpwnized/mutillidae)&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
* Install Apache Webserver on your local Machine&lt;br /&gt;
* Install PHP on your local Machine&lt;br /&gt;
* Install a supported Database (e.g. MySQL, MariaDB) (This installationguide will cover MySQL)&lt;br /&gt;
* Install three PHP Libraries (php-xml, php-curl, php-mbstring)&lt;br /&gt;
* Install Git&lt;br /&gt;
&lt;br /&gt;
If you have a XAMPP/LAMPP stack set up aleady, you might skip directly to installing Mutillidae. Alternativly you can also use a docker build to run Mutillidae.&lt;br /&gt;
There is a Videoseries from the creator which gives a Step-by-Step video tutorialfor the installation.&lt;br /&gt;
&lt;br /&gt;
=== Installing Mutillidae ===&lt;br /&gt;
This document provides a detailed installation guide for OWASP Mutillidae II. The only prerequisite for this guide is a functioning Ubuntu server (or a similar Linux-based environment).&lt;br /&gt;
&lt;br /&gt;
====Apache Webserver====&lt;br /&gt;
&lt;br /&gt;
The first thing to install is the Apache Webserver. Run the following command:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo apt install apache2 -y&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
After installation, allow URL Rewrites:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo a2enmod rewrite&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Restart the Apache server:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo systemctl restart apache2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Next, edit the apache2.conf file to enable AllowOverride All:.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo nano /etc/apache2/apache2.conf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Conf-file.PNG]]&lt;br /&gt;
&lt;br /&gt;
Afterwards restart the server again and with http://ip-address-of-your-server this page should be seen.&lt;br /&gt;
&lt;br /&gt;
[[File:Apache2-page.PNG]]&lt;br /&gt;
====PHP====&lt;br /&gt;
&lt;br /&gt;
If the Apache2 page is visible, Apache has been successfully installed. Now, install PHP with this command:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo apt install php libapache2-mod-php -y&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To test PHP, create an index.php file:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo nano /var/www/html/index.php&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Add the following content:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&amp;lt;?php echo &amp;quot;Hello, PHP!&amp;quot;; ?&amp;gt;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Save the file and visit http://ip-address-of-your-server/index.php. You should see this result:&lt;br /&gt;
&lt;br /&gt;
[[file:Index-php.PNG]]&lt;br /&gt;
====MySQL Server====&lt;br /&gt;
&lt;br /&gt;
Next, install the MySQL Server and the PHP-MySQL plugin with this command:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo apt install mysql-server php-mysql -y&#039;&#039;&lt;br /&gt;
====Change root password====&lt;br /&gt;
&lt;br /&gt;
Mutillidae II uses the root user with the password mutillidae. To ensure it works properly, set the root password as follows:&lt;br /&gt;
&lt;br /&gt;
1) Access the MySQL database as root:&lt;br /&gt;
* &#039;&#039;sudo mysql -u root&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
2) Once on it use this command to make changes in the database:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo mysql;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
3) In the MySQL shell, update the root password:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;ALTER USER &#039;root&#039;@&#039;localhost&#039; IDENTIFIED WITH mysql_native_password BY &#039;mutillidae&#039;;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Once done, flush the old privilages with:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;FLUSH PRIVILEGES;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Then write EXIT; to exit the database.&lt;br /&gt;
====PHP Libraries====&lt;br /&gt;
&lt;br /&gt;
With these steps done, we can now go and install the three PHP libraries. The first one will be the PHP XML Library.&lt;br /&gt;
Run these commands:&lt;br /&gt;
&lt;br /&gt;
This in order to know which PHP Verion one has:&lt;br /&gt;
* &#039;&#039;php --version (to now which version of PHP one has)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
After having figured out whcih version of PHP is installed run this:&lt;br /&gt;
* &#039;&#039;sudo apt-get install php8.1-xml&#039;&#039; (my verison is 8.1, yours could be different)&lt;br /&gt;
&lt;br /&gt;
After the XML Library, the Curl Library will be installed next:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo apt-get install php8.1-curl&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The last Library will be the mbstring Library.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo apt-get install php8.1-mbstring&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====Git====&lt;br /&gt;
&lt;br /&gt;
Install Git to download the OWASP Mutillidae II repository:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo apt install git -y&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====Final step====&lt;br /&gt;
&lt;br /&gt;
Finally, install OWASP Mutillidae II:&lt;br /&gt;
&lt;br /&gt;
1) Move to the Apache webserver folder:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;cd /var/www/html&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
2) Clone the repository:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo git clone https://github.com/webpwnized/mutillidae.git&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
After its done cloning, visit http://ip-address-of-your-server/mutillidae/src. There, if everythin worked, you should be greeted by this site:&lt;br /&gt;
&lt;br /&gt;
[[file:Owasp-page.PNG]]&lt;br /&gt;
&lt;br /&gt;
On the page, press Reset DB. If everything worked correctly, the installation is successful.&lt;br /&gt;
&lt;br /&gt;
=== Installing Mutillidae with Metasploit ===&lt;br /&gt;
A different method for installing Mutillidae is to install Metasploit. Metasploit is a penetration testing software which inlcudes everything you need to set up and run Mutillidae.&lt;br /&gt;
This means that you don&#039;t have to install all the other components you need for example a database, because Metasploit is doing this for.&lt;br /&gt;
After installing you can use the credentials msfadmin for the username and password in order to login into Metasploit.&lt;br /&gt;
When Metasploit is running Mutillidae is also accessible and for that you use the ip address of the machine where Metasploit is running on.&lt;br /&gt;
To look up the ip address you can use the &#039;ip a&#039; command in the CLI to find the ip address.&lt;br /&gt;
Sometimes it happens that Mutillidae cannot access the database. This problem occurs when the database name in the config file is not set.&lt;br /&gt;
To fix this problem you have to navigate to this config file which is found in this destination &#039;/var/www/mutillidae/config.inc&#039;.&lt;br /&gt;
In this config file you change the value of the variable called &#039;$dbname&#039; to &#039;owasp10&#039;. After this configuration Mutillidae can access the database.&lt;br /&gt;
&lt;br /&gt;
[[File:Config.PNG]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://owasp.org/www-project-top-ten/&lt;br /&gt;
* https://github.com/webpwnized/mutillidae&lt;br /&gt;
* https://www.youtube.com/c/webpwnized/featured&lt;br /&gt;
* https://github.com/webpwnized/mutillidae/blob/master/README-INSTALLATION.md Step-by-Step video tutorial&lt;br /&gt;
&lt;br /&gt;
Internal Links&lt;br /&gt;
* https://wiki.elvis.science/index.php?title=SQL_Injection&lt;br /&gt;
* https://wiki.elvis.science/index.php?title=Cross-Site-Scripting_(XSS)&lt;br /&gt;
* https://wiki.elvis.science/index.php?title=SQL_Injection_Examples_on_Known_Vulnerable_Web_Applications&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>MVucinic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=OWASP_Mutillidae_(2021)&amp;diff=17315</id>
		<title>OWASP Mutillidae (2021)</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=OWASP_Mutillidae_(2021)&amp;diff=17315"/>
		<updated>2024-12-17T21:25:18Z</updated>

		<summary type="html">&lt;p&gt;MVucinic: /* Installation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
OWASP Mutillidae is a free open source tool created for Pentesting of Web Applications. It is a &amp;quot;Vulnerable Web Application&amp;quot; that offers a Platform where the provided Exploits and Security flaws can be executed within a local environment. With over 40 different vulnerabilities and related training challenges, it provides a platform that shows the most common flaws of the last 15 years of web development. The main goal is to to offer security training for a wide range of uses, from teaching in classrooms to security enthusiasts exploring to functioning as testing ground for vulnerability assessment targets. The vulnerabilities shown in the program are actual vulnerabilities within the application, so the application should only be run in a protected environment - such as a virtual machine. Most of the Vulnerabilities are structured around the OWASP Top Ten List[https://wiki.elvis.science/index.php?title=Thread_Modelling#Top_10_Web_Application_Security_Risks]. The current Version Mutillidae II was created by Jeremy Druin [https://www.youtube.com/c/webpwnized/featured] (pseudonym: webpwnized), who also created the Tutorials for the Challanges and Installation Guides. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How it Operates ==&lt;br /&gt;
&lt;br /&gt;
Every Vulnerability contained in the application is build in within a Webpage. By selecting the Exploit from a List (e.g. Authentication Bypass) a site with the corresponding explotable Webpage is loaded and ready to get &amp;quot;hacked&amp;quot;. Since everything run at your local machine you can not harm anyone. The data such as &amp;quot;User Data&amp;quot; are stored in a Database which you set up when you install the Application (see Installation for more Information).&lt;br /&gt;
&lt;br /&gt;
[[File:Muti-Dropdown.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== A1 SQL Injection Example ==&lt;br /&gt;
[[SQL_Injection]]-&amp;gt; SQLi Extract Data&lt;br /&gt;
&lt;br /&gt;
Now here is a short example how one vulnerability exploit could look like. In this case there is a query where user can request their userinformation by providing their credentials.&lt;br /&gt;
&lt;br /&gt;
[[File:Mutillidae-login.png]]&lt;br /&gt;
&lt;br /&gt;
Normally the query should only retrun only on record when correct credentials are entered.&lt;br /&gt;
&lt;br /&gt;
But this website is totally unsecure so we can easily rewrite the SQL query to give us a list of every user in the database. But how can we do this?&lt;br /&gt;
&lt;br /&gt;
===Step 1:===&lt;br /&gt;
get an Exception by typing in invalid characters such as (&#039;, #, --)&lt;br /&gt;
&lt;br /&gt;
[[File:Mutillidae-Exception.png]]&lt;br /&gt;
&lt;br /&gt;
===Step 2:===&lt;br /&gt;
&lt;br /&gt;
Since we got an error message with the syntax how the sql statement is written we can alter the statement by simply put another statement in the form.&lt;br /&gt;
&lt;br /&gt;
In this case i wrote ’OR 1# in the username fields to alter the query which should be now&lt;br /&gt;
&lt;br /&gt;
SELECT * FROM acccounts where username= ’ ’OR 1# AND password = ’’&lt;br /&gt;
&lt;br /&gt;
1 means true in SQL language and # is a comment so it ignores the password query. So our SQL String says now that it should gives as all datasets for which the condition is true which lead to following output:&lt;br /&gt;
&lt;br /&gt;
[[File:Mutillidae-Extract-Data.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== A5 Cross-Site-Request Forgery Example ==&lt;br /&gt;
[[Cross-Site-Request_Forgery_(CSRF)]]-&amp;gt; Cross-Site-Request Forgery&lt;br /&gt;
This example can be found in the A5 section from the Owasp Top 10 examples, which is called &#039;Add to your blog&#039;.&lt;br /&gt;
Here we simulating an attack to vote for a security tool but without actually voting for it.&lt;br /&gt;
In the screenshot below you can see the site which we are attacking. So this site is basically the good site.&lt;br /&gt;
&lt;br /&gt;
[[File:UserPoll.PNG]]&lt;br /&gt;
&lt;br /&gt;
The evil site is in this case the &#039;Add to your blog&#039; site. Users can save a blog to a blog table. An attacker can you use this mechanism to manipulate a blog to fire an action.&lt;br /&gt;
Instead of a normal blog you can also add a script to the blog table. This script calls a method when you hover over the blog and it redirects to the voting site and votes for a security tool.&lt;br /&gt;
&lt;br /&gt;
[[File:Blogs.PNG]]&lt;br /&gt;
&lt;br /&gt;
The script can be found on the official github website for Mutillidae https://github.com/webpwnized/mutillidae/blob/master/src/labs/lab-files/cross-site-request-forgery-lab-files/vote-for-nmap-onmouseover-csrf.txt&lt;br /&gt;
This script creates a form object in the background and sets some specific fields. Those fields are being sent over the URL to the voting site.&lt;br /&gt;
Because how the site is constructed, it reads the parameter from the url to decide which security tool should be voted. This means that the form object consists of some input fields and those input fields contain some values.&lt;br /&gt;
One input field is responsible for redirecting to the voting site. The other one is setting the value for security tool. A form also should have a submit button which is also set with the input fields.&lt;br /&gt;
This whole script is contained in a method. This method gets fired when you hover over the mouse. You basically save a html tag with the name of the blog but this html tag calls the method which is containing the malicious script.&lt;br /&gt;
&lt;br /&gt;
== Features ==&lt;br /&gt;
&lt;br /&gt;
* over 40 vulnerabilities (OWASP Top Ten 2007, 2010, 2013 and 2017[https://owasp.org/www-project-top-ten/])&lt;br /&gt;
* Actually Vulnerable&lt;br /&gt;
* Simple Intallation and Maintaining&lt;br /&gt;
* User can switch between 3 security levels (no security, Client-side Security, Server-side Security)&lt;br /&gt;
* Used in web security courses&lt;br /&gt;
* Tutorials and Guides included in Application&lt;br /&gt;
* Updated frequently&lt;br /&gt;
&lt;br /&gt;
== Interface ==&lt;br /&gt;
[[File:Mutillidae-Interface.png]]&lt;br /&gt;
&lt;br /&gt;
By clicking on any Item on the right dropdown menu, you can select any of the OWASP Top Ten Challanges from the last 15 years.&lt;br /&gt;
&lt;br /&gt;
* Hints and Videos - leads you directly to a structured guide how the exercise could be completed.&lt;br /&gt;
* Toggle Security - you can choose between 3 Security levels for each exercise&lt;br /&gt;
* Reset DB - Clear all user Data &lt;br /&gt;
* Labs - Study Questions associated with the Exercises&lt;br /&gt;
&lt;br /&gt;
== Examples of Vulnerabilities ==&lt;br /&gt;
&lt;br /&gt;
* SQL Injections (SQLi)[https://wiki.elvis.science/index.php?title=SQL_Injection]&lt;br /&gt;
* Cross-Site-Scripting [https://wiki.elvis.science/index.php?title=Cross-Site-Scripting_(XSS)]&lt;br /&gt;
* Sensitive Data Exposure&lt;br /&gt;
* other Injection (CSS, HTML, JavaScript)&lt;br /&gt;
* and many more...&lt;br /&gt;
&lt;br /&gt;
== Comparable Vulnerable Web Applications ==&lt;br /&gt;
&lt;br /&gt;
* WebGoat [https://wiki.elvis.science/index.php?title=WebGoat]&lt;br /&gt;
* bWAPP [https://wiki.elvis.science/index.php?title=BWAPP]&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Apache Webserver&lt;br /&gt;
* Database (MySQL/MariaDb)&lt;br /&gt;
* Packages: Sourcecode from git (https://github.com/webpwnized/mutillidae)&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
* Install Apache Webserver on your local Machine&lt;br /&gt;
* Install PHP on your local Machine&lt;br /&gt;
* Install a supported Database (e.g. MySQL, MariaDB) (This installationguide will cover MySQL)&lt;br /&gt;
* Install three PHP Libraries (php-xml, php-curl, php-mbstring)&lt;br /&gt;
* Install Git&lt;br /&gt;
&lt;br /&gt;
If you have a XAMPP/LAMPP stack set up aleady, you might skip directly to installing Mutillidae. Alternativly you can also use a docker build to run Mutillidae.&lt;br /&gt;
There is a Videoseries from the creator which gives a Step-by-Step video tutorialfor the installation.&lt;br /&gt;
&lt;br /&gt;
=== Installing Mutillidae ===&lt;br /&gt;
====Apache Webserver====&lt;br /&gt;
&lt;br /&gt;
The first thing to install is the Apache Webserver. Run the following command:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo apt install apache2 -y&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
After installation, allow URL Rewrites:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo a2enmod rewrite&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Restart the Apache server:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo systemctl restart apache2&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Next, edit the apache2.conf file to enable AllowOverride All:.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo nano /etc/apache2/apache2.conf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Conf-file.PNG]]&lt;br /&gt;
&lt;br /&gt;
Afterwards restart the server again and with http://ip-address-of-your-server this page should be seen.&lt;br /&gt;
&lt;br /&gt;
[[File:Apache2-page.PNG]]&lt;br /&gt;
====PHP====&lt;br /&gt;
&lt;br /&gt;
If the Apache2 page is visible, Apache has been successfully installed. Now, install PHP with this command:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo apt install php libapache2-mod-php -y&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To test PHP, create an index.php file:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo nano /var/www/html/index.php&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Add the following content:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&amp;lt;?php echo &amp;quot;Hello, PHP!&amp;quot;; ?&amp;gt;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Save the file and visit http://ip-address-of-your-server/index.php. You should see this result:&lt;br /&gt;
&lt;br /&gt;
[[file:Index-php.PNG]]&lt;br /&gt;
====MySQL Server====&lt;br /&gt;
&lt;br /&gt;
Next, install the MySQL Server and the PHP-MySQL plugin with this command:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo apt install mysql-server php-mysql -y&#039;&#039;&lt;br /&gt;
====Change root password====&lt;br /&gt;
&lt;br /&gt;
Mutillidae II uses the root user with the password mutillidae. To ensure it works properly, set the root password as follows:&lt;br /&gt;
&lt;br /&gt;
1) Access the MySQL database as root:&lt;br /&gt;
* &#039;&#039;sudo mysql -u root&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
2) Once on it use this command to make changes in the database:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo mysql;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
3) In the MySQL shell, update the root password:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;ALTER USER &#039;root&#039;@&#039;localhost&#039; IDENTIFIED WITH mysql_native_password BY &#039;mutillidae&#039;;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Once done, flush the old privilages with:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;FLUSH PRIVILEGES;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Then write EXIT; to exit the database.&lt;br /&gt;
====PHP Libraries====&lt;br /&gt;
&lt;br /&gt;
With these steps done, we can now go and install the three PHP libraries. The first one will be the PHP XML Library.&lt;br /&gt;
Run these commands:&lt;br /&gt;
&lt;br /&gt;
This in order to know which PHP Verion one has:&lt;br /&gt;
* &#039;&#039;php --version (to now which version of PHP one has)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
After having figured out whcih version of PHP is installed run this:&lt;br /&gt;
* &#039;&#039;sudo apt-get install php8.1-xml&#039;&#039; (my verison is 8.1, yours could be different)&lt;br /&gt;
&lt;br /&gt;
After the XML Library, the Curl Library will be installed next:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo apt-get install php8.1-curl&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The last Library will be the mbstring Library.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo apt-get install php8.1-mbstring&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====Git====&lt;br /&gt;
&lt;br /&gt;
Install Git to download the OWASP Mutillidae II repository:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo apt install git -y&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
====Final step====&lt;br /&gt;
&lt;br /&gt;
Finally, install OWASP Mutillidae II:&lt;br /&gt;
&lt;br /&gt;
1) Move to the Apache webserver folder:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;cd /var/www/html&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
2) Clone the repository:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;sudo git clone https://github.com/webpwnized/mutillidae.git&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
After its done cloning, visit http://ip-address-of-your-server/mutillidae/src. There, if everythin worked, you should be greeted by this site:&lt;br /&gt;
&lt;br /&gt;
[[file:Owasp-page.PNG]]&lt;br /&gt;
&lt;br /&gt;
On the page, press Reset DB. If everything worked correctly, the installation is successful.&lt;br /&gt;
&lt;br /&gt;
=== Installing Mutillidae with Metasploit ===&lt;br /&gt;
A different method for installing Mutillidae is to install Metasploit. Metasploit is a penetration testing software which inlcudes everything you need to set up and run Mutillidae.&lt;br /&gt;
This means that you don&#039;t have to install all the other components you need for example a database, because Metasploit is doing this for.&lt;br /&gt;
After installing you can use the credentials msfadmin for the username and password in order to login into Metasploit.&lt;br /&gt;
When Metasploit is running Mutillidae is also accessible and for that you use the ip address of the machine where Metasploit is running on.&lt;br /&gt;
To look up the ip address you can use the &#039;ip a&#039; command in the CLI to find the ip address.&lt;br /&gt;
Sometimes it happens that Mutillidae cannot access the database. This problem occurs when the database name in the config file is not set.&lt;br /&gt;
To fix this problem you have to navigate to this config file which is found in this destination &#039;/var/www/mutillidae/config.inc&#039;.&lt;br /&gt;
In this config file you change the value of the variable called &#039;$dbname&#039; to &#039;owasp10&#039;. After this configuration Mutillidae can access the database.&lt;br /&gt;
&lt;br /&gt;
[[File:Config.PNG]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://owasp.org/www-project-top-ten/&lt;br /&gt;
* https://github.com/webpwnized/mutillidae&lt;br /&gt;
* https://www.youtube.com/c/webpwnized/featured&lt;br /&gt;
* https://github.com/webpwnized/mutillidae/blob/master/README-INSTALLATION.md Step-by-Step video tutorial&lt;br /&gt;
&lt;br /&gt;
Internal Links&lt;br /&gt;
* https://wiki.elvis.science/index.php?title=SQL_Injection&lt;br /&gt;
* https://wiki.elvis.science/index.php?title=Cross-Site-Scripting_(XSS)&lt;br /&gt;
* https://wiki.elvis.science/index.php?title=SQL_Injection_Examples_on_Known_Vulnerable_Web_Applications&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>MVucinic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Owasp-page.PNG&amp;diff=17307</id>
		<title>File:Owasp-page.PNG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Owasp-page.PNG&amp;diff=17307"/>
		<updated>2024-12-17T21:00:59Z</updated>

		<summary type="html">&lt;p&gt;MVucinic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>MVucinic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=OWASP_Mutillidae_(2021)&amp;diff=17300</id>
		<title>OWASP Mutillidae (2021)</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=OWASP_Mutillidae_(2021)&amp;diff=17300"/>
		<updated>2024-12-17T20:51:32Z</updated>

		<summary type="html">&lt;p&gt;MVucinic: /* Installation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
OWASP Mutillidae is a free open source tool created for Pentesting of Web Applications. It is a &amp;quot;Vulnerable Web Application&amp;quot; that offers a Platform where the provided Exploits and Security flaws can be executed within a local environment. With over 40 different vulnerabilities and related training challenges, it provides a platform that shows the most common flaws of the last 15 years of web development. The main goal is to to offer security training for a wide range of uses, from teaching in classrooms to security enthusiasts exploring to functioning as testing ground for vulnerability assessment targets. The vulnerabilities shown in the program are actual vulnerabilities within the application, so the application should only be run in a protected environment - such as a virtual machine. Most of the Vulnerabilities are structured around the OWASP Top Ten List[https://wiki.elvis.science/index.php?title=Thread_Modelling#Top_10_Web_Application_Security_Risks]. The current Version Mutillidae II was created by Jeremy Druin [https://www.youtube.com/c/webpwnized/featured] (pseudonym: webpwnized), who also created the Tutorials for the Challanges and Installation Guides. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How it Operates ==&lt;br /&gt;
&lt;br /&gt;
Every Vulnerability contained in the application is build in within a Webpage. By selecting the Exploit from a List (e.g. Authentication Bypass) a site with the corresponding explotable Webpage is loaded and ready to get &amp;quot;hacked&amp;quot;. Since everything run at your local machine you can not harm anyone. The data such as &amp;quot;User Data&amp;quot; are stored in a Database which you set up when you install the Application (see Installation for more Information).&lt;br /&gt;
&lt;br /&gt;
[[File:Muti-Dropdown.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== A1 SQL Injection Example ==&lt;br /&gt;
[[SQL_Injection]]-&amp;gt; SQLi Extract Data&lt;br /&gt;
&lt;br /&gt;
Now here is a short example how one vulnerability exploit could look like. In this case there is a query where user can request their userinformation by providing their credentials.&lt;br /&gt;
&lt;br /&gt;
[[File:Mutillidae-login.png]]&lt;br /&gt;
&lt;br /&gt;
Normally the query should only retrun only on record when correct credentials are entered.&lt;br /&gt;
&lt;br /&gt;
But this website is totally unsecure so we can easily rewrite the SQL query to give us a list of every user in the database. But how can we do this?&lt;br /&gt;
&lt;br /&gt;
===Step 1:===&lt;br /&gt;
get an Exception by typing in invalid characters such as (&#039;, #, --)&lt;br /&gt;
&lt;br /&gt;
[[File:Mutillidae-Exception.png]]&lt;br /&gt;
&lt;br /&gt;
===Step 2:===&lt;br /&gt;
&lt;br /&gt;
Since we got an error message with the syntax how the sql statement is written we can alter the statement by simply put another statement in the form.&lt;br /&gt;
&lt;br /&gt;
In this case i wrote ’OR 1# in the username fields to alter the query which should be now&lt;br /&gt;
&lt;br /&gt;
SELECT * FROM acccounts where username= ’ ’OR 1# AND password = ’’&lt;br /&gt;
&lt;br /&gt;
1 means true in SQL language and # is a comment so it ignores the password query. So our SQL String says now that it should gives as all datasets for which the condition is true which lead to following output:&lt;br /&gt;
&lt;br /&gt;
[[File:Mutillidae-Extract-Data.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== A5 Cross-Site-Request Forgery Example ==&lt;br /&gt;
[[Cross-Site-Request_Forgery_(CSRF)]]-&amp;gt; Cross-Site-Request Forgery&lt;br /&gt;
This example can be found in the A5 section from the Owasp Top 10 examples, which is called &#039;Add to your blog&#039;.&lt;br /&gt;
Here we simulating an attack to vote for a security tool but without actually voting for it.&lt;br /&gt;
In the screenshot below you can see the site which we are attacking. So this site is basically the good site.&lt;br /&gt;
&lt;br /&gt;
[[File:UserPoll.PNG]]&lt;br /&gt;
&lt;br /&gt;
The evil site is in this case the &#039;Add to your blog&#039; site. Users can save a blog to a blog table. An attacker can you use this mechanism to manipulate a blog to fire an action.&lt;br /&gt;
Instead of a normal blog you can also add a script to the blog table. This script calls a method when you hover over the blog and it redirects to the voting site and votes for a security tool.&lt;br /&gt;
&lt;br /&gt;
[[File:Blogs.PNG]]&lt;br /&gt;
&lt;br /&gt;
The script can be found on the official github website for Mutillidae https://github.com/webpwnized/mutillidae/blob/master/src/labs/lab-files/cross-site-request-forgery-lab-files/vote-for-nmap-onmouseover-csrf.txt&lt;br /&gt;
This script creates a form object in the background and sets some specific fields. Those fields are being sent over the URL to the voting site.&lt;br /&gt;
Because how the site is constructed, it reads the parameter from the url to decide which security tool should be voted. This means that the form object consists of some input fields and those input fields contain some values.&lt;br /&gt;
One input field is responsible for redirecting to the voting site. The other one is setting the value for security tool. A form also should have a submit button which is also set with the input fields.&lt;br /&gt;
This whole script is contained in a method. This method gets fired when you hover over the mouse. You basically save a html tag with the name of the blog but this html tag calls the method which is containing the malicious script.&lt;br /&gt;
&lt;br /&gt;
== Features ==&lt;br /&gt;
&lt;br /&gt;
* over 40 vulnerabilities (OWASP Top Ten 2007, 2010, 2013 and 2017[https://owasp.org/www-project-top-ten/])&lt;br /&gt;
* Actually Vulnerable&lt;br /&gt;
* Simple Intallation and Maintaining&lt;br /&gt;
* User can switch between 3 security levels (no security, Client-side Security, Server-side Security)&lt;br /&gt;
* Used in web security courses&lt;br /&gt;
* Tutorials and Guides included in Application&lt;br /&gt;
* Updated frequently&lt;br /&gt;
&lt;br /&gt;
== Interface ==&lt;br /&gt;
[[File:Mutillidae-Interface.png]]&lt;br /&gt;
&lt;br /&gt;
By clicking on any Item on the right dropdown menu, you can select any of the OWASP Top Ten Challanges from the last 15 years.&lt;br /&gt;
&lt;br /&gt;
* Hints and Videos - leads you directly to a structured guide how the exercise could be completed.&lt;br /&gt;
* Toggle Security - you can choose between 3 Security levels for each exercise&lt;br /&gt;
* Reset DB - Clear all user Data &lt;br /&gt;
* Labs - Study Questions associated with the Exercises&lt;br /&gt;
&lt;br /&gt;
== Examples of Vulnerabilities ==&lt;br /&gt;
&lt;br /&gt;
* SQL Injections (SQLi)[https://wiki.elvis.science/index.php?title=SQL_Injection]&lt;br /&gt;
* Cross-Site-Scripting [https://wiki.elvis.science/index.php?title=Cross-Site-Scripting_(XSS)]&lt;br /&gt;
* Sensitive Data Exposure&lt;br /&gt;
* other Injection (CSS, HTML, JavaScript)&lt;br /&gt;
* and many more...&lt;br /&gt;
&lt;br /&gt;
== Comparable Vulnerable Web Applications ==&lt;br /&gt;
&lt;br /&gt;
* WebGoat [https://wiki.elvis.science/index.php?title=WebGoat]&lt;br /&gt;
* bWAPP [https://wiki.elvis.science/index.php?title=BWAPP]&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Apache Webserver&lt;br /&gt;
* Database (MySQL/MariaDb)&lt;br /&gt;
* Packages: Sourcecode from git (https://github.com/webpwnized/mutillidae)&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
* Install Apache Webserver on your local Machine&lt;br /&gt;
* Install PHP on your local Machine&lt;br /&gt;
* Install a supported Database (e.g. MySQL, MariaDB) (This installationguide will cover MySQL)&lt;br /&gt;
* Install three PHP Libraries (php-xml, php-curl, php-mbstring)&lt;br /&gt;
* Install Git&lt;br /&gt;
&lt;br /&gt;
If you have a XAMPP/LAMPP stack set up aleady, you might skip directly to installing Mutillidae. Alternativly you can also use a docker build to run Mutillidae.&lt;br /&gt;
There is a Videoseries from the creator which gives a Step-by-Step video tutorialfor the installation.&lt;br /&gt;
&lt;br /&gt;
=== Installing Mutillidae ===&lt;br /&gt;
&lt;br /&gt;
The first thing that will be installed, is an Apache Webserver. In oder to do that, run this command:&lt;br /&gt;
&lt;br /&gt;
* sudo apt install apache2 -y&lt;br /&gt;
&lt;br /&gt;
Afterwards run this command, in order to allow URL_Rewrites.&lt;br /&gt;
&lt;br /&gt;
* sudo a2enmod rewrite&lt;br /&gt;
&lt;br /&gt;
Restart the server then.&lt;br /&gt;
&lt;br /&gt;
* sudo systemctl restart apache2&lt;br /&gt;
&lt;br /&gt;
After the restart, go into the apache2.conf and search the &amp;lt;Directory&amp;gt;. When found, change the AllowOverride None -&amp;gt; AllowOverride All.&lt;br /&gt;
&lt;br /&gt;
* sudo nano /etc/apache2/apache2.conf&lt;br /&gt;
&lt;br /&gt;
[[File:Conf-file.PNG]]&lt;br /&gt;
&lt;br /&gt;
Afterwards restart the server and with http://ip-address-of-your-server this page should be seen.&lt;br /&gt;
&lt;br /&gt;
[[File:Apache2-page.PNG]]&lt;br /&gt;
&lt;br /&gt;
If this page comes up, Apache2 has been succsesfully installed. Now PHP needs to be installed with this:&lt;br /&gt;
&lt;br /&gt;
* sudo apt install php libapache2-mod-php -y&lt;br /&gt;
&lt;br /&gt;
Now we can edit the index.php file and can now write something like this:&lt;br /&gt;
&lt;br /&gt;
* sudo nano /var/www/html/index.php&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;?php echo &amp;quot;Hello, PHP!&amp;quot;; ?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After saving this file and going onto this site http://ip-address-of-your-server/index.php we are greeted with this.&lt;br /&gt;
&lt;br /&gt;
[[file:Index-php.PNG]]&lt;br /&gt;
&lt;br /&gt;
With this out of the way, the next step will be the installation of the MySQL Server. Use this command to install the datasbase and also install the php plugin at the same time.&lt;br /&gt;
&lt;br /&gt;
* sudo apt install mysql-server php-mysql -y&lt;br /&gt;
&lt;br /&gt;
After installing it we need to change the password of root. The reason why we have to do that is, because Mutillidae II uses the root user with the password &amp;quot;mutillidae&amp;quot;. If we dont change that, Mutillidae II wont work properly.&lt;br /&gt;
Use this command in oder to access the database as root:&lt;br /&gt;
&lt;br /&gt;
* sudo mysql -u root&lt;br /&gt;
&lt;br /&gt;
Once on it use this command to make changes in the database:&lt;br /&gt;
&lt;br /&gt;
* sudo mysql&lt;br /&gt;
&lt;br /&gt;
Afterwards run this command to cahnge the password:&lt;br /&gt;
&lt;br /&gt;
* ALTER USER &#039;root&#039;@&#039;localhost&#039; IDENTIFIED WITH mysql_native_password BY &#039;mutillidae&#039;;&lt;br /&gt;
FLUSH PRIVILEGES;&lt;br /&gt;
&lt;br /&gt;
Once done, flush the old privilages with:&lt;br /&gt;
&lt;br /&gt;
* FLUSH PRIVILEGES;&lt;br /&gt;
&lt;br /&gt;
Then write EXIT; to exit the database.&lt;br /&gt;
&lt;br /&gt;
With these steps done, we can now go and install the three PHP libraries. The first one will be the PHP XML Library.&lt;br /&gt;
Run these commands:&lt;br /&gt;
&lt;br /&gt;
* php --version (to now which version of PHP one has)&lt;br /&gt;
&lt;br /&gt;
* sudo apt-get install php8.1-xml (my verison is 8.1, yours could be different)&lt;br /&gt;
&lt;br /&gt;
After the XML Library, the Curl Library will be installed next:&lt;br /&gt;
&lt;br /&gt;
* sudo apt-get install php8.1-curl&lt;br /&gt;
&lt;br /&gt;
The last Library will be the mbstring Library.&lt;br /&gt;
&lt;br /&gt;
* sudo apt-get install php8.1-mbstring&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====test====&lt;br /&gt;
a&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Installing Mutillidae with Metasploit ===&lt;br /&gt;
A different method for installing Mutillidae is to install Metasploit. Metasploit is a penetration testing software which inlcudes everything you need to set up and run Mutillidae.&lt;br /&gt;
This means that you don&#039;t have to install all the other components you need for example a database, because Metasploit is doing this for.&lt;br /&gt;
After installing you can use the credentials msfadmin for the username and password in order to login into Metasploit.&lt;br /&gt;
When Metasploit is running Mutillidae is also accessible and for that you use the ip address of the machine where Metasploit is running on.&lt;br /&gt;
To look up the ip address you can use the &#039;ip a&#039; command in the CLI to find the ip address.&lt;br /&gt;
Sometimes it happens that Mutillidae cannot access the database. This problem occurs when the database name in the config file is not set.&lt;br /&gt;
To fix this problem you have to navigate to this config file which is found in this destination &#039;/var/www/mutillidae/config.inc&#039;.&lt;br /&gt;
In this config file you change the value of the variable called &#039;$dbname&#039; to &#039;owasp10&#039;. After this configuration Mutillidae can access the database.&lt;br /&gt;
&lt;br /&gt;
[[File:Config.PNG]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://owasp.org/www-project-top-ten/&lt;br /&gt;
* https://github.com/webpwnized/mutillidae&lt;br /&gt;
* https://www.youtube.com/c/webpwnized/featured&lt;br /&gt;
* https://github.com/webpwnized/mutillidae/blob/master/README-INSTALLATION.md Step-by-Step video tutorial&lt;br /&gt;
&lt;br /&gt;
Internal Links&lt;br /&gt;
* https://wiki.elvis.science/index.php?title=SQL_Injection&lt;br /&gt;
* https://wiki.elvis.science/index.php?title=Cross-Site-Scripting_(XSS)&lt;br /&gt;
* https://wiki.elvis.science/index.php?title=SQL_Injection_Examples_on_Known_Vulnerable_Web_Applications&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>MVucinic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Index-php.PNG&amp;diff=17285</id>
		<title>File:Index-php.PNG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Index-php.PNG&amp;diff=17285"/>
		<updated>2024-12-17T20:33:20Z</updated>

		<summary type="html">&lt;p&gt;MVucinic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>MVucinic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Conf-file.PNG&amp;diff=17278</id>
		<title>File:Conf-file.PNG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Conf-file.PNG&amp;diff=17278"/>
		<updated>2024-12-17T20:25:26Z</updated>

		<summary type="html">&lt;p&gt;MVucinic: MVucinic uploaded a new version of File:Conf-file.PNG&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>MVucinic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Apache2-page.PNG&amp;diff=17274</id>
		<title>File:Apache2-page.PNG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Apache2-page.PNG&amp;diff=17274"/>
		<updated>2024-12-17T20:22:20Z</updated>

		<summary type="html">&lt;p&gt;MVucinic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>MVucinic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=OWASP_Mutillidae_(2021)&amp;diff=17273</id>
		<title>OWASP Mutillidae (2021)</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=OWASP_Mutillidae_(2021)&amp;diff=17273"/>
		<updated>2024-12-17T20:20:37Z</updated>

		<summary type="html">&lt;p&gt;MVucinic: /* Installation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
OWASP Mutillidae is a free open source tool created for Pentesting of Web Applications. It is a &amp;quot;Vulnerable Web Application&amp;quot; that offers a Platform where the provided Exploits and Security flaws can be executed within a local environment. With over 40 different vulnerabilities and related training challenges, it provides a platform that shows the most common flaws of the last 15 years of web development. The main goal is to to offer security training for a wide range of uses, from teaching in classrooms to security enthusiasts exploring to functioning as testing ground for vulnerability assessment targets. The vulnerabilities shown in the program are actual vulnerabilities within the application, so the application should only be run in a protected environment - such as a virtual machine. Most of the Vulnerabilities are structured around the OWASP Top Ten List[https://wiki.elvis.science/index.php?title=Thread_Modelling#Top_10_Web_Application_Security_Risks]. The current Version Mutillidae II was created by Jeremy Druin [https://www.youtube.com/c/webpwnized/featured] (pseudonym: webpwnized), who also created the Tutorials for the Challanges and Installation Guides. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How it Operates ==&lt;br /&gt;
&lt;br /&gt;
Every Vulnerability contained in the application is build in within a Webpage. By selecting the Exploit from a List (e.g. Authentication Bypass) a site with the corresponding explotable Webpage is loaded and ready to get &amp;quot;hacked&amp;quot;. Since everything run at your local machine you can not harm anyone. The data such as &amp;quot;User Data&amp;quot; are stored in a Database which you set up when you install the Application (see Installation for more Information).&lt;br /&gt;
&lt;br /&gt;
[[File:Muti-Dropdown.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== A1 SQL Injection Example ==&lt;br /&gt;
[[SQL_Injection]]-&amp;gt; SQLi Extract Data&lt;br /&gt;
&lt;br /&gt;
Now here is a short example how one vulnerability exploit could look like. In this case there is a query where user can request their userinformation by providing their credentials.&lt;br /&gt;
&lt;br /&gt;
[[File:Mutillidae-login.png]]&lt;br /&gt;
&lt;br /&gt;
Normally the query should only retrun only on record when correct credentials are entered.&lt;br /&gt;
&lt;br /&gt;
But this website is totally unsecure so we can easily rewrite the SQL query to give us a list of every user in the database. But how can we do this?&lt;br /&gt;
&lt;br /&gt;
===Step 1:===&lt;br /&gt;
get an Exception by typing in invalid characters such as (&#039;, #, --)&lt;br /&gt;
&lt;br /&gt;
[[File:Mutillidae-Exception.png]]&lt;br /&gt;
&lt;br /&gt;
===Step 2:===&lt;br /&gt;
&lt;br /&gt;
Since we got an error message with the syntax how the sql statement is written we can alter the statement by simply put another statement in the form.&lt;br /&gt;
&lt;br /&gt;
In this case i wrote ’OR 1# in the username fields to alter the query which should be now&lt;br /&gt;
&lt;br /&gt;
SELECT * FROM acccounts where username= ’ ’OR 1# AND password = ’’&lt;br /&gt;
&lt;br /&gt;
1 means true in SQL language and # is a comment so it ignores the password query. So our SQL String says now that it should gives as all datasets for which the condition is true which lead to following output:&lt;br /&gt;
&lt;br /&gt;
[[File:Mutillidae-Extract-Data.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== A5 Cross-Site-Request Forgery Example ==&lt;br /&gt;
[[Cross-Site-Request_Forgery_(CSRF)]]-&amp;gt; Cross-Site-Request Forgery&lt;br /&gt;
This example can be found in the A5 section from the Owasp Top 10 examples, which is called &#039;Add to your blog&#039;.&lt;br /&gt;
Here we simulating an attack to vote for a security tool but without actually voting for it.&lt;br /&gt;
In the screenshot below you can see the site which we are attacking. So this site is basically the good site.&lt;br /&gt;
&lt;br /&gt;
[[File:UserPoll.PNG]]&lt;br /&gt;
&lt;br /&gt;
The evil site is in this case the &#039;Add to your blog&#039; site. Users can save a blog to a blog table. An attacker can you use this mechanism to manipulate a blog to fire an action.&lt;br /&gt;
Instead of a normal blog you can also add a script to the blog table. This script calls a method when you hover over the blog and it redirects to the voting site and votes for a security tool.&lt;br /&gt;
&lt;br /&gt;
[[File:Blogs.PNG]]&lt;br /&gt;
&lt;br /&gt;
The script can be found on the official github website for Mutillidae https://github.com/webpwnized/mutillidae/blob/master/src/labs/lab-files/cross-site-request-forgery-lab-files/vote-for-nmap-onmouseover-csrf.txt&lt;br /&gt;
This script creates a form object in the background and sets some specific fields. Those fields are being sent over the URL to the voting site.&lt;br /&gt;
Because how the site is constructed, it reads the parameter from the url to decide which security tool should be voted. This means that the form object consists of some input fields and those input fields contain some values.&lt;br /&gt;
One input field is responsible for redirecting to the voting site. The other one is setting the value for security tool. A form also should have a submit button which is also set with the input fields.&lt;br /&gt;
This whole script is contained in a method. This method gets fired when you hover over the mouse. You basically save a html tag with the name of the blog but this html tag calls the method which is containing the malicious script.&lt;br /&gt;
&lt;br /&gt;
== Features ==&lt;br /&gt;
&lt;br /&gt;
* over 40 vulnerabilities (OWASP Top Ten 2007, 2010, 2013 and 2017[https://owasp.org/www-project-top-ten/])&lt;br /&gt;
* Actually Vulnerable&lt;br /&gt;
* Simple Intallation and Maintaining&lt;br /&gt;
* User can switch between 3 security levels (no security, Client-side Security, Server-side Security)&lt;br /&gt;
* Used in web security courses&lt;br /&gt;
* Tutorials and Guides included in Application&lt;br /&gt;
* Updated frequently&lt;br /&gt;
&lt;br /&gt;
== Interface ==&lt;br /&gt;
[[File:Mutillidae-Interface.png]]&lt;br /&gt;
&lt;br /&gt;
By clicking on any Item on the right dropdown menu, you can select any of the OWASP Top Ten Challanges from the last 15 years.&lt;br /&gt;
&lt;br /&gt;
* Hints and Videos - leads you directly to a structured guide how the exercise could be completed.&lt;br /&gt;
* Toggle Security - you can choose between 3 Security levels for each exercise&lt;br /&gt;
* Reset DB - Clear all user Data &lt;br /&gt;
* Labs - Study Questions associated with the Exercises&lt;br /&gt;
&lt;br /&gt;
== Examples of Vulnerabilities ==&lt;br /&gt;
&lt;br /&gt;
* SQL Injections (SQLi)[https://wiki.elvis.science/index.php?title=SQL_Injection]&lt;br /&gt;
* Cross-Site-Scripting [https://wiki.elvis.science/index.php?title=Cross-Site-Scripting_(XSS)]&lt;br /&gt;
* Sensitive Data Exposure&lt;br /&gt;
* other Injection (CSS, HTML, JavaScript)&lt;br /&gt;
* and many more...&lt;br /&gt;
&lt;br /&gt;
== Comparable Vulnerable Web Applications ==&lt;br /&gt;
&lt;br /&gt;
* WebGoat [https://wiki.elvis.science/index.php?title=WebGoat]&lt;br /&gt;
* bWAPP [https://wiki.elvis.science/index.php?title=BWAPP]&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Apache Webserver&lt;br /&gt;
* Database (MySQL/MariaDb)&lt;br /&gt;
* Packages: Sourcecode from git (https://github.com/webpwnized/mutillidae)&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
test&lt;br /&gt;
* Install Apache Webserver on your local Machine&lt;br /&gt;
* Install PHP on your local Machine&lt;br /&gt;
* Install a supported Database (e.g. MySQL, MariaDB) (This installationguide will cover MySQL)&lt;br /&gt;
* Install three PHP Libraries (php-xml, php-curl, php-mbstring)&lt;br /&gt;
* Install Git&lt;br /&gt;
&lt;br /&gt;
If you have a XAMPP/LAMPP stack set up aleady, you might skip directly to installing Mutillidae. Alternativly you can also use a docker build to run Mutillidae.&lt;br /&gt;
There is a Videoseries from the creator which gives a Step-by-Step video tutorialfor the installation.&lt;br /&gt;
&lt;br /&gt;
=== Installing Mutillidae ===&lt;br /&gt;
&lt;br /&gt;
The first thing that will be installed, is an Apache Webserver. In oder to do that, run this command:&lt;br /&gt;
&lt;br /&gt;
* sudo apt install apache2 -y&lt;br /&gt;
&lt;br /&gt;
Afterwards run this command, in order to allow URL_Rewrites.&lt;br /&gt;
&lt;br /&gt;
* sudo a2enmod rewrite&lt;br /&gt;
&lt;br /&gt;
Restart the server then.&lt;br /&gt;
&lt;br /&gt;
* sudo systemctl restart apache2&lt;br /&gt;
&lt;br /&gt;
After the restart, go into the apache2.conf and search the &amp;lt;Directory&amp;gt;. When found, change the AllowOverride None -&amp;gt; AllowOverride All.&lt;br /&gt;
&lt;br /&gt;
* sudo nano /etc/apache2/apache2.conf&lt;br /&gt;
&lt;br /&gt;
[[File:Conf-file.PNG]]&lt;br /&gt;
&lt;br /&gt;
Afterwards restart the server and with http://ip-address-of-your-server this page should be seen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Installing Mutillidae with Metasploit ===&lt;br /&gt;
A different method for installing Mutillidae is to install Metasploit. Metasploit is a penetration testing software which inlcudes everything you need to set up and run Mutillidae.&lt;br /&gt;
This means that you don&#039;t have to install all the other components you need for example a database, because Metasploit is doing this for.&lt;br /&gt;
After installing you can use the credentials msfadmin for the username and password in order to login into Metasploit.&lt;br /&gt;
When Metasploit is running Mutillidae is also accessible and for that you use the ip address of the machine where Metasploit is running on.&lt;br /&gt;
To look up the ip address you can use the &#039;ip a&#039; command in the CLI to find the ip address.&lt;br /&gt;
Sometimes it happens that Mutillidae cannot access the database. This problem occurs when the database name in the config file is not set.&lt;br /&gt;
To fix this problem you have to navigate to this config file which is found in this destination &#039;/var/www/mutillidae/config.inc&#039;.&lt;br /&gt;
In this config file you change the value of the variable called &#039;$dbname&#039; to &#039;owasp10&#039;. After this configuration Mutillidae can access the database.&lt;br /&gt;
&lt;br /&gt;
[[File:Config.PNG]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://owasp.org/www-project-top-ten/&lt;br /&gt;
* https://github.com/webpwnized/mutillidae&lt;br /&gt;
* https://www.youtube.com/c/webpwnized/featured&lt;br /&gt;
* https://github.com/webpwnized/mutillidae/blob/master/README-INSTALLATION.md Step-by-Step video tutorial&lt;br /&gt;
&lt;br /&gt;
Internal Links&lt;br /&gt;
* https://wiki.elvis.science/index.php?title=SQL_Injection&lt;br /&gt;
* https://wiki.elvis.science/index.php?title=Cross-Site-Scripting_(XSS)&lt;br /&gt;
* https://wiki.elvis.science/index.php?title=SQL_Injection_Examples_on_Known_Vulnerable_Web_Applications&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>MVucinic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=OWASP_Mutillidae_(2021)&amp;diff=17271</id>
		<title>OWASP Mutillidae (2021)</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=OWASP_Mutillidae_(2021)&amp;diff=17271"/>
		<updated>2024-12-17T20:17:54Z</updated>

		<summary type="html">&lt;p&gt;MVucinic: /* Installation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
OWASP Mutillidae is a free open source tool created for Pentesting of Web Applications. It is a &amp;quot;Vulnerable Web Application&amp;quot; that offers a Platform where the provided Exploits and Security flaws can be executed within a local environment. With over 40 different vulnerabilities and related training challenges, it provides a platform that shows the most common flaws of the last 15 years of web development. The main goal is to to offer security training for a wide range of uses, from teaching in classrooms to security enthusiasts exploring to functioning as testing ground for vulnerability assessment targets. The vulnerabilities shown in the program are actual vulnerabilities within the application, so the application should only be run in a protected environment - such as a virtual machine. Most of the Vulnerabilities are structured around the OWASP Top Ten List[https://wiki.elvis.science/index.php?title=Thread_Modelling#Top_10_Web_Application_Security_Risks]. The current Version Mutillidae II was created by Jeremy Druin [https://www.youtube.com/c/webpwnized/featured] (pseudonym: webpwnized), who also created the Tutorials for the Challanges and Installation Guides. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How it Operates ==&lt;br /&gt;
&lt;br /&gt;
Every Vulnerability contained in the application is build in within a Webpage. By selecting the Exploit from a List (e.g. Authentication Bypass) a site with the corresponding explotable Webpage is loaded and ready to get &amp;quot;hacked&amp;quot;. Since everything run at your local machine you can not harm anyone. The data such as &amp;quot;User Data&amp;quot; are stored in a Database which you set up when you install the Application (see Installation for more Information).&lt;br /&gt;
&lt;br /&gt;
[[File:Muti-Dropdown.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== A1 SQL Injection Example ==&lt;br /&gt;
[[SQL_Injection]]-&amp;gt; SQLi Extract Data&lt;br /&gt;
&lt;br /&gt;
Now here is a short example how one vulnerability exploit could look like. In this case there is a query where user can request their userinformation by providing their credentials.&lt;br /&gt;
&lt;br /&gt;
[[File:Mutillidae-login.png]]&lt;br /&gt;
&lt;br /&gt;
Normally the query should only retrun only on record when correct credentials are entered.&lt;br /&gt;
&lt;br /&gt;
But this website is totally unsecure so we can easily rewrite the SQL query to give us a list of every user in the database. But how can we do this?&lt;br /&gt;
&lt;br /&gt;
===Step 1:===&lt;br /&gt;
get an Exception by typing in invalid characters such as (&#039;, #, --)&lt;br /&gt;
&lt;br /&gt;
[[File:Mutillidae-Exception.png]]&lt;br /&gt;
&lt;br /&gt;
===Step 2:===&lt;br /&gt;
&lt;br /&gt;
Since we got an error message with the syntax how the sql statement is written we can alter the statement by simply put another statement in the form.&lt;br /&gt;
&lt;br /&gt;
In this case i wrote ’OR 1# in the username fields to alter the query which should be now&lt;br /&gt;
&lt;br /&gt;
SELECT * FROM acccounts where username= ’ ’OR 1# AND password = ’’&lt;br /&gt;
&lt;br /&gt;
1 means true in SQL language and # is a comment so it ignores the password query. So our SQL String says now that it should gives as all datasets for which the condition is true which lead to following output:&lt;br /&gt;
&lt;br /&gt;
[[File:Mutillidae-Extract-Data.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== A5 Cross-Site-Request Forgery Example ==&lt;br /&gt;
[[Cross-Site-Request_Forgery_(CSRF)]]-&amp;gt; Cross-Site-Request Forgery&lt;br /&gt;
This example can be found in the A5 section from the Owasp Top 10 examples, which is called &#039;Add to your blog&#039;.&lt;br /&gt;
Here we simulating an attack to vote for a security tool but without actually voting for it.&lt;br /&gt;
In the screenshot below you can see the site which we are attacking. So this site is basically the good site.&lt;br /&gt;
&lt;br /&gt;
[[File:UserPoll.PNG]]&lt;br /&gt;
&lt;br /&gt;
The evil site is in this case the &#039;Add to your blog&#039; site. Users can save a blog to a blog table. An attacker can you use this mechanism to manipulate a blog to fire an action.&lt;br /&gt;
Instead of a normal blog you can also add a script to the blog table. This script calls a method when you hover over the blog and it redirects to the voting site and votes for a security tool.&lt;br /&gt;
&lt;br /&gt;
[[File:Blogs.PNG]]&lt;br /&gt;
&lt;br /&gt;
The script can be found on the official github website for Mutillidae https://github.com/webpwnized/mutillidae/blob/master/src/labs/lab-files/cross-site-request-forgery-lab-files/vote-for-nmap-onmouseover-csrf.txt&lt;br /&gt;
This script creates a form object in the background and sets some specific fields. Those fields are being sent over the URL to the voting site.&lt;br /&gt;
Because how the site is constructed, it reads the parameter from the url to decide which security tool should be voted. This means that the form object consists of some input fields and those input fields contain some values.&lt;br /&gt;
One input field is responsible for redirecting to the voting site. The other one is setting the value for security tool. A form also should have a submit button which is also set with the input fields.&lt;br /&gt;
This whole script is contained in a method. This method gets fired when you hover over the mouse. You basically save a html tag with the name of the blog but this html tag calls the method which is containing the malicious script.&lt;br /&gt;
&lt;br /&gt;
== Features ==&lt;br /&gt;
&lt;br /&gt;
* over 40 vulnerabilities (OWASP Top Ten 2007, 2010, 2013 and 2017[https://owasp.org/www-project-top-ten/])&lt;br /&gt;
* Actually Vulnerable&lt;br /&gt;
* Simple Intallation and Maintaining&lt;br /&gt;
* User can switch between 3 security levels (no security, Client-side Security, Server-side Security)&lt;br /&gt;
* Used in web security courses&lt;br /&gt;
* Tutorials and Guides included in Application&lt;br /&gt;
* Updated frequently&lt;br /&gt;
&lt;br /&gt;
== Interface ==&lt;br /&gt;
[[File:Mutillidae-Interface.png]]&lt;br /&gt;
&lt;br /&gt;
By clicking on any Item on the right dropdown menu, you can select any of the OWASP Top Ten Challanges from the last 15 years.&lt;br /&gt;
&lt;br /&gt;
* Hints and Videos - leads you directly to a structured guide how the exercise could be completed.&lt;br /&gt;
* Toggle Security - you can choose between 3 Security levels for each exercise&lt;br /&gt;
* Reset DB - Clear all user Data &lt;br /&gt;
* Labs - Study Questions associated with the Exercises&lt;br /&gt;
&lt;br /&gt;
== Examples of Vulnerabilities ==&lt;br /&gt;
&lt;br /&gt;
* SQL Injections (SQLi)[https://wiki.elvis.science/index.php?title=SQL_Injection]&lt;br /&gt;
* Cross-Site-Scripting [https://wiki.elvis.science/index.php?title=Cross-Site-Scripting_(XSS)]&lt;br /&gt;
* Sensitive Data Exposure&lt;br /&gt;
* other Injection (CSS, HTML, JavaScript)&lt;br /&gt;
* and many more...&lt;br /&gt;
&lt;br /&gt;
== Comparable Vulnerable Web Applications ==&lt;br /&gt;
&lt;br /&gt;
* WebGoat [https://wiki.elvis.science/index.php?title=WebGoat]&lt;br /&gt;
* bWAPP [https://wiki.elvis.science/index.php?title=BWAPP]&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Apache Webserver&lt;br /&gt;
* Database (MySQL/MariaDb)&lt;br /&gt;
* Packages: Sourcecode from git (https://github.com/webpwnized/mutillidae)&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
test&lt;br /&gt;
* Install Apache Webserver on your local Machine&lt;br /&gt;
* Install PHP on your local Machine&lt;br /&gt;
* Install a supported Database (e.g. MySQL, MariaDB) (This installationguide will cover MySQL)&lt;br /&gt;
* Install three PHP Libraries (php-xml, php-curl, php-mbstring)&lt;br /&gt;
* Install Git&lt;br /&gt;
&lt;br /&gt;
If you have a XAMPP/LAMPP stack set up aleady, you might skip directly to installing Mutillidae. Alternativly you can also use a docker build to run Mutillidae.&lt;br /&gt;
There is a Videoseries from the creator which gives a Step-by-Step video tutorialfor the installation.&lt;br /&gt;
&lt;br /&gt;
=== Installing Mutillidae ===&lt;br /&gt;
&lt;br /&gt;
The first thing that will be installed, is an Apache Webserver. In oder to do that, run this command:&lt;br /&gt;
&lt;br /&gt;
* sudo apt install apache2 -y&lt;br /&gt;
&lt;br /&gt;
Afterwards run this command, in order to allow URL_Rewrites.&lt;br /&gt;
&lt;br /&gt;
* sudo a2enmod rewrite&lt;br /&gt;
&lt;br /&gt;
Restart the server then.&lt;br /&gt;
&lt;br /&gt;
* sudo systemctl restart apache2&lt;br /&gt;
&lt;br /&gt;
After the restart, go into the apache2.conf and search the &amp;lt;Directory&amp;gt;. When found, change the AllowOverride None -&amp;gt; AllowOverride All.&lt;br /&gt;
&lt;br /&gt;
* sudo nano /etc/apache2/apache2.conf&lt;br /&gt;
&lt;br /&gt;
[[File:Conf-file.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Installing Mutillidae with Metasploit ===&lt;br /&gt;
A different method for installing Mutillidae is to install Metasploit. Metasploit is a penetration testing software which inlcudes everything you need to set up and run Mutillidae.&lt;br /&gt;
This means that you don&#039;t have to install all the other components you need for example a database, because Metasploit is doing this for.&lt;br /&gt;
After installing you can use the credentials msfadmin for the username and password in order to login into Metasploit.&lt;br /&gt;
When Metasploit is running Mutillidae is also accessible and for that you use the ip address of the machine where Metasploit is running on.&lt;br /&gt;
To look up the ip address you can use the &#039;ip a&#039; command in the CLI to find the ip address.&lt;br /&gt;
Sometimes it happens that Mutillidae cannot access the database. This problem occurs when the database name in the config file is not set.&lt;br /&gt;
To fix this problem you have to navigate to this config file which is found in this destination &#039;/var/www/mutillidae/config.inc&#039;.&lt;br /&gt;
In this config file you change the value of the variable called &#039;$dbname&#039; to &#039;owasp10&#039;. After this configuration Mutillidae can access the database.&lt;br /&gt;
&lt;br /&gt;
[[File:Config.PNG]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://owasp.org/www-project-top-ten/&lt;br /&gt;
* https://github.com/webpwnized/mutillidae&lt;br /&gt;
* https://www.youtube.com/c/webpwnized/featured&lt;br /&gt;
* https://github.com/webpwnized/mutillidae/blob/master/README-INSTALLATION.md Step-by-Step video tutorial&lt;br /&gt;
&lt;br /&gt;
Internal Links&lt;br /&gt;
* https://wiki.elvis.science/index.php?title=SQL_Injection&lt;br /&gt;
* https://wiki.elvis.science/index.php?title=Cross-Site-Scripting_(XSS)&lt;br /&gt;
* https://wiki.elvis.science/index.php?title=SQL_Injection_Examples_on_Known_Vulnerable_Web_Applications&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>MVucinic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Conf-file.PNG&amp;diff=17270</id>
		<title>File:Conf-file.PNG</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Conf-file.PNG&amp;diff=17270"/>
		<updated>2024-12-17T20:16:20Z</updated>

		<summary type="html">&lt;p&gt;MVucinic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>MVucinic</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=OWASP_Mutillidae_(2021)&amp;diff=17267</id>
		<title>OWASP Mutillidae (2021)</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=OWASP_Mutillidae_(2021)&amp;diff=17267"/>
		<updated>2024-12-17T20:14:57Z</updated>

		<summary type="html">&lt;p&gt;MVucinic: /* Installation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
&lt;br /&gt;
OWASP Mutillidae is a free open source tool created for Pentesting of Web Applications. It is a &amp;quot;Vulnerable Web Application&amp;quot; that offers a Platform where the provided Exploits and Security flaws can be executed within a local environment. With over 40 different vulnerabilities and related training challenges, it provides a platform that shows the most common flaws of the last 15 years of web development. The main goal is to to offer security training for a wide range of uses, from teaching in classrooms to security enthusiasts exploring to functioning as testing ground for vulnerability assessment targets. The vulnerabilities shown in the program are actual vulnerabilities within the application, so the application should only be run in a protected environment - such as a virtual machine. Most of the Vulnerabilities are structured around the OWASP Top Ten List[https://wiki.elvis.science/index.php?title=Thread_Modelling#Top_10_Web_Application_Security_Risks]. The current Version Mutillidae II was created by Jeremy Druin [https://www.youtube.com/c/webpwnized/featured] (pseudonym: webpwnized), who also created the Tutorials for the Challanges and Installation Guides. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How it Operates ==&lt;br /&gt;
&lt;br /&gt;
Every Vulnerability contained in the application is build in within a Webpage. By selecting the Exploit from a List (e.g. Authentication Bypass) a site with the corresponding explotable Webpage is loaded and ready to get &amp;quot;hacked&amp;quot;. Since everything run at your local machine you can not harm anyone. The data such as &amp;quot;User Data&amp;quot; are stored in a Database which you set up when you install the Application (see Installation for more Information).&lt;br /&gt;
&lt;br /&gt;
[[File:Muti-Dropdown.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== A1 SQL Injection Example ==&lt;br /&gt;
[[SQL_Injection]]-&amp;gt; SQLi Extract Data&lt;br /&gt;
&lt;br /&gt;
Now here is a short example how one vulnerability exploit could look like. In this case there is a query where user can request their userinformation by providing their credentials.&lt;br /&gt;
&lt;br /&gt;
[[File:Mutillidae-login.png]]&lt;br /&gt;
&lt;br /&gt;
Normally the query should only retrun only on record when correct credentials are entered.&lt;br /&gt;
&lt;br /&gt;
But this website is totally unsecure so we can easily rewrite the SQL query to give us a list of every user in the database. But how can we do this?&lt;br /&gt;
&lt;br /&gt;
===Step 1:===&lt;br /&gt;
get an Exception by typing in invalid characters such as (&#039;, #, --)&lt;br /&gt;
&lt;br /&gt;
[[File:Mutillidae-Exception.png]]&lt;br /&gt;
&lt;br /&gt;
===Step 2:===&lt;br /&gt;
&lt;br /&gt;
Since we got an error message with the syntax how the sql statement is written we can alter the statement by simply put another statement in the form.&lt;br /&gt;
&lt;br /&gt;
In this case i wrote ’OR 1# in the username fields to alter the query which should be now&lt;br /&gt;
&lt;br /&gt;
SELECT * FROM acccounts where username= ’ ’OR 1# AND password = ’’&lt;br /&gt;
&lt;br /&gt;
1 means true in SQL language and # is a comment so it ignores the password query. So our SQL String says now that it should gives as all datasets for which the condition is true which lead to following output:&lt;br /&gt;
&lt;br /&gt;
[[File:Mutillidae-Extract-Data.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== A5 Cross-Site-Request Forgery Example ==&lt;br /&gt;
[[Cross-Site-Request_Forgery_(CSRF)]]-&amp;gt; Cross-Site-Request Forgery&lt;br /&gt;
This example can be found in the A5 section from the Owasp Top 10 examples, which is called &#039;Add to your blog&#039;.&lt;br /&gt;
Here we simulating an attack to vote for a security tool but without actually voting for it.&lt;br /&gt;
In the screenshot below you can see the site which we are attacking. So this site is basically the good site.&lt;br /&gt;
&lt;br /&gt;
[[File:UserPoll.PNG]]&lt;br /&gt;
&lt;br /&gt;
The evil site is in this case the &#039;Add to your blog&#039; site. Users can save a blog to a blog table. An attacker can you use this mechanism to manipulate a blog to fire an action.&lt;br /&gt;
Instead of a normal blog you can also add a script to the blog table. This script calls a method when you hover over the blog and it redirects to the voting site and votes for a security tool.&lt;br /&gt;
&lt;br /&gt;
[[File:Blogs.PNG]]&lt;br /&gt;
&lt;br /&gt;
The script can be found on the official github website for Mutillidae https://github.com/webpwnized/mutillidae/blob/master/src/labs/lab-files/cross-site-request-forgery-lab-files/vote-for-nmap-onmouseover-csrf.txt&lt;br /&gt;
This script creates a form object in the background and sets some specific fields. Those fields are being sent over the URL to the voting site.&lt;br /&gt;
Because how the site is constructed, it reads the parameter from the url to decide which security tool should be voted. This means that the form object consists of some input fields and those input fields contain some values.&lt;br /&gt;
One input field is responsible for redirecting to the voting site. The other one is setting the value for security tool. A form also should have a submit button which is also set with the input fields.&lt;br /&gt;
This whole script is contained in a method. This method gets fired when you hover over the mouse. You basically save a html tag with the name of the blog but this html tag calls the method which is containing the malicious script.&lt;br /&gt;
&lt;br /&gt;
== Features ==&lt;br /&gt;
&lt;br /&gt;
* over 40 vulnerabilities (OWASP Top Ten 2007, 2010, 2013 and 2017[https://owasp.org/www-project-top-ten/])&lt;br /&gt;
* Actually Vulnerable&lt;br /&gt;
* Simple Intallation and Maintaining&lt;br /&gt;
* User can switch between 3 security levels (no security, Client-side Security, Server-side Security)&lt;br /&gt;
* Used in web security courses&lt;br /&gt;
* Tutorials and Guides included in Application&lt;br /&gt;
* Updated frequently&lt;br /&gt;
&lt;br /&gt;
== Interface ==&lt;br /&gt;
[[File:Mutillidae-Interface.png]]&lt;br /&gt;
&lt;br /&gt;
By clicking on any Item on the right dropdown menu, you can select any of the OWASP Top Ten Challanges from the last 15 years.&lt;br /&gt;
&lt;br /&gt;
* Hints and Videos - leads you directly to a structured guide how the exercise could be completed.&lt;br /&gt;
* Toggle Security - you can choose between 3 Security levels for each exercise&lt;br /&gt;
* Reset DB - Clear all user Data &lt;br /&gt;
* Labs - Study Questions associated with the Exercises&lt;br /&gt;
&lt;br /&gt;
== Examples of Vulnerabilities ==&lt;br /&gt;
&lt;br /&gt;
* SQL Injections (SQLi)[https://wiki.elvis.science/index.php?title=SQL_Injection]&lt;br /&gt;
* Cross-Site-Scripting [https://wiki.elvis.science/index.php?title=Cross-Site-Scripting_(XSS)]&lt;br /&gt;
* Sensitive Data Exposure&lt;br /&gt;
* other Injection (CSS, HTML, JavaScript)&lt;br /&gt;
* and many more...&lt;br /&gt;
&lt;br /&gt;
== Comparable Vulnerable Web Applications ==&lt;br /&gt;
&lt;br /&gt;
* WebGoat [https://wiki.elvis.science/index.php?title=WebGoat]&lt;br /&gt;
* bWAPP [https://wiki.elvis.science/index.php?title=BWAPP]&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Apache Webserver&lt;br /&gt;
* Database (MySQL/MariaDb)&lt;br /&gt;
* Packages: Sourcecode from git (https://github.com/webpwnized/mutillidae)&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
test&lt;br /&gt;
* Install Apache Webserver on your local Machine&lt;br /&gt;
* Install PHP on your local Machine&lt;br /&gt;
* Install a supported Database (e.g. MySQL, MariaDB) (This installationguide will cover MySQL)&lt;br /&gt;
* Install three PHP Libraries (php-xml, php-curl, php-mbstring)&lt;br /&gt;
* Install Git&lt;br /&gt;
&lt;br /&gt;
If you have a XAMPP/LAMPP stack set up aleady, you might skip directly to installing Mutillidae. Alternativly you can also use a docker build to run Mutillidae.&lt;br /&gt;
There is a Videoseries from the creator which gives a Step-by-Step video tutorialfor the installation.&lt;br /&gt;
&lt;br /&gt;
=== Installing Mutillidae ===&lt;br /&gt;
&lt;br /&gt;
The first thing that will be installed, is an Apache Webserver. In oder to do that, run this command:&lt;br /&gt;
&lt;br /&gt;
* sudo apt install apache2 -y&lt;br /&gt;
&lt;br /&gt;
Afterwards run this command, in order to allow URL_Rewrites.&lt;br /&gt;
&lt;br /&gt;
* sudo a2enmod rewrite&lt;br /&gt;
&lt;br /&gt;
Restart the server then.&lt;br /&gt;
&lt;br /&gt;
* sudo systemctl restart apache2&lt;br /&gt;
&lt;br /&gt;
After the restart, go into the apache2.conf and search the &amp;lt;Directory&amp;gt;. When found, change the AllowOverride None -&amp;gt; AllowOverride All.&lt;br /&gt;
&lt;br /&gt;
* sudo nano /etc/apache2/apache2.conf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Installing Mutillidae with Metasploit ===&lt;br /&gt;
A different method for installing Mutillidae is to install Metasploit. Metasploit is a penetration testing software which inlcudes everything you need to set up and run Mutillidae.&lt;br /&gt;
This means that you don&#039;t have to install all the other components you need for example a database, because Metasploit is doing this for.&lt;br /&gt;
After installing you can use the credentials msfadmin for the username and password in order to login into Metasploit.&lt;br /&gt;
When Metasploit is running Mutillidae is also accessible and for that you use the ip address of the machine where Metasploit is running on.&lt;br /&gt;
To look up the ip address you can use the &#039;ip a&#039; command in the CLI to find the ip address.&lt;br /&gt;
Sometimes it happens that Mutillidae cannot access the database. This problem occurs when the database name in the config file is not set.&lt;br /&gt;
To fix this problem you have to navigate to this config file which is found in this destination &#039;/var/www/mutillidae/config.inc&#039;.&lt;br /&gt;
In this config file you change the value of the variable called &#039;$dbname&#039; to &#039;owasp10&#039;. After this configuration Mutillidae can access the database.&lt;br /&gt;
&lt;br /&gt;
[[File:Config.PNG]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* https://owasp.org/www-project-top-ten/&lt;br /&gt;
* https://github.com/webpwnized/mutillidae&lt;br /&gt;
* https://www.youtube.com/c/webpwnized/featured&lt;br /&gt;
* https://github.com/webpwnized/mutillidae/blob/master/README-INSTALLATION.md Step-by-Step video tutorial&lt;br /&gt;
&lt;br /&gt;
Internal Links&lt;br /&gt;
* https://wiki.elvis.science/index.php?title=SQL_Injection&lt;br /&gt;
* https://wiki.elvis.science/index.php?title=Cross-Site-Scripting_(XSS)&lt;br /&gt;
* https://wiki.elvis.science/index.php?title=SQL_Injection_Examples_on_Known_Vulnerable_Web_Applications&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>MVucinic</name></author>
	</entry>
</feed>