Apr 28

json xss 防范 不指定

woyigui , 19:15 , 网络安全 , 评论(0) , 引用(0) , 阅读(1501) , Via 本站原创 | |
   好像最近大家对 json xss 不是太热,Google有过一次:http://ha.ckers.org/blog/20060704/cross-site-scripting-vulnerability-in-google/
好像大牛们早就知道这种了。

那么防范这样的XSS也是很容易的,比如有XSS漏洞的页面是这样的:
<?PHP
  $woyigui = $_GET["xss"];
  echo $woyigui;
?>

当然了,具体应用时更为复杂,修补方法很简单,开发人员可以改成如下这样:
<?PHP
  header("Content-type: application/json");
  $woyigui = $_GET["xss"];
  echo $woyigui;
?>

更改MIME文档类型来防范。测试的时候发现 text/plain 、application/x-zip-compressed 是会被 IE解析了。其他应该还是会有的,没有一个一个测试。

更多文档:
http://www.rfc-editor.org/rfc/rfc4627.txt
http://www.dev411.com/blog/2006/07/24/json-xss-exploit-dont-use-text-html
http://ha.ckers.org/blog/20060704/cross-site-scripting-vulnerability-in-google/
http://www.souzz.net/html/Security/3/38128.html

http://hi.baidu.com/momoca/blog/item/91317bf451b322d9f2d385f8.html   Content-type表
Tags: ,
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]
               

 
20100511 NFL jerseysNFL jerseysNFL jerseys, louis vuitton bagslouis vuitton bagslouis vuitton bags, nike shoesnike shoesnike shoes, coach bagscoach bagscoach bags, jordan shoesjordan shoesjordan shoes, coach bagscoach bagscoach bags, tiffany jewelrytiffany jewelrytiffany jewelry, Shox r4Shox r4Shox r4, Shox nzShox nzShox nz, Shox nzNike dunk sbNike dunk sb, ghd straightenersghd straightenersghd straighteners, coach outletcoach outletcoach outlet, replica rolexreplica rolexreplica rolex, breitling watchesbreitling watchesbreitling watches, replica rolex watchesreplica rolex watchesreplica rolex watches, tag heuer carreratag heuer carreratag heuer carrera, replica louis vuitton replica louis vuitton replica louis vuitton , replica chanelreplica chanelreplica chanel, wholesale handbagswholesale handbagswholesale handbags, wholesale bagswholesale bagswholesale bags, jimmy choojimmy choojimmy choo, christian louboutinchristian louboutinchristian louboutin, yves saint laurent shoesyves saint laurent shoesyves saint laurent shoes, christian louboutinchristian louboutinchristian louboutin, ghdghdghd, ghd hairghd hairghd hair, 外贸网店建设外贸网店建设外贸网店建设, seoseoseo, 圣荷圣荷圣荷,