通过构造Hash冲突实现各种语言的拒绝服务攻击
source link: https://www.laruence.com/2011/12/29/2412.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
通过构造Hash冲突实现各种语言的拒绝服务攻击
- 本文地址: https://www.laruence.com/2011/12/29/2412.html
- 转载请注明出处
上周的时候Dmitry突然在5.4发布在即的时候, 引入了一个新的配置项:
- Added max_input_vars directive to prevent attacks based on hash collisions
这个预防的攻击, 就是"通过调用Hash冲突实现各种语言的拒绝服务攻击漏洞"(multiple implementations denial-of-service via hash algorithm collision).
攻击的原理很简单, 目前很多语言, 使用hash来存储k-v数据, 包括常用的来自用户的POST数据, 攻击者可以通过构造请求头, 并伴随POST大量的特殊的"k"值(根据每个语言的Hash算法不同而定制), 使得语言底层保存POST数据的Hash表因为"冲突"(碰撞)而退化成链表.
这样一来, 如果数据量足够大, 那么就可以使得语言在计算, 查找, 插入的时候, 造成大量的CPU占用, 从而实现拒绝服务攻击.
PHP5.4是通过增加一个限制来尽量避免被此类攻击影响:
- - max_input_vars - specifies how many GET/POST/COOKIE input variables may be
- accepted. default value 1000.
目前已知的受影响的语言以及版本有::
Java, 所有版本
JRuby <= 1.6.5
PHP <= 5.3.8, <= 5.4.0RC3
Python, 所有版本
Rubinius, 所有版本
Ruby <= 1.8.7-p356
Apache Geronimo, 所有版本
Apache Tomcat <= 5.5.34, <= 6.0.34, <= 7.0.22
Oracle Glassfish <= 3.1.1
Jetty, 所有版本
Plone, 所有版本
Rack, 所有版本
V8 JavaScript Engine, 所有版本
不受此影响的语言或者修复版本的语言有::
PHP >= 5.3.9, >= 5.4.0RC4
JRuby >= 1.6.5.1
Ruby >= 1.8.7-p357, 1.9.x
Apache Tomcat >= 5.5.35, >= 6.0.35, >= 7.0.23
Oracle Glassfish, N/A (Oracle reports that the issue is fixed in the main codeline and scheduled for a future CPU)
CVE: CVE-2011-4885 (PHP), CVE-2011-4461 (Jetty), CVE-2011-4838 (JRuby), CVE-2011-4462 (Plone), CVE-2011-4815 (Ruby)
45 Comments
-
infected days February 14, 2022
I like this post, And I guess they are happy to read this post, they will get a good site to generate information, thanks for sharing it with me.
-
fnaf world June 11, 2020
The website has great content and lots of information. I would love to read your web articles.
-
Yola Riri September 9, 2018
This article will help the internet visitors for setting
up new webpage or even a weblog from start to end. -
网站架构 December 27, 2017
昨天看有个php网站是5.3的
-
Online Military Colleges Programs October 19, 2014
Wow! After all I got a weblog from where I be capable of
genuinely take helpful information concerning my study and knowledge. -
Mammie October 9, 2014
I have been exploring for a little for any high-quality
articles or weblog posts in this sort of house . Exploring in Yahoo I ultimately stumbled
upon this web site. Studying this information So i’m satisfied to convey that I have a very excellent uncanny feeling I came upon just what I needed.
I most indubitably will make sure to do not overlook this web site and give it a glance regularly. -
Connor October 8, 2014
This article will help the internet visitors for setting
up new webpage or even a weblog from start to end. -
PHP哈希表碰撞攻击原理 | 极客我爱你 geek521.com December 9, 2013
[…] [3] 通过构造Hash冲突实现各种语言的拒绝服务攻击 […]
-
debian编译安装php mysql | josephzeng blog July 24, 2013
[…] 5.3.8 爆出了严重漏洞,5.3.9在修复这个漏洞的同时引入了新的漏洞。而Debian […]
-
[重要]PHP 5.2/5.3 Hash冲突漏洞补丁发布 请迅速修补 | iOS100知识库 March 13, 2013
[…] 前日有信息显示当前包括PHP、Java、Ruby在内的很多语言版本存在漏洞,PHP官方开发组成员Laruence(新浪微博)表示攻击者可以通过构造Hash冲突实现拒绝服务攻击,并提供了实例。这个攻击方法危害很高,攻击成本也很小,一个台式机可以轻松搞垮数十台、上百台服务器。 […]
-
开发中遵循或自创标准所衍生的安全问题杂想 » HorseLuke@微碌 April 4, 2012
[…] [6] http://www.laruence.com/2011/12/29/2412.html […]
-
运维技术交流 » Hash冲突实现各种拒绝服务攻击 February 29, 2012
-
运维军团——运维技术与开源架构交流 » Hash冲突实现各种拒绝服务攻击 February 9, 2012
-
lidashuang » 我们什么时候应该使用异常? February 9, 2012
[…] 通过构造Hash冲突实现各种语言的拒绝服务攻击 […]
-
PHP-5.3.9远程执行任意代码漏洞(CVE-2012-0830) | 风雪之隅 February 8, 2012
[…] 还记得我之前说的PHP Hash Collisions Ddos漏洞吧? 最初的时候, 开发组给出的修复方案, 采用的是如果超过max_input_vars, 就报错(E_ERROR), 继而导致PHP出错结束. 而后来, 为了更加轻量级的解决这个问题, 我们又改善了一下, 变成了如果超过max_input_vars, 就发出警告, 并且不再往目的数组添加, 但是流程继续. 然后我们发布了5.3.9. […]
-
IT民工的坐井观天 » Lighttpd下安装PHP5.3.10(使用PHP-FPM) February 4, 2012
[…] 最近安全领域出了很多新闻,从CSDN密码外泄开始,接踵而至。其中通过构造HASH冲突来拒绝服务涉及了大部分WEB开发语言(具体可以看 Laruence的文章),所以有必要将PHP更新到最新版本(目前是5.3.10)。不过这个过程并不怎么顺利,记录一下。 […]
-
kangle 2.7.5轻松防hash碰撞 « NginxIDC January 16, 2012
[…] hash碰撞原理: http://www.laruence.com/2011/12/29/2412.html […]
-
Wordpress 升级到3.3.1,PHP升级到5.3.9,推荐DiffMerge | Ming's Blog January 11, 2012
[…] PHP版本升级到5.3.9,建议没有升级的赶快升级,防止受到Hash冲突拒绝服务攻击,可以参考 http://www.laruence.com/2011/12/29/2412.html,不过这么小的个人站点应该没有人有兴趣攻击。 […]
-
通过构造Hash冲突实现PHP/Java等语言的拒绝服务攻击 » tanglei's blog 唐磊的个人博客 January 8, 2012
[…] 前几天看到公司php群谈到这篇博文通过构造Hash冲突实现各种语言的拒绝服务攻击,说的是在PHP中,使用hash来存储k-v数据, 包括常用的来自用户的POST数据, 攻击者可以通过构造请求头, 并伴随POST大量的特殊的”k”值(根据每个语言的Hash算法不同而定制), 使得语言底层保存POST数据的Hash表因为”冲突”(碰撞)而退化成链表. 这样一来, 如果数据量足够大, 那么就可以使得语言在计算, 查找, 插入的时候, 造成大量的CPU占用, 从而实现拒绝服务攻击. 举个例子:如下代码中: 123456789101112131415161718192021222324252627<?php $size = pow(2, 16); // 16 is just an example, could also be 15 or 17 $startTime = microtime(true); $array = array(); for ($key = 0, $maxKey = ($size – 1) * $size; $key <= $maxKey; $key += $size) { $array[$key] = 0; } $endTime = microtime(true); echo 'Inserting ', $size, ' evil elements took ', $endTime – $startTime, ' seconds', "n"; $startTime = microtime(true); $array = array(); for ($key = 0, $maxKey = $size – 1; $key <= $maxKey; ++$key) { $array[$key] = 0; } $endTime = microtime(true); echo 'Inserting ', $size, ' good elements took ', $endTime – $startTime, ' seconds', "n"; //http://www.laruence.com/2011/12/30/2435.html ?> […]
-
Ruby和Rack解决因Hash表碰撞导致CPU拒绝服务的Bug – Imagine::Blog.new January 7, 2012
[…] 前几天,各个主流语言都爆出来了大Bug:“通过调用Hash冲突实现各种语言的拒绝服务攻击漏洞”(multiple implementations denial-of-service via hash algorithm collisio)。《通过构造Hash冲突实现各种语言的拒绝服务攻击》这篇文章提到PHP里引入了新的配置项,来限制GET/POST/COOKIE输入变量来减少攻击的影响。 […]
-
kangle 2.7.5 紧急发布,防hash碰撞攻击 | 草石网 January 7, 2012
[…] hash碰撞原理: http://www.laruence.com/2011/12/29/2412.html […]
-
fare January 6, 2012
彻底的修改方法,就是改一下hash函数,在编译安装的时候,自动生成一个随机的p,hash的时候带上这个p,就很难构造退化的链表了。
-
通过调用Hash冲突实现各种语言的拒绝服务攻击漏洞 | Charlie's Coffee House January 5, 2012
[…] Laruence 的翻疑问 […]
-
[…] collision theory: http://www.laruence.com/2011/12/29/2412.html […]
-
Joey Yin January 5, 2012
JAVA下hash冲突生成代码请参考:http://www.unclejoey.com/?p=554
-
hoho January 4, 2012
alert(‘test’)
-
' January 4, 2012
-
Suhosin, Good job! | 南靖男的时代 January 4, 2012
[…] 年末传出动态语言大范围的 Hash DOS […]
-
tanglei January 3, 2012
这个,java怎么中招啊?
求解释。
java中的数组不会支持很大,受内存限制吧。
不过在hashmap中,有类似的影响。不过相差不大。 -
yc2266 January 2, 2012
这个问题 百度可以共享一下 hi 空间里面的博文链接key 计算方式:
http://hi.baidu.com/baidu/blog/item/b95bb39997ebc2166f068cec.html
b95bb39997ebc2166f068cec 这个key的计算方式能保证在多少范围内不产生碰撞!(具体多少我也不知道)保证这个算法在一定范围的稳定性! -
upsuper January 2, 2012
Python 似乎受影响不大,首先 Python 本身不解析大量外部数据,所以不存在类似 PHP 那样针对语言层面的攻击,过滤过多参数只需要相关框架增加选项即可。其次 Python 的 Hash 算法似乎并不容易用来大规模构造冲撞数据,构造难度跟纯枚举差不多,所以短期内被攻击的可能性不大。
-
Hash表碰撞导致dos攻击 | 亿光年 December 31, 2011
-
PHP数组特殊Hash冲突问题 December 31, 2011
[…] 通过构造Hash冲突实现各种语言的拒绝服务攻击 PHP数组的Hash冲突实例 深入理解PHP之数组(遍历顺序) Supercolliding a PHP array 哈希表(HashTable) PHP的哈希表实现 If you enjoyed this article, please consider sharing it! […]
-
关于最近PHP的Array爆出的冲突问题 | 东海博客 December 30, 2011
[…] 原理(详见:http://www.laruence.com/2011/12/29/2412.html) […]
-
高危安全:Hash冲突导致PHP/JAVA/PYTHON等DDOS攻击 | 网站那些事 | 网站点兵 December 30, 2011
[…] 高危安全:Hash冲突导致PHP/JAVA/PYTHON等DDOS攻击 作者: xiuwz 日期: 2011 年 12 月 30 日 发表评论 (0) 查看评论 (No Ratings Yet) Loading … 分享到: 更多 国外目前报出“multiple implementations denial-of-service via hash algorithm collision”,该hash冲突漏洞对目前所有的WEB动态开发语言都有危害,导致一个用户可以轻松通过构造数据而造成任何网站拒绝服务,从而引发DDOS相关攻击。中文版介绍请参考http://www.laruence.com/2011/12/29/2412.html。 […]
-
PHP5.2.*防止Hash冲突拒绝服务攻击的Patch | 风雪之隅 December 30, 2011
[…] Posts:PHP数组的Hash冲突实例通过构造Hash冲突实现各种语言的拒绝服务攻击更简单的重现PHP Core的调用栈GBK编码PHP脚本导致语法错误(Zend […]
-
jw December 30, 2011
hi,niaoge
为啥不在每个bucket中加个指针指向链表结尾来解决问题,而是采用限制输入长度的方案
thx -
mahone December 30, 2011
max_input_vars – specifies how many GET/POST/COOKIE input variables may be
accepted. default value 1000.
这个1000,是get,post,cookie这种加起来一共1000?还是get1000,post1000,cookie1000? -
kim December 30, 2011
这不是基本上全部中招?
-
PHP数组的Hash冲突实例 | 风雪之隅 December 30, 2011
[…] […]
-
雪候鸟 December 30, 2011
@Ferrari 恩,是一样的事情,
-
神仙 December 30, 2011
如果是用的rbtree之类就不会有这麻烦了吧
-
Ferrari December 30, 2011
請問這篇的作者解釋的是同一個問題嗎?
http://nikic.github.com/2011/12/28/Supercolliding-a-PHP-array.html -
aries December 29, 2011
这个,现在有可行的方法来构造大量hash值相同的不同原文?
-
sunvince December 29, 2011
Leave a Reply Cancel reply
Your email address will not be published. Required fields are marked *
Comment
Name*
Email*
Website
Save my name, email, and website in this browser for the next time I comment.
This site uses Akismet to reduce spam. Learn how your comment data is processed.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK