Xampp & XSS Attacks

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10
At a glance
Powered by AI
XAMPP is a free and open source cross-platform web server solution stack package that contains Apache HTTP Server, MySQL database, and interpreters for scripts written in languages like PHP and Perl.

The main components of XAMPP are Apache, MySQL/MariaDB, PHP, and Perl.

The three main types of XSS attacks are reflected XSS, stored XSS, and DOM-based XSS.

Web Server XAMPP

XAMPP is the title used for a compilation of free software. The name is an acronym, with
each letter representing one of the five key components. The software packet contains the
web server Apache, the relational database management system MySQL (or MariaDB), and
the scripting languages Perl and PHP. The initial X stands for the operating systems that it
works with: Linux, Windows, and Mac OS X.

• Apache: The open source web server Apache is the most widely used server
worldwide for delivery of web content. The server application is made available as a
free software by the Apache Software Foundation.

• MySQL/MariaDB: in MySQL, XAMPP contains one of the most popular relational


database management systems in the world. In combination with the web server
Apache and the scripting language PHP, MySQL offers data storage for web services.
Current XAMPP versions have replaced MySQL with MariaDB (a community-
developed fork of the MySQL project, made by the original developers).

• PHP: the server-side programming language PHP enables users to create dynamic
websites or applications. PHP can be installed on all platforms and supports a number
of diverse database systems.

• Perl: the scripting language Perl is used in system administration, web development,
and network programming. Like PHP, Perl also enables users to program dynamic
web applications.

Alongside these core components, this free-to-use Apache distribution contains some other
useful tools, which vary depending on your operating system. These tools include the mail
server Mercury, the database administration tool phpMyAdmin, the web analytics software
solutions Webalizer, OpenSSL, and Apache Tomcat, and the FTP servers FileZilla or
ProFTPd.

The XAMPP Control Panel


Controls for the individual components of your test server can be reached through the
XAMPP Control Panel. The clear user interface logs all actions and allows you to start or
stop individual modules with a single. The XAMPP Control Panel also offers you various
other buttons, including:

• Config: allows you to configure the XAMPP as well as the individual components
• Netstat: shows all running processes on the local computer
• Shell: opens a UNIX shell
• Explorer: opens the XAMPP folder in Windows Explorer
• Services: shows all services currently running in the background
• Help: offers links to user forums
• Quit: closes the XAMPP Control Panel
In the Control Panel, you can start and stop individual modules

Download and place DVWA -Master folder in htdocs in Xampp folder which is in C:/ by default

. Open browser and enter localhost as 127.0.0.1:80

Then browser window will like above.

To fix the issue need to rename


config.inc.php.dist to config.inc.php in
C:/xampp/htdocs/config

Restart the servers in Xampp and then open


the localhost.

Type 127.0.0.1:80 then enter into DVWA


website and enter with

username: admin and password: password

Cross-Site Scripting (XSS) attacks are a type of injection, in which malicious scripts are injected into
trusted websites. XSS attacks occur when an attacker uses a web application to send malicious code,
generally in the form of a browser side script, to a different end user. The end user’s browser has no
way to know that the script should not be trusted, and will execute the script. Because it thinks the
script came from a trusted source, the malicious script can access any cookies, session tokens, or
other sensitive information retained by the browser and used with that site
Now have a look over a small script which would generate an alert window. So in the text area given
for message I will inject the script which gets stored in the server.

A small script which would generate an alert window. So in the text area given for message I will
inject the script which gets stored in the server.

SQL Injection with XSS

It might be possible that the web application server has more than one vulnerabilities, let
assume if it is also having SQL injection vulnerability then it becomes very easy for an
attacker to retrieve the data from its database using stolen cookies.
For example in DVWA I switch from XSS to SQL injection; now copy its URL with user
ID=1.

Types of Cross Site Scripting Attacks


The prime purpose of performing XSS attack is to steal other person’s identity. As
mentioned, it may be cookies, session tokens, etc. XSS also may be used to display faked
pages or forms for the victim. However, this attack can be performed in several ways.

This attack is divided into three main categories as shown below:

1) Reflected XSS – This attack occurs, when a malicious script is not being saved on the web
server but reflected in the website’s results.
2) Stored XSS – This attack occurs when a malicious script is being saved on the web server
permanently.
3) DOM – This occurs, when the DOM environment is being changed, but the code remains
the same.

1) Reflected XSS

This occurs when the malicious results are being returned after entering the malicious code.
Reflected XSS code is not being saved permanently. In this case, the malicious code is being
reflected in any website result. The attack code can be included in the faked URL or HTTP
parameters.

It can affect the victim in different ways – by displaying faked malicious page or by sending
a malicious email.
Example:

First, ensure that Burp is correctly configured with your browser.

With intercept turned off in the Proxy "Intercept" tab, visit the web application you are
testing in your browser.

Visit the page of the website you wish to test for XSS vulnerabilities.

Return to Burp.

In the Proxy "Intercept" tab, ensure "Intercept is on"


Go to the "Repeater" tab.

Here we can input various XSS payloads


into the input field.

We can test various inputs by editing the


"Value" of the appropriate parameter in the
"Raw" or "Params" tabs.

A simple payload such as <s> can often be


used to check for issues.

In this example we have used a payload that attempts to perform a proof of concept pop up in
our browser.

Click "Go".

We can assess whether the attack


payload appears unmodified in the
response. If so, the application is
almost certainly vulnerable to XSS.

You can find the response quickly


using the search bar at the bottom of
the response panel.

The highlighted text is the result of


our search.
Right click on the response to
bring up the context menu.

Click "Show response in browser"


to copy the URL.

You can also use "Copy URL" or


"Request in browser".

In the pop up window, click "Copy".

Copy the URL in to your browser's


address bar.

In this example we were able to produce a proof of


concept for the vulnerability.

Persistent XSS

Consider a web application


that allows users to enter a
username that is displayed on
each user’s profile page. The
application stores each
username in a local database.
A malicious user notices that
the web application fails to
sanitize the username field
and inputs malicious
JavaScript code as part of
their username. When other users view the attacker’s profile page, the malicious code
automatically executes in the context of their session.
2) Stored XSS

This attack can be considered riskier and it provides more damage.

In this type of attack, the malicious code or script is being saved on the web server (for
example, in the database) and executed every time when the users will call the appropriate
functionality. This way stored XSS attack can affect many users. Also as the script is being
stored on the web server, it will affect the website for a longer time.

To successfully execute a stored XSS attack, a perpetrator has to locate a vulnerability in a


web application and then inject malicious script into its server (e.g., via a comment field).

One of the most frequent targets are websites that allow users to share content, including
blogs, social networks, video sharing platforms and message boards. Every time the infected
page is viewed, the malicious script is transmitted to the victim’s

Stored cross-site scripting (also known as second-order or persistent XSS) arises when an
application receives data from an untrusted source and includes that data within its later
HTTP responses in an unsafe way.

Suppose a website allows users to submit comments on blog posts, which are displayed to
other users. Users submit comments using an HTTP request like the following:

POST /post/comment HTTP/1.1


Host: vulnerable-website.com
Content-Length: 100

postId=3&comment=This+post+was+extremely+helpful.&name=Carlos+Montoya&email=
carlos%40normal-user.net

After this comment has been submitted, any user who visits the blog post will receive the
following within the application's response:

<p>This post was extremely helpful.</p>


Assuming the application doesn't perform any other processing of the data, an attacker can
submit a malicious comment like this:

<script>/* Bad stuff here... */</script>

Within the attacker's request, this comment would be URL-encoded as:

comment=%3Cscript%3E%2F*%2BBad%2Bstuff%2Bhere...%2B*%2F%3C%2Fscript%3
E

Any user who visits the blog post will now receive the following within the application's
response:

<p><script>/* Bad stuff here... */</script></p>

The script supplied by the attacker will then execute in the victim user's browser, in the
context of their session with the application.

#3) DOM XSS

This type of attack occurs when the DOM environment is being changed, but the client-side
code does not change. When the DOM environment is being modified in the victim’s
browser, then the client side code executes differently.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy