跨站脚本(XSS) [英] Cross site scripting(XSS)

查看:400
本文介绍了跨站脚本(XSS)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从另一个网页加载内容,并根据网页的内容,更改我的网页的内容,这是给我的跨网站脚本问题。


  1. 当我使用iframe时,由于内容来自其他域,因此iframe的内容变得不可访问。

  2. 当我使用ajax并尝试将内容注入纯HTML代码时,

  3. 当我在jQuery中使用JSONP(如getJSON)时,它只支持GET协议,并且不足以进行进一步处理。

我不知道我可以尝试什么其他选项。听说DOJO,GWT,Adobe Air做一些XSS,但不知道哪一个是最好的。



谢谢,
Ebe。

$ b如果没有JSON-P,你唯一的选择是在你自己的服务器上运行一个代理脚本,它从外部站点获取内容,并将它管道回到浏览器。



浏览器从服务器上的脚本中获取内容,因此没有跨域问题,但是服务器上的脚本会从外部网站动态提取。



这里有一个PHP脚本的例子: http://www.daniweb.com/code/snippet494.html (注意,我没有亲自使用它)。


I am loading content from another page and depending on the content of page, changing content of my page and this is giving me cross site scripting issues.

  1. When i use iframe, since the content is from other domain, content of iframe becomes inaccessible.
  2. When i use ajax and try to inject the content as plain html code, XmlHttpRequest object throws permission denied exception due to cross site scripting.
  3. When i use JSONP, such as getJSON in JQuery, it only supports GET protocol and it is not adequate for further processing.

I wonder what other options i can try. Heard that DOJO, GWT,Adobe Air do some XSS, but dont know which one is the best.

Thanks, Ebe.

解决方案

Without JSON-P, your only option is to run a proxy script on your own server that fetches the content from the external site and pipes it back to the browser.

The browser fetches the content from the script on your server, hence no cross-domain issues, but the script on your server dynamically fetches it from the external site.

There's an example of such a script in PHP here: http://www.daniweb.com/code/snippet494.html (NB. I haven't personally used it).

这篇关于跨站脚本(XSS)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆