DOM Based Cross Site Scripting

简介: 版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明http://superhei.

版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
http://superhei.blogbus.com/logs/10578816.html

现在xss非常流行.而且跑xss的工具到处都是,导致就和sqlinj一样,很多大站 基本很难找到很明显的xss bug了,以往我们查找xss 一般都黑盒,而且效果很明显,对于白盒,一般都是基于Server language如[php/asp/jsp ....]查找变量输出语句如:print/echo ….等.

今天刚看看大牛Amit Klein在2005写[DOM Based Cross Site Scripting or XSS of the Third Kind]:http://www.webappsec.org/projects/articles/071105.html 提到的DOM的xss比上面提到的那些更加难以发现,就luoluo牛说的找基于dom的xss才是王道 :)
找这类的xss需要分析js本身的代码,这样我们可以就和分析Server language的一些漏洞一样分析js了: 就和php等一样漏洞的产生是: 变量—>输出函数 ,而js是 变量—>输出给浏览器 那么我们要找dom-xss就是分析变量的’提取’和’输出’语句了

比如变量的’输出’给浏览器执行的一些对象:document.write,eval …等等
变量’输入/提取’:document的一些对象 如document.URL document.location …等等

就和Amit Klein文章里列举的那些:

2. Analyzing and hardening the client side (Javascript) code. Reference to DOM objects that may be influenced by the user (attacker) should be inspected, including (but not limited to):

document.URL
document.URLUnencoded
document.location (and many of its properties)
document.referrer
window.location (and many of its properties)
Note that a document object property or a window object property may be referenced syntactically in many ways – explicitly (e.g. window.location), implicitly (e.g. location), or via obtaining a handle to a window and using it (e.g. handle_to_some_window.location).

Special attention should be given to scenarios wherein the DOM is modified, either explicitly or potentially, either via raw access to the HTML or via access to the DOM itself, e.g. (by no means an exhaustive list, there are probably various browser extensions):

Write raw HTML, e.g.:
document.write(…)
document.writeln(…)
document.body.innerHtml=…
Directly modifying the DOM (including DHTML events), e.g.:
document.forms[0].action=… (and various other collections)
document.attachEvent(…)
document.create…(…)
document.execCommand(…)
document.body. … (accessing the DOM through the body object)
window.attachEvent(…)
Replacing the document URL, e.g.:
document.location=… (and assigning to location’s href, host and hostname)
document.location.hostname=…
document.location.replace(…)
document.location.assign(…)
document.URL=…
window.navigate(…)
Opening/modifying a window, e.g.:
document.open(…)
window.open(…)
window.location.href=… (and assigning to location’s href, host and hostname)
Directly executing script, e.g.:
eval(…)
window.execScript(…)
window.setInterval(…)
window.setTimeout(…)
那么我们分析dom-xss就可以直接分析那些js的函数了,那么我们怎么分析呢,和PHP等一样我们可以用grep等一些静态的方法,那么动态的方法呢? 可以使用基于proxy的中间自动fuzz,还有luoluo提出的js函数的’hook’等等 …期待luoluo牛的fuzz-tool

另外在利用或者触发dom-xss要注意一个js的特点就是[js闭合标签优先]:http://superhei.blogbus.com/logs/10073294.html的特点.
最后感谢luoluo牛的耐心的指导,还有jx分享他的0day :)

目录
相关文章
|
5月前
|
测试技术
什么是 SAP ABAP Cross Customizing Client
什么是 SAP ABAP Cross Customizing Client
37 0
|
移动开发 Java HTML5
Cross domain issue for an pure HTML5 application on SAP Cloud Platform
I have created an SAPUI5 application using SAP WebIDE and deployed it to SAP Cloud Platform as an HTML5 application. This is an pure HTML5 application, not an Java application or others. But when we got resources of the HTML5 application from another domain, there is an error message indicates cross
106 0
Cross domain issue for an pure HTML5 application on SAP Cloud Platform
|
算法 大数据 数据库
The Volcano Optimizer Generator : Extensibility and Efficient Search
数据库查询优化器的搜索技术,基本上分为了基于动态规划的bottom-up search(详见文章System-R论文解读)和基于Cascades/Volcano的top-down search两个流派,这篇文章我们来看一下Cascades的前身也就是Volcano优化器框架的paper。
412 0
The Volcano Optimizer Generator : Extensibility and Efficient Search
|
前端开发 JavaScript Go
Healwire Online Pharmacy 3.0 Cross Site Request Forgery / Cross Site Scripting
Healwire Online Pharmacy version 3.0 suffers from cross site request forgery and cross site scripting vulnerabilities.
1464 0
|
Web App开发 tengine 安全
Understanding HTTP/2: History, Features, Debugging, and Performance
HTTP/2 is an optimized transfer protocol over the previous version and offers various advantages, such as increased security, simplified development p.
1976 0
Predicting Malicious Behavior: Tools and Techniques for Ensuring Global Security
http://www.wiley.com/WileyCDA/WileyTitle/productCd-1118896696.
757 0
xssf-cross-site-scripting-framework-v30
The Cross-Site Scripting Framework (XSSF) is a security tool designed to turn the XSS vulnerability exploitation task into a much easier work.
675 0
|
JavaScript 前端开发 Ruby
Easy DOM-based XSS detection via Regexes
If you are interested in finding DOM-based XSS, you must have knowledge of http://code.
831 0
|
Web App开发 JavaScript 前端开发
Using Content Security Policy to Prevent Cross-Site Scripting (XSS)
On SendSafely.com we make heavy use of many new JavaScript APIs introduced with HTML5.
940 0
|
Web App开发 JavaScript 安全
Server-Side XSS Attack Detection with ModSecurity and PhantomJS
Client-Side JS Overriding Limitations In a previous blog post, I outlined how you could use ...
1029 0