SlideShare a Scribd company logo
1 of 24
DOM BASED XSS AND
DETECTION
CONTENT
About DOM Based XSS.
• What is DOM??
• What is XSS??
• DOM Based XSS??
How DOM Based XSS works??
DOM Based XSS detection.
• General analysis.
• PhantomJS.
• Tainted PhantomJS
ABOUT DOM
BASED XSS
ABOUT DOM BASED XSS: WHAT IS DOM??
Definition: is a platform- and language-neutral
interface that will allow programs and scripts to
dynamically access and update the content, structure
and style of documents (As World Wide Web
Consortium (W3C))
ABOUT DOM BASED XSS: WHAT IS DOM??
Definition of HTML DOM: The HTML DOM is a standard object model
and programming interface for HTML. It defines:
• The HTML elements as objects
• The properties of all HTML elements
• The methods to access all HTML elements
• The events for all HTML elements.
When a web page is loaded, the browser creates a Document Object
Model of the page.
ABOUT DOM BASED XSS: WHAT IS DOM??
The HTML DOM model is constructed as a tree of Objects:
The HTML DOM is a
standard for how to get,
change, add, or delete
HTML elements. With the
object model, JavaScript
gets all the power it
needs to create dynamic
HTML.
ABOUT DOM BASED XSS: WHAT IS XSS??
Original definition: vulnerability wherein one sends malicious
data (typically HTML stuff with JavaScript code in it) that is
echoed back later by the application in an HTML context of
some sort, and the JavaScript code gets executed.
ABOUT DOM BASED XSS: WHAT IS XSS??
Original definition: vulnerability wherein one sends malicious
data (typically HTML stuff with JavaScript code in it) that is
echoed back later by the application in an HTML context of
some sort, and the JavaScript code gets executed.
ABOUT DOM BASED XSS: WHAT IS XSS??
Persistent/ Stored XSS:
the payload is stored by
the system, and may later
be embedded by the
vulnerable system in an
HTML page provided to a
victim.
ABOUT DOM BASED XSS: WHAT IS XSS??
Non-persistent/
Reflected XSS: the
malicious
(JavaScript)
payload is echoed
by the server in an
immediate
response to an
HTTP request from
the victim.
ABOUT DOM BASED XSS: DOM BASED
XSS??
DOM Based XSS: 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.
How DOM Based
XSS works??
HOW DOM BASED XSS WORKS??
The prerequisite : we must have an HTML page that uses
data from the document.location or document.URL or
document.referrer (or any various other objects which the
attacker can influence in an insecure manner).
HOW DOM BASED XSS WORKS??
LET’S MAKE AN
EXAMPLE!
Imagine we have an HTML
page
http://www.vulnerable.site/
welcome.html
with the content here
<HTML>
<TITLE>Welcome!</TITLE>
Hi
<SCRIPT>
var pos=document.URL.indexOf("name=")+5;
document.write (document.URL.substring
(pos, document.URL.length));
</SCRIPT>
<BR>
Welcome to our system
…
</HTML>
HOW DOM BASED XSS WORKS??
HOW DOM BASED XSS WORKS??
ANOTHER
EXAMPLE!
Imagine we have an
HTML page with that
content
<label id="searchLbl" for="search">Search</label>
<input id="search" autocomplete="off"/>
<div id="results"></div>
<script>
document.getElementById('search').addEventListener('key
press', function(e) {
var code = e.keyCode || e.which;
if (code === 13) {
document.getElementById('results').innerHTML =
document.getElementById('search').value;
}
});
</script>
DOM BASED XSS
DETECTION
DOM BASED XSS DETECTION: GENERAL
ANALYSIS
DOM BASED XSS DETECTION: PHANTOMJS
=> PhantomJS is a browser but a headless browser.
PhantomJS is a headless WebKit scriptable with a JavaScript API.
WebKit is the layout engine that designed to allow web
browsers to render web pages. Chrome, Safari and a couple of
other browsers also use WebKit.
DOM BASED XSS DETECTION: PHANTOMJS
Headless web testing: lightning-fast testing without the browser.
Page automation. Access and manipulate web pages with the
standard DOM API, or with usual libraries like jQuery.
Screen capture. Programmatically capture web contents,
including CSs, SVG and Canvas.
Network monitoring. Automate performance analysis, track page
loading and export as standard HAR format.
DOM BASED XSS DETECTION: TAINTED
PHANTOMJS
Tainted PhantomJS (by Nera Liu): the scriptable tool for
DOM-based XSS detection. It is built based on the open
source PhantomJS by hacking the JavaScriptCore and
WebKit engine with the tainted signal.
• http://securitydaily.net/cac-kieu-khai-thac-xss-phan-3-dom-based-xss
• http://www.webappsec.org/projects/articles/071105.shtml
• https://www.blackhat.com/docs/asia-14/materials/Liu/Asia-14-Liu-Ultimate-Dom-Based-
XSS-Detection-Scanner-On-Cloud.pdf
• http://www.chmag.in/article/aug2010/advance-xss-attacks-dom-based
• http://www.acunetix.com/websitesecurity/improving-dom-xss-vulnerabilities-detection
• https://code.google.com/p/domxsswiki/wiki/
• http://blog.spiderlabs.com/2013/02/easy-dom-based-xss-detection-via-regexes.html
• http://ben-stock.de/2013/09/summary-of-our-ccs-paper-on-dom-based-xss/
• http://blog.spiderlabs.com/2013/02/easy-dom-based-xss-detection-via-regexes.html
• https://code.google.com/p/ra2-dom-xss-scanner/
• http://www.slideshare.net/ErolSelitektay/introduction-to-phantomjs
• http://code.tutsplus.com/tutorials/testing-javascript-with-phantomjs--net-
28243#disqus_thread
Dom based xss

More Related Content

What's hot

Cross site scripting (xss)
Cross site scripting (xss)Cross site scripting (xss)
Cross site scripting (xss)
Manish Kumar
 
Cross Site Scripting
Cross Site ScriptingCross Site Scripting
Cross Site Scripting
Ali Mattash
 

What's hot (20)

Waf bypassing Techniques
Waf bypassing TechniquesWaf bypassing Techniques
Waf bypassing Techniques
 
Xss (cross site scripting)
Xss (cross site scripting)Xss (cross site scripting)
Xss (cross site scripting)
 
Logical Attacks(Vulnerability Research)
Logical Attacks(Vulnerability Research)Logical Attacks(Vulnerability Research)
Logical Attacks(Vulnerability Research)
 
Penetration testing web application web application (in) security
Penetration testing web application web application (in) securityPenetration testing web application web application (in) security
Penetration testing web application web application (in) security
 
Cross site scripting attacks and defenses
Cross site scripting attacks and defensesCross site scripting attacks and defenses
Cross site scripting attacks and defenses
 
Xss attack
Xss attackXss attack
Xss attack
 
Cross Site Scripting ( XSS)
Cross Site Scripting ( XSS)Cross Site Scripting ( XSS)
Cross Site Scripting ( XSS)
 
CSRF, ClickJacking & Open Redirect
CSRF, ClickJacking & Open RedirectCSRF, ClickJacking & Open Redirect
CSRF, ClickJacking & Open Redirect
 
How to identify and prevent SQL injection
How to identify and prevent SQL injection  How to identify and prevent SQL injection
How to identify and prevent SQL injection
 
Building Advanced XSS Vectors
Building Advanced XSS VectorsBuilding Advanced XSS Vectors
Building Advanced XSS Vectors
 
SSRF For Bug Bounties
SSRF For Bug BountiesSSRF For Bug Bounties
SSRF For Bug Bounties
 
Cross site scripting
Cross site scriptingCross site scripting
Cross site scripting
 
Cross Site Request Forgery
Cross Site Request ForgeryCross Site Request Forgery
Cross Site Request Forgery
 
Cross site scripting (xss) attacks issues and defense - by sandeep kumbhar
Cross site scripting (xss) attacks issues and defense - by sandeep kumbharCross site scripting (xss) attacks issues and defense - by sandeep kumbhar
Cross site scripting (xss) attacks issues and defense - by sandeep kumbhar
 
XSS Attacks Exploiting XSS Filter by Masato Kinugawa - CODE BLUE 2015
XSS Attacks Exploiting XSS Filter by Masato Kinugawa - CODE BLUE 2015XSS Attacks Exploiting XSS Filter by Masato Kinugawa - CODE BLUE 2015
XSS Attacks Exploiting XSS Filter by Masato Kinugawa - CODE BLUE 2015
 
A8 cross site request forgery (csrf) it 6873 presentation
A8 cross site request forgery (csrf)   it 6873 presentationA8 cross site request forgery (csrf)   it 6873 presentation
A8 cross site request forgery (csrf) it 6873 presentation
 
Cross site scripting (xss)
Cross site scripting (xss)Cross site scripting (xss)
Cross site scripting (xss)
 
SSRF exploit the trust relationship
SSRF exploit the trust relationshipSSRF exploit the trust relationship
SSRF exploit the trust relationship
 
SQL injection prevention techniques
SQL injection prevention techniquesSQL injection prevention techniques
SQL injection prevention techniques
 
Cross Site Scripting
Cross Site ScriptingCross Site Scripting
Cross Site Scripting
 

Similar to Dom based xss

Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Cross Site Scripting (XSS)
Cross Site Scripting (XSS)
OWASP Khartoum
 
An Introduction to Ajax Programming
An Introduction to Ajax ProgrammingAn Introduction to Ajax Programming
An Introduction to Ajax Programming
hchen1
 

Similar to Dom based xss (20)

04. xss and encoding
04.  xss and encoding04.  xss and encoding
04. xss and encoding
 
BsidesDelhi 2018: DomGoat - the DOM Security Playground
BsidesDelhi 2018: DomGoat - the DOM Security PlaygroundBsidesDelhi 2018: DomGoat - the DOM Security Playground
BsidesDelhi 2018: DomGoat - the DOM Security Playground
 
Complete xss walkthrough
Complete xss walkthroughComplete xss walkthrough
Complete xss walkthrough
 
Intro to mobile web application development
Intro to mobile web application developmentIntro to mobile web application development
Intro to mobile web application development
 
Overview of PHP and MYSQL
Overview of PHP and MYSQLOverview of PHP and MYSQL
Overview of PHP and MYSQL
 
Dojo - from web page to web apps
Dojo - from web page to web appsDojo - from web page to web apps
Dojo - from web page to web apps
 
XSS - Attacks & Defense
XSS - Attacks & DefenseXSS - Attacks & Defense
XSS - Attacks & Defense
 
XSS Primer - Noob to Pro in 1 hour
XSS Primer - Noob to Pro in 1 hourXSS Primer - Noob to Pro in 1 hour
XSS Primer - Noob to Pro in 1 hour
 
Exploring Critical Rendering Path
Exploring Critical Rendering PathExploring Critical Rendering Path
Exploring Critical Rendering Path
 
Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Cross Site Scripting (XSS)
Cross Site Scripting (XSS)
 
Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Cross Site Scripting (XSS)
Cross Site Scripting (XSS)
 
Html css workshop, lesson 0, how browsers work
Html css workshop, lesson 0, how browsers workHtml css workshop, lesson 0, how browsers work
Html css workshop, lesson 0, how browsers work
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Model
 
Front end-security
Front end-securityFront end-security
Front end-security
 
Java Script
Java ScriptJava Script
Java Script
 
W3 conf hill-html5-security-realities
W3 conf hill-html5-security-realitiesW3 conf hill-html5-security-realities
W3 conf hill-html5-security-realities
 
An Introduction to Ajax Programming
An Introduction to Ajax ProgrammingAn Introduction to Ajax Programming
An Introduction to Ajax Programming
 
Web application attacks
Web application attacksWeb application attacks
Web application attacks
 
Les Basiques - Web Développement HTML5, CSS3, JS et PHP
Les Basiques - Web  Développement HTML5, CSS3, JS et PHPLes Basiques - Web  Développement HTML5, CSS3, JS et PHP
Les Basiques - Web Développement HTML5, CSS3, JS et PHP
 
Xssandcsrf
XssandcsrfXssandcsrf
Xssandcsrf
 

Recently uploaded

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

Dom based xss

  • 1. DOM BASED XSS AND DETECTION
  • 2. CONTENT About DOM Based XSS. • What is DOM?? • What is XSS?? • DOM Based XSS?? How DOM Based XSS works?? DOM Based XSS detection. • General analysis. • PhantomJS. • Tainted PhantomJS
  • 4. ABOUT DOM BASED XSS: WHAT IS DOM?? Definition: is a platform- and language-neutral interface that will allow programs and scripts to dynamically access and update the content, structure and style of documents (As World Wide Web Consortium (W3C))
  • 5. ABOUT DOM BASED XSS: WHAT IS DOM?? Definition of HTML DOM: The HTML DOM is a standard object model and programming interface for HTML. It defines: • The HTML elements as objects • The properties of all HTML elements • The methods to access all HTML elements • The events for all HTML elements. When a web page is loaded, the browser creates a Document Object Model of the page.
  • 6. ABOUT DOM BASED XSS: WHAT IS DOM?? The HTML DOM model is constructed as a tree of Objects: The HTML DOM is a standard for how to get, change, add, or delete HTML elements. With the object model, JavaScript gets all the power it needs to create dynamic HTML.
  • 7. ABOUT DOM BASED XSS: WHAT IS XSS?? Original definition: vulnerability wherein one sends malicious data (typically HTML stuff with JavaScript code in it) that is echoed back later by the application in an HTML context of some sort, and the JavaScript code gets executed.
  • 8. ABOUT DOM BASED XSS: WHAT IS XSS?? Original definition: vulnerability wherein one sends malicious data (typically HTML stuff with JavaScript code in it) that is echoed back later by the application in an HTML context of some sort, and the JavaScript code gets executed.
  • 9. ABOUT DOM BASED XSS: WHAT IS XSS?? Persistent/ Stored XSS: the payload is stored by the system, and may later be embedded by the vulnerable system in an HTML page provided to a victim.
  • 10. ABOUT DOM BASED XSS: WHAT IS XSS?? Non-persistent/ Reflected XSS: the malicious (JavaScript) payload is echoed by the server in an immediate response to an HTTP request from the victim.
  • 11. ABOUT DOM BASED XSS: DOM BASED XSS?? DOM Based XSS: 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.
  • 12. How DOM Based XSS works??
  • 13. HOW DOM BASED XSS WORKS?? The prerequisite : we must have an HTML page that uses data from the document.location or document.URL or document.referrer (or any various other objects which the attacker can influence in an insecure manner).
  • 14. HOW DOM BASED XSS WORKS?? LET’S MAKE AN EXAMPLE! Imagine we have an HTML page http://www.vulnerable.site/ welcome.html with the content here <HTML> <TITLE>Welcome!</TITLE> Hi <SCRIPT> var pos=document.URL.indexOf("name=")+5; document.write (document.URL.substring (pos, document.URL.length)); </SCRIPT> <BR> Welcome to our system … </HTML>
  • 15. HOW DOM BASED XSS WORKS??
  • 16. HOW DOM BASED XSS WORKS?? ANOTHER EXAMPLE! Imagine we have an HTML page with that content <label id="searchLbl" for="search">Search</label> <input id="search" autocomplete="off"/> <div id="results"></div> <script> document.getElementById('search').addEventListener('key press', function(e) { var code = e.keyCode || e.which; if (code === 13) { document.getElementById('results').innerHTML = document.getElementById('search').value; } }); </script>
  • 18. DOM BASED XSS DETECTION: GENERAL ANALYSIS
  • 19. DOM BASED XSS DETECTION: PHANTOMJS => PhantomJS is a browser but a headless browser. PhantomJS is a headless WebKit scriptable with a JavaScript API. WebKit is the layout engine that designed to allow web browsers to render web pages. Chrome, Safari and a couple of other browsers also use WebKit.
  • 20. DOM BASED XSS DETECTION: PHANTOMJS Headless web testing: lightning-fast testing without the browser. Page automation. Access and manipulate web pages with the standard DOM API, or with usual libraries like jQuery. Screen capture. Programmatically capture web contents, including CSs, SVG and Canvas. Network monitoring. Automate performance analysis, track page loading and export as standard HAR format.
  • 21. DOM BASED XSS DETECTION: TAINTED PHANTOMJS Tainted PhantomJS (by Nera Liu): the scriptable tool for DOM-based XSS detection. It is built based on the open source PhantomJS by hacking the JavaScriptCore and WebKit engine with the tainted signal.
  • 22.
  • 23. • http://securitydaily.net/cac-kieu-khai-thac-xss-phan-3-dom-based-xss • http://www.webappsec.org/projects/articles/071105.shtml • https://www.blackhat.com/docs/asia-14/materials/Liu/Asia-14-Liu-Ultimate-Dom-Based- XSS-Detection-Scanner-On-Cloud.pdf • http://www.chmag.in/article/aug2010/advance-xss-attacks-dom-based • http://www.acunetix.com/websitesecurity/improving-dom-xss-vulnerabilities-detection • https://code.google.com/p/domxsswiki/wiki/ • http://blog.spiderlabs.com/2013/02/easy-dom-based-xss-detection-via-regexes.html • http://ben-stock.de/2013/09/summary-of-our-ccs-paper-on-dom-based-xss/ • http://blog.spiderlabs.com/2013/02/easy-dom-based-xss-detection-via-regexes.html • https://code.google.com/p/ra2-dom-xss-scanner/ • http://www.slideshare.net/ErolSelitektay/introduction-to-phantomjs • http://code.tutsplus.com/tutorials/testing-javascript-with-phantomjs--net- 28243#disqus_thread

Editor's Notes

  1. World Wide Web Consortium (W3C), is a group development of standards for the World Wide Web , which internet browsers and web developers will follow.Môhìnhnàythểhiệntàiliệudướidạngcấutrúccâyphâncấp. Tấtcảcácthànhphầntrong HTML, XML đềuđượcxemnhưmột node). Thaotácdữliệu (manipulate data): thêm, xóa, sửadữliệu.
  2. Kỹ thuật XSS được thực hiện dựa trên việc chèn các đoạn script nguy hiểm vào trong source code ứng dụng web. Nhằm thực thi các đoạn mã độc Javascript để thựchiện ý đồxấu.
  3. third kind of XSS attacks - the ones that do not rely on sending the malicious data to the server in the first place!
  4. It is not uncommon to find an application HTML page containing Javascript code that parses (phângiải)the URL line (by accessing document.URL or document.location) and performs some client side logic according to it. The below is an example to such logic.
  5. (static!) HTML page. The victim’s browser then starts parsing this HTML into DOM. When the parser arrives to the Javascript code, it executes it and it modifies the raw HTML of the page. In this case, the code references document.URL, and so, a part of this string is embedded at parsing time in the HTML, which is then immediately parsed and the Javascript code found (alert(…)) is executed in the context of the same page, hence the XSS condition.
  6. NOTE: This exploit only works if the browser does not modify the URL characters. Mozilla automatically encodes &lt; and &gt; (into %3C and %3E, respectively) in the document.URL when the URL is not directly typed at the address bar, and therefore it is not vulnerable to the attack as shown in the example. It is vulnerable to attacks if &lt; and &gt; are not needed (in raw form). Microsoft Internet Explorer 6.0 does not encode &lt; and &gt;, and is therefore vulnerable to the attack as-is. Of course, embedding in the HTML directly is just one attack mount point, there are various scenarios that do not require &lt; and &gt;, and therefore Mozilla in general is not immune from this attack.&lt;div onmouseover=&quot;javascript:alert(&apos;failed!&apos;)&quot;&gt;XSS Test&lt;/div&gt;
  7. In the above example, it may be argued that still, the payload did arrive to the server (in the query part of the HTTP request), and so it can be detected just like any other XSS attack. But even that can be taken care of. The string beyond # sign is a fragment, not part of an actual query, that is not sent to server. Therefore, the server will get only a query string without the malicious part of the input data. As a resuilt, many strong XSS filters at server-side do not even recognize such attacks. Since most of detectors and firewalls ignore client-side pages, they are inherently not able to detect DOM-based XSS. To handle DOM-based XSS, we need to concentrate on client-side HTML pages rather than server-side pages.
  8. Headless browser (that is, a browser that runs without a GUI, allowing you to navigate the web and interact with web pages from your terminal). Engine trìnhduyệt
  9. Various test frameworks such as Jasmine, Capybara, QUnit, Mocha, WebDriver and many others are supported.