安全研究
安全漏洞
Google SketchUp lib3ds库3DS文件处理内存破坏漏洞
发布日期:2010-01-12
更新日期:2010-01-14
受影响系统:
Google Sketchup 7.1.6087不受影响系统:
Google Sketchup 7.1.4871
Google Sketchup 7.0.10247
Google Sketchup 7.6859 (MAC OS X)描述:
Google Sketchup 7.1.6860 (Windows)
BUGTRAQ ID: 37708
CVE ID: CVE-2010-0280
Google Sketchup是用于创建3D模型的工具。
在导入3DS文件时,Google SketchUp从.3DS读取一些列的2字节字符并在指针计算中使用,计算数据拷贝的数组索引。由于没有检查计算所得的数组是否仍位于目标数组的边界之内,如果在3DS文件的0x6F49F偏移处对字符设置了很大的值,就可以触发内存破坏。
以下是Google SketchUp 3DS Importer模块的反汇编代码。由于拷贝到数组中的数据是从3DS文件中从0x6F491偏移处获取的,只要触发了内存破坏,覆盖内存的数据是完全可控的。
/-----
[Module:3DSImporter.dll]
0603AD86 |. 8B97 A8000000 ||MOV EDX,DWORD PTR DS:[EDI+A8] ;
EDX = pointer to destination array
0603AD8C |. 0FB7C0 ||MOVZX EAX,AX ;
AX = words starting at offset 0x6F49F (user-controlled)
0603AD8F |. 83C4 04 ||ADD ESP,4
0603AD92 |. 6BC0 5C ||IMUL EAX,EAX,5C
0603AD95 |. 8D4C24 18 ||LEA ECX,DWORD PTR SS:[ESP+18]
0603AD99 |. 8D5410 04 ||LEA EDX,DWORD PTR DS:[EAX+EDX+4] ;
calculates the index of the array where it will write, using
user-controlled data
0603AD9D |. 8D49 00 ||LEA ECX,DWORD PTR DS:[ECX]
0603ADA0 |> 8A01 ||/MOV AL,BYTE PTR DS:[ECX] ;
reads bytes starting at offset 0x6F491 (user-controlled)
0603ADA2 |. 8802 |||MOV BYTE PTR DS:[EDX],AL ;
copies the byte in AL to the array; *MEMORY CORRUPTION OCCURS HERE*
0603ADA4 |. 83C1 01 |||ADD ECX,1
0603ADA7 |. 83C2 01 |||ADD EDX,1
0603ADAA |. 84C0 |||TEST AL,AL
0603ADAC |.^ 75 F2 ||\JNZ SHORT 3DSImpor.0603ADA0 ;
keep copying till AL = 0
- -----/
有漏洞函数是lib3ds库src/lib3ds_mesh.c文件中从238行开始的face_array_read()函数,在以下switch语句的CHK_MSH_MAT_GROUP条件下执行有漏洞的代码:
/-----
[Function:src/lib3ds_mesh.c:face_array_read()]
switch (chunk) {
case CHK_MSH_MAT_GROUP: {
char name[64];
unsigned n;
unsigned i;
int index;
int material;
lib3ds_io_read_string(io, name, 64);
material = lib3ds_file_material_by_name(file, name);
n = lib3ds_io_read_word(io);
for (i = 0; i < n; ++i) {
index = lib3ds_io_read_word(io);
if (index < mesh->nfaces) { /* <- bounds check */
mesh->faces[index].material = material;
} else {
// TODO warning
}
}
break;
}
- -----/
有漏洞的Google SketchUp二进制程序没有执行边界检查;此外边界检查后的对齐操作也不匹配程序中的汇编。在1.3.0版本的lib3ds中使用strcpy将字符串拷贝到了数组。
[Function:lib3ds/mesh.c:77]
case LIB3DS_MSH_MAT_GROUP:
{
char name[64];
unsigned faces;
unsigned i;
unsigned index;
if (!lib3ds_io_read_string(io, name, 64)) {
return(LIB3DS_FALSE);
}
faces=lib3ds_io_read_word(io);
for (i=0; i<faces; ++i) {
index=lib3ds_io_read_word(io);
ASSERT(index<mesh->faces); /* <- assert for bounds check */
strcpy(mesh->faceL[index].material, name);
}
}
- -----/
<*来源:Francisco Falcon
链接:http://marc.info/?l=bugtraq&m=126341158308685&w=2
http://secunia.com/advisories/38185/
*>
建议:
厂商补丁:
------
目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载:
http://sketchup.google.com/
浏览次数:3058
严重程度:0(网友投票)
绿盟科技给您安全的保障
