Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

[Tutorial] Cross Site Scripting (XSS)

Hello HF members, I'm Kodaz and this will be my first tutorial posted on HackForums. I want to start by saying
I am not responsible of what you use this knowledge for. This tutorial is intended for Educational purposes only.

1. Introduction
2. Finding vulnerable websites
3. Testing for Vulnerabilities
4. Types of Exploits you can execute



1. INTRODUCTION

In this tutorial you will learn about a known vulnerability in websites known as XSS.
Let's start off with the definition of Cross Site Scripting known as XSS.
XSS is a security breach that takes advantage of dynamically generated Web pages. In an XSS attack, a Web application is sent with a script that activates when it is read by an unsuspecting user s browser or by an application that has not protected itself against cross-site scripting.


2. FINDING VULNERABLE WEBSITES

Most people find these type of vulnerable websites by using Google dorks or they run scans on certain websites they are paid for to pentest with permission.
Google Dorks are basically search queries on Google that find the type of website you're looking for... For example:
[Image: 9edA3Nn.png]
As you can see i used the dork “.php?q=” and it came up with website links that finish in what i just Googled. This is an example of how to use Google Dorks.

3. TESTING FOR VULNERABILITIES

Once you get the search results on Google, You can go ahead and test to see if the website is vulnerable to XSS.
[Image: f4rcWL0.gif]
Once you enter anything on the search bar you can go ahead and do CTRL+U in your browser and it will open up view source. Or just right click anywhere and select view source.
Keep in note where your search query was placed by doing CTRL+F and searching BTS.
[Image: 4GxFYlu.gif]
So now we are going to go ahead and check if the server sanitizes our code or not. So we will type in <"script"> without quotes on the search query and once again check where the input was placed on view source.
[Image: KZ94nRc.gif]
Now we can see that the code went through without being blocked by the website. Which means we can go ahead and execute any code we want.
But first, We want to go ahead and make sure that the website is 100% vulnerable so we're just going to type in this on the search bar,
[Image: qwBowyp.gif]
If it was successful the page will follow up with a pop up that might look like this.
[Image: 5PBvRa7.gif]
Now we know the website is completely vulnerable and we can proceed to execute all type of code... Malicious or not. There is also different types of XSS which I'm going to explain now.
Persistent XSS = This type of XSS is when the script entered by the hacker is stored on the server. For example, If a person tries to access the search section it will execute the code you saved on the server on their machine and you can proceed to steal their cookies and stealing their accounts.

Non Persistent XSS = This type of XSS is also known as Reflected XSS, Which is the most common one these days. The code entered will be sent to the server as a HTTP Request, So let me explain... If you search something up on a vulnerable search bar it will come up like "search results for 'word' " If the server fails to block the entered code It will execute the injected script. However this type of XSS is not persistent which means only you can see the executed code.


4. TYPES OF EXPLOITS YOU CAN EXECUTE
Stealing identity and Confidential Data
Bypassing website restrictions Session Hijacking
Malware attack Website Defacement
DoS attack



Thank you all for reading and I hope I was of help to somebody in the community.
If you liked it please let me know in the comments and i will continue to write more tutorials.
This tutorial seems very noob friendly.
Anyone can do this to be honest by reading this tutorial.
Thanks for this information you contributed to the community.
(Jan 30, 2017 06:03 PM)Megabear Wrote:  This tutorial seems very noob friendly.
Anyone can do this to be honest by reading this tutorial.
Thanks for this information you contributed to the community.

I really appreciate your feedback, I will definitely continue to make more tutorials! :)
Excellent job Kodaz. You pretty much cover the basics for people to understand what XSS is and how does it work.
(Jan 30, 2017 06:06 PM)Mycroft Holmes Wrote:  Excellent job Kodaz. You pretty much cover the basics for people to understand what XSS is and how does it work.

Appreciate it and, Yes sir, it was actually what I aimed to do.
A bit basic but I got to say that I really enjoyed how you formatted this. Keep up the work, dude (Yes, I stalked your profile and found this post :P )
My hat used to be somewhere along the border of being grey but over the past few years, I realized my calling is to learn and help others out in ways that I can ethically. Learn as much as you can, experience, grow, educate, and throw yourself in uncomfortable situations.
Keep up the good bru,ilearned alot
Thanks for the feedback guys. I hope i helped :)
Great tutorial, Very noob friendly and easy to follow. Its great that you added the images as well.
(Feb 1, 2017 11:01 AM)SpeedDemonx Wrote:  Great tutorial, Very noob friendly and easy to follow. Its great that you added the images as well.

Thank you, Appreciate your feedback.
Well done brother. This helped me a lot
(Feb 1, 2017 08:09 PM)EvilL0rd Wrote:  Well done brother. This helped me a lot

I'm glad it did. Thank you
Baha I am referring people to this thread from now on, So easy for noobs to understand.

Thanks OP
(Feb 2, 2017 12:51 PM)Mr. Robot Wrote:  Baha I am referring people to this thread from now on, So easy for noobs to understand.

Thanks OP

Awesome Mr. Robot, Thanks for the feedback... Would be glad to work with you ;)
Dude, how can I create a site which recives their cookies?


Possibly Related Threads...
Thread / Author Replies Views Last Post
by ~[DogiD]~Jul 2, 2023 09:34 AM 74 12,742 Jul 2, 2023 09:34 AM
Last Post: SIM-5382664
by zer0pwnSep 1, 2022 05:10 AM 548 66,973 Sep 1, 2022 05:10 AM
Last Post: KeyToSuccess
by BodluxJul 12, 2020 01:12 PM 0 349 Jul 12, 2020 01:12 PM
Last Post: Bodlux