设为首页  加入收藏  联系我们 繁體中文  

黑客软件:

  漏洞扫描 | 木马间谍 | 加密解密 | 远程控制 | 破坏攻击 | 杀毒软件 | 防火墙类 | OICQ专区 | 黑客必备 | 常用工具 | 网吧攻击
文章中心:   最新资讯 | 黑客技术 | 电脑基础 | 菜鸟文摘 | 网络安全 | 网络技巧 | QQ技巧 | OQ空间代码 | 免费资源 | 编程世界 | 建站技术
素材源码:   论坛相关 | ASP源码 | CGI 源码 | NET 源码 | PHP 源码 | 酷站素材 | 字体素材 | 图片素材 | 友情发布 | 网页模版 | 建站软件
教程动画:   黑客教程 | 黑客编程 | 网站入侵 | 菜鸟教程 | 入侵教程 | 破解教程 | 电子书籍 | 网页制作 | 高级会员 | 综合教程 | 本站原创


   

  您当前的位置:中华隐士黑客联盟 -> 黑客技术 -> 破解技术 -> 文章内容 [站内搜索]  

 
php函数htmlentities默认参数不过滤'导致xss攻击
作者:佚名  来源:本站整理  发布时间:2007-12-1 9:25:38  发布人:www.hack86.com
 

Gareth Heyes在他的blog上发了一个"htmlentities is badly designed": http://www.thespanner.co.uk/2007/11/26/htmlentities-is-badly-designed/

大意就是说在默认参数下htmlentities不会过滤’导致xss等, php手册里的描叙:

htmlentities
(PHP 3, PHP 4, PHP 5)

htmlentities -- Convert all applicable characters to HTML entities
Description
string htmlentities ( string string [, int quote_style [, string charset]] )

This function is identical to htmlspecialchars() in all ways, except with htmlentities(), all characters which have HTML character entity equivalents are translated into these entities.

Like htmlspecialchars(), the optional second quote_style parameter lets you define what will be done with ’single’ and "double" quotes. It takes on one of three constants with the default being ENT_COMPAT:

表格 1. Available quote_style constants

Constant Name Description
ENT_COMPAT Will convert double-quotes and leave single-quotes alone.
ENT_QUOTES Will convert both double and single quotes.
ENT_NOQUOTES Will leave both double and single quotes unconverted.

在htmlspecialchars里:

’&’ (ampersand) becomes ’&’

’"’ (double quote) becomes ’"’ when ENT_NOQUOTES is not set.

’’’ (single quote) becomes ’'’ only when ENT_QUOTES is set.

’<’ (less than) becomes ’&lt;’

’>’ (greater than) becomes ’&gt;’

所以使用htmlentities($variable, ENT_QUOTES);要比htmlentities($variable);安全. 但是htmlentities()只是一个字符处理的函数,在很多情况下 可能导致xss等的攻击,例如编码:utf7,utf8...

测试一下:

<?php
echo htmlspecialchars($_GET[url], ENT_QUOTES);
?>

提交:url=%2bADw-SCRIPT%2bAD4-alert(document.cookie)%2bADw-%2fSCRIPT%2bAD4-

还有很多2次编码的情况也有可能pass htmlentities  
[] [返回上一页] [打 印] [收 藏]
  [相关文章评论]    (评论内容只代表网友观点,与本站立场无关!) [更多评论...]
 

  Perl解析www[1-3,5]..
Pixy - PHP 原始码的..
Photoshop调色技巧处..
黑客团体将出售软件..
黑客隐藏PHP文件后门..
黑客纷纷破解iPhone..
用Photoshop为信封盖..
Photoshop特效实例:..
iPhone太火暴 将成为..
苹果iPhone安全性遭..


 
免费获得Q币的最新方法
最新免费在线看的电影网站集绵
不用木马,轻松万能偷daoQQ号码
最新QQ空间4.0全屏版效果图!!
新免蟆Q秀,刷红钻的方法
黑客快速入门(强烈推荐)
18岁少女欲6000元卖处女身 救患血..
QQ密码本地破解的原理和方法
8款QQ空间免费开场动画
免费QQ蓝钻体验(附考试答案)
 
情感之折断翅膀 12-05
FD-我的音乐世界 12-05
FD-视觉牛B 12-05
非主流女女 鼠标触摸 12-05
QQ宠物熊于12月4日开始可以领取 12-05
12-05 今日最新代理IP HTTP代理服.. 12-05
当一切茫然我只知道爱你 12-05
逃出寂寞的缠绕 12-05
可爱小狗狗 偶滴窝窝 12-05
帅到掉渣的动态大图 12-05
 
关于本站 网站帮助 广告合作 下载声明 友情连接 网站地图 访客留言 论坛登录
〖中华隐士黑客联盟〗,Copyright © 2006-2010 WwW.Hack86.Com 闽ICP备:06023304号
站长:小质 QQ:771760,软件发布MAIL:Hack086@21cn.com