0% found this document useful (0 votes)
150 views6 pages

XSS and HTML Injection Techniques

Sarthak Puri designed an experiment to simulate HTML injection and cross-site scripting (XSS) attacks. The objective was to test for vulnerabilities in websites using tools like OWASP Mutillidae II and XSS game sites. The document described how HTML injections work by sending malicious URLs to users, and how XSS attacks execute script code injected into a website. It provided examples of stored, reflected, and DOM-based XSS and steps to perform tests of these vulnerabilities. The learning outcome was a demonstration of how to identify and exploit injection vulnerabilities in real systems.

Uploaded by

Sarthak Puri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
150 views6 pages

XSS and HTML Injection Techniques

Sarthak Puri designed an experiment to simulate HTML injection and cross-site scripting (XSS) attacks. The objective was to test for vulnerabilities in websites using tools like OWASP Mutillidae II and XSS game sites. The document described how HTML injections work by sending malicious URLs to users, and how XSS attacks execute script code injected into a website. It provided examples of stored, reflected, and DOM-based XSS and steps to perform tests of these vulnerabilities. The learning outcome was a demonstration of how to identify and exploit injection vulnerabilities in real systems.

Uploaded by

Sarthak Puri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

EXPERIMENT – 1

Name – Sarthak Puri Class – 705/A


UID – 20BCS7233 Subject – web and mobile security
Semester – 5th

AIM
Design a method to simulate the html injection and cross site scripting to exploit the vulnerabilities as
attackers.

OBJECTIVE
To test HTML and XSS injection

SOFTWARE AND HARDWARE REQUIRED


Window 7 and above version

Chrome / or any other browser

TOOLS TO BE USED
OWASP Mutillidae II : web pwn in mass production

XSS game site

INTRODUCTION
Acunetix is a web-application security scanner that gives you a 360- degree various organisation’s
security .

This end-to-end web security scanner can identify vulnerabilities like XSS and misconfigurations . it
has capabilities for scanning all types of apps , complex web applications , etc.

Acunetix offers specialised technologies that let you detect more and fix faster.

HTML INJECTIONS - :
1. First attacker have to find vulnerable web application with few loop holes.
2. The attacker have to send modified URL to the user of that website by any means , like SMS or
E-mail .
3. This URL has been injected with HTML injections .
4. When user will click on that injected false URL , user will be navigated to the attacker’s webpage
which he have created
5. The attacker’s webpage looks same like original website.
6. User will enter his/her personal details like user-name , passwords , ATM card pins , etc.
7. This information will directly transferred to attackers server and he can misuse it .

CROSS SITE SCRIPTING (XSS)


• Cross-Site Scripting (XSS) attacks are a type of injection, in which malicious scripts are injected
into otherwise benign and 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.
• Flaws that allow these attacks to succeed are quite widespread and occur anywhere a web
application uses input from a user within the output it generates without validating or encoding it.
• An attacker can use XSS to send a malicious script to an unsuspecting user. The end user’s
browser has no way to know that the script should not be trusted, and will execute the script.

TYPE OF XSS-:
1. STORED XSS ->

• stored XSS, also known as Type-1 or Persistent XSS attacks, typically rely on unsanitized user
input points for scripts permanently stored on the target servers.
• Since these attacks allow malicious users to control how the browser executes a script, they can
typically facilitate a complete user account takeover.
2. REFLECTED XSS ->
• It is also known as non- persistent XSS.
• It occurs when user input is immediately returned by a web application in an error
message/search result or input provided by the user as part of the request and without permanently
storing the user provided data.
3. DOM BASED XSS ->
• DOM Based XSS is an XSS attack wherein the attack payload is executed as a result of
modifying the DOM “environment” in the victim’s browser used by the original client side script,
so that the client side code runs in an “unexpected” manner.
• That is, the page itself (the HTTP response that is) does not change, but the client side code
contained in the page executes differently due to the malicious modifications that have occurred
in the DOM environment.

STEP / METHOD / CODING


HTML INJECTIONS →

1. Open website : OWASP mutillidae II : web pwn in mass production (URL)


[Link]

2. Now we will be transferred to the website which is suffering from an HTML injection
vulnerability which allows the user to submit his entry in the blog.
3. On the left top corner , put the cursor on
• OWASP 2017 →
• A1 – injections (others)→
• HTML injections(HTMLi)→
• Add to your blog .
4. Now blog window will appear on the pc screen.

5. Now we have to try to inject malicious code in the blank spot .


Enter html code to set up html attack.
Example - :
<td/> CU blog <marquee> you are hacked </marquee>

6. The vulnerabilities is in html code . injected into application web server


Whenever the user will visit that malicious page , servers get render everytime.
XSS ATTACK

1. Open the link


url-: [Link]

you will be redirected towards a website

2. If the search field is vulnerable , when the user enters any script , then it will be executed
Enter any script in white space And search
, for example:
<script>alert(‘HELLO , YOU ARE HACKED!!!’)</script>

3. After clicking on search , the entered script will be executed .


A pop up will automatically come on pc screen . this just shows the vulnerability of the XSS
attack

LEARNING OUTCOME

• We have learned about HTML injections and how to use it in vulnerable websites and also about
XSS injections .
• We have learned how to apply these injections and attacks on real systems.
• If app or website lack proper formation or sanitization , the malicious link execute the attacker
code on the system.
• Attacker can steal all your information and can do you harm as much possible .

Common questions

Powered by AI

Tools like Acunetix, a web application security scanner, aid in detecting vulnerabilities such as XSS and HTML injection by identifying unvalidated input points and misconfigurations across various web applications. OWASP Mutillidae II is another tool that allows developers to test vulnerabilities in a controlled environment. Mitigation involves implementing input validation, encoding output, and using Content Security Policies (CSP) to prevent execution of unauthorized scripts .

Failure to address XSS vulnerabilities can result in severe real-world impacts including unauthorized access to sensitive data, theft of session cookies leading to account hijacking, spread of malware, and defacement of websites. These vulnerabilities can damage user trust, resulting in financial loss and reputational harm to affected organizations .

Websites are susceptible to HTML injection attacks primarily due to the presence of entry points that allow unsanitized user inputs to be rendered as HTML on the web page without proper validation. Attackers exploit these vulnerabilities by sending a modified URL to users containing injected HTML, which navigates users to a fake webpage. This webpage mimics the original site and can trick users into entering sensitive information that gets sent directly to the attacker’s server .

The main types of XSS attacks include Stored XSS, Reflected XSS, and DOM-Based XSS. Stored XSS involves storing malicious scripts permanently on a server through user input, affecting every user who retrieves the data. Reflected XSS occurs when input from a web request is immediately returned in response without storage, often via URL parameters or search fields. DOM-Based XSS leverages client-side scripts by manipulating the Document Object Model (DOM) itself, causing scripts to execute in unexpected ways .

While HTML injection involves inserting malicious HTML into vulnerable pages to redirect users, cross-site scripting (XSS) injects scripts instead of HTML into trusted websites, which are then executed in users' browsers. A successful XSS attack can lead to unauthorized access to user data, session cookies, and other sensitive information, as browsers fail to distinguish between trusted scripts and malicious ones .

Simulated web environments provide a crucial learning platform for understanding web vulnerabilities and prevention techniques by allowing learners to safely experiment with attacks and defenses. They promote active engagement with real-world scenarios, foster technical skills, and help in developing strategies for mitigation. This kind of experiential learning bridges the gap between theoretical knowledge and practical application, enhancing expertise in cybersecurity measures .

In DOM-based XSS, the attacker's payload alters the client-side behavior of a web application by modifying the Document Object Model (DOM)—a representation of the page content in a web browser. Unlike other types of XSS where server-side changes are involved, the browsers execute scripts differently based on DOM changes, making them vulnerable since the page itself remains unchanged. This allows attackers to run malicious code locally within the user's browser environment .

Learning HTML and XSS injections in a simulated environment like OWASP Mutillidae II provides hands-on experience with discovering and exploiting vulnerabilities, allowing individuals to understand the workings of attacks in a controlled, safe setting. This educational approach helps students grasp the consequences of security flaws and the importance of implementing safeguards, without the ethical and legal risks of real-world testing .

Attackers manipulate URLs by embedding malicious HTML code intended to mimic legitimate requests, which then redirect users to fraudulent sites. When victims click these URLs, believing them to be authentic, they are taken to a site resembling the intended destination where they might unknowingly enter sensitive information (e.g., passwords, credit card details), which are then captured by the attacker .

Executing a HTML injection attack involves several key steps: identifying a vulnerable web application with entry points that fail to sanitize input, crafting a malicious URL containing HTML code to exploit these vulnerabilities, and distributing this URL to users via email or SMS. When users click the URL, they are redirected to a mimic page where their data is collected through fields mimicking those of the authentic page, which exploits web vulnerabilities by capturing sensitive information for the attacker’s use .

You might also like