Cross Site Scripting(XSS) Complete Tutorial for Beginners

Posted by Kill3r On Sunday 1 September 2013 2 comments
XSS,cross site scripting,website defacing
What is XSS?

Cross Site Scripting (XSS) , is one of the most common web application vulnerability that allows an attacker to run his own client side scripts(especially JavaScript) into web pages viewed by other users.

In a typical XSS attack, a hacker inject his malicious JavaScript code in the legitimate website . When a user visit the specially-crafted link , it will execute the malicious JavaScript. A successfully exploited XSS vulnerability will allow attackers to do phishing attacks, steal accounts and even worms.

XSS Attack:

Step 1: Finding Vulnerable Website

Hackers use google dork for finding the vulnerable sites for instance  "?search=" or ".php?q=" .

Step 2: Testing the Vulnerability
 
First of all, we have to find a input field so that we can inject our own script, for example: search box, username,password or any other input fields.

Test :
Now we are going to check whether the server sanitize our input or not.  In order to do this , let us input the <script> tag inside the input field.

View the source of the page

That's good server is sanitizing our input.

Step 3: Exploiting the vulnerability

Now we know the site is somewhat vulnerable to XSS attack.  But let us make sure whether the site is completely vulnerable to this attack by injecting a full JavaScript code.  For instance, let us input <script>alert('HCB')</script> .
Now it will display pop-up box with 'BTS' string. Finally, we successfully exploit the XSS .  By extending the code with malicious script, a hacker can do steal cookies or deface the site and more.




Types of XSS Based on persisting capability:

Based one Persistence capability, we can categorize the XSS attack into two types namely Persistent and Non-Persistent.

Persistent XSS:

The Persistent or Stored XSS attack occurs when the malicious code submitted by attacker is saved by the server in the database, and then permanently it will be run in the normal page.

For Example:  
Many websites host a support forum where registered users can ask their doubts by posting message, which are stored in the database.  Let us imagine , An attacker post a message containing malicious JavaScript code instead.  If the server fail to sanitize the input provided, it results in execution of injected script.  The code will be executed whenever a user try to read the post. If suppose the injected code is cookie stealing code, then it will steal cookie of users who read the post. Using the cookie, attacker can take control of your account.


Non-Persistent XSS:

Non-Persistent XSS, also referred as Reflected XSS , is the most common type of XSS found now a days. In this type of attack, the injected code will be send to the server via HTTPrequest.  The server embedded the input with the html file and return the file(HTTPResponse) to browser.  When the browser executes the HTML file, it also execute the embedded script.  This kind of XSS vulnerability frequently occur in search fields.

Example:
Let us consider a project hosting website.  To find our favorite project, we will just input the related-word in the search box .  When searching is finished, it will display a message like this "search results for your word " .  If the server fail to sanitize the input properly, it will results in execution of injected script.

In case of reflected XSS attacks, attacker will send the specially-crafted link to victims and trick them into click the link. When user click the link, the browser will send the injected code to server, the server reflects the attack back to the users' browser.  The browser then executes the code .

What can an attacker do with this Vulnerability?

Stealing the Identity and Confidential Data(credit card details).
Bypassing restriction in websites.
Session Hijacking(Stealing session)
Malware Attack
Website Defacement
Denial of Service attacks(Dos)

Reference: breakthesecurity.com


2 comments:

No Name said...

FULLZ AVAILABLE WITH HIGH CREDIT SCORES 700+
(Spammed From Credit Bureau of USA)

=>Contact 24/7<=

Telegram> @leadsupplier
ICQ> 752822040
Email> exploit.tools4u@gmail.com

FRESHLY SPAMMED
VALID INFO WITH VALID DL EXPIRIES

*All info included*
NAME+SSN+DOB+DL+DL-STATE+ADDRESS

Employee & Bank details included
CC & CVV'S ONLY USA $8 FOR EACH

$1 for SSN+DOB
$2 for SSN+DOB+DL
$5 for High credit fullz 700+
(bulk order negotiable)
*Payment in all crypto currencies will be accepted

->You can buy few for testing
->Invalid or wrong info will be replaced
->Serious buyers needed for long term
->Very fast delivery

PLEASE DON'T ASK ANYTHING FOR FREE

TOOLS & TUTORIALS AVAILABLE FOR SPAMMING & HACKING

(Carding, spamming, hacking, scam page, Cash outs, dumps cash outs)

SQL Injector = 250$
Premium Accounts (Netflix, coinbase, FedEx, Pornhub, etc) =25$
Paypal Logins = 150$ (10 Logins)
Bitcoin Cracker = 500$
SMTP Linux Root = 300$
DUMPS with pins track 1 and 2 = 85$
Socks, rdp's, vpn = 25$
Php mailer = 25$
Server I.P's = 100$ (1k ip's)
HQ Emails with passwords = 100$ (1k emails+pass)

*If you need a valid vendor it's very prime chance, you'll never be disappointed*

Telegram> @leadsupplier
ICQ> 752822040
Email> exploit.tools4u@gmail.com

ICQ 752822040 said...

**HACKING TOOLS WITH TUTORIALS & FULLZ AVAILABLE**
(High Quality, Genuine Seller)

=>Contact 24/7<=
Telegram> @killhacks
ICQ> 752822040

Fullz info included
NAME+SSN+DOB+DL+DL-STATE+ADDRESS
Employee & Bank details included
High credit fullz with DL 700+
(bulk order negotiable)
**Payment in all crypto currencies will be accepted**

->You can buy few for testing
->Invalid or wrong info will be replaced
->Serious buyers needed for long term

TOOLS & TUTORIALS AVAILABLE FOR:

"SPAMMING" "HACKING" "CARDING" "CASH OUT"
"KALI LINUX" "BLOCKCHAIN BLUE PRINTS"

**TOOLS & TUTORIALS LIST**

->Ethical Hacking Tools & Tutorials
->Kali Linux
->Keylogger & Keystroke Logger
->Facebook & Google Hacking
->Bitcoin Flasher
->SQL Injector
->Paypal Logins
->Bitcoin Cracker
->SMTP Linux Root
->DUMPS with pins track 1 and 2
->SMTP's, Safe Socks, Rdp's brute, VPN
->Php mailer
->SMS Sender & Email Blaster
->Cpanel
->Server I.P's & Proxies
->Viruses
->Premium Accounts (netflix cracker, paypal logins, pornhub, amazon)
->HQ Email Combo

If you are searching for a valid vendor, it's very prime chance.
You'll never be disappointed.
**You should try at least once**

Telegram> @killhacks
ICQ> 752822040

Post a Comment