• 标 题:Modify the ParaBytes's ReverseMe1
  • 作 者:poppig
  • 时 间:2003年10月15日 08:00
  • 链 接:http://bbs.pediy.com

******************************************************************************
                      Target ParaBytes's ReverseMe1
******************************************************************************

Author:        ParaBytes
Protection:   None
Needs:        Hiew,WinHex,Some PE knowledge,Most important is Our Brain
Level:        (X) Beginner ( ) Intermediate ( ) Advanced ( ) Expert

  我们知道了这次的目标是ParaBytes的ReverseMe1,呵呵,先看看有什么要求:
tasks :
~~~~~~~
1) Make the serial "ParaB0y"
2) remove the "mission failed"
3) regain access to the messgaebox that shows what you eneterd
4) regain access to the Good/Bad serial message
5) make the button caption "- Reversed -"
6) make the good serial/bad serial messages as "Good/Bad Serial" (no case senstive)
7) tut the solution...

  还很多,有7项,Yes,我们正在进行第7项,写分析.^_^,看一下它有什么保护措施:

Protections :
~~~~~~~~~~~~~
1) Immune from W32dasm
2) that all for now =]

  Immune from W32dasm?????但是我的W32dasm10可以照样打开它哦!可能它只是能Immune早期的
版本吧!Maybe!!!
  我们反汇编它,找到"mission failed"的地方,可以看到如下地方:

* Possible StringData Ref from Data Obj ->"Okay, for now, mission failed "
                                        ->"!"
                                  |
:00401242 6837304000              push 00403037
:00401247 6A00                    push 00000000

* Reference To: USER32.MessageBoxA, Ord:01BBh
                                  |
:00401249 E814010000              Call 00401362 ;全部nop掉
:0040124E 6800020000              push 00000200
:00401253 68CC304000              push 004030CC
:00401258 FF35C8304000            push dword ptr [004030C8]

* Reference To: USER32.GetWindowTextA, Ord:015Bh
                                  |
:0040125E E8ED000000              Call 00401350
:00401263 8BC8                    mov ecxeax

  看到了吧,上面就是task2的解决方案,我们向上看:

:0040120C B83B124000              mov eax, 0040123B
:00401211 FFE0                    jmp eax ;eax=40123B,Hmm,跳到出错的对话框
:00401213 6800020000              push 00000200 ;最大字符数
:00401218 68CC304000              push 004030CC ;得到的缓冲区地址
:0040121D FF35C8304000            push dword ptr [004030C8] ;hWnd

* Reference To: USER32.GetWindowTextA, Ord:015Bh
                                  |
:00401223 E828010000              Call 00401350 ;取得Edit里面的东东
:00401228 6A00                    push 00000000

* Possible StringData Ref from Data Obj ->"ParaBytes ReverseMe #1"
                                  |
:0040122A 6810304000              push 00403010
:0040122F 68CC304000              push 004030CC ;关键,是内容
:00401234 6A00                    push 00000000

* Reference To: USER32.MessageBoxA, Ord:01BBh
                                  |
:00401236 E827010000              Call 00401362 ;把取得的东东Popup出来

  我们知道自己输入的东西会在4030CC处,这个对我们很有用!那个jmp eax,就是跳到出错
的地方,所以我们要让它不要跳走并且为了满足弹出我们输入对话框的要求也不应该让它
跳走!所以我们nop它.
  接下来,我们要自己写代码了,比较serial是否是"ParaB0y".所以我们要知道我们在哪里
写我们的代码,用Tdump看一下空间:

#   Name      VirtSize    RVA     PhysSize  Phys off  Flags
--  --------  --------  --------  --------  --------  --------
01  .text     000003AA  00001000  00000400  00000400  C0000040 [IRW]
02  .rdata    00000250  00002000  00000400  00000800  C0000040 [IRW]
03  .data     000002CC  00003000  00000200  00000C00  C0000040 [IRW]
04  .rsrc     000003A0  00004000  00000400  00000E00  C0000040 [IRW]

  .text还有一部分空间,我们可以从7AB开始写代码,我们有400-3AA=0x56个字节写代码,
虽然很少,但是对这个程序,It's enough.因为要比较Serial所以我们自己要添加"ParaB0y".
我们把代码添加到.data section,我们可以看到0xCCC后面有不少空间,但是记住就是,刚才它
要把Edit取得的内容放到4030CC(0xCCC)处,所以我们在0xCCC处不要使用空间,我们可以隔远
一点,也可以在它之前(我选择在之前):

00000CC0   50 61 72 61 42 30 79 00  00 00 00 00 00 00 00 00   ParaB0y.........

  好了我们添加好了(task1搞定),接下来就是,写代码了,我们要怎样写呢?要得到输入的字
符串的个数,然后判断是否为7个,不是就跳转,是就接着比较,Isn't it?我们现在要是知道
怎样得到输入的个数,然后到我们的程序中去比较,我们可以看到我们nop掉的Call的后面
有GetWindowTextA,它的返回值eax就是输入的个数,我们不能在前面的GetWindowTextA后
面去改变程序的流程,因为我们如果改变了,就需要在我们自己的代码里面添加更多的代码
来弹出我们输入的内容,所以我们借助后面的无用的代码!所以我们可以在00401263,改变程
序的流程,让它到我们的代码中去执行代码:

Write Code with Hiew
.663 ;00401263(0x663)
jmp 7AB ;Our Code will be write at that place
.7AB
;Write Our Code
cmp eax,7
jnz 6CD ;Error MessageBox
mov edi,4030C0 ;Our Sirial Place
mov esi,4030CC ;What we put
mov ebx,[edi]
cmp ebx,[esi]
jnz 6CD ;jmp Error MessageBox
jmp 6B8 ;Hmm,jmp Correct Place

  现在好了吧,task3,4,6搞定了,最后就是把按钮的"Not Reversed"改为"- Reversed -"
这个就不用我说了吧!
  写到这里,基本已经写完了,题目要我们弹出"Good/Bad Serial",我只是用了里面的"Bad Number"
和"Good Number"偷了个懒,请大家原谅!如果要添加,我相信大家一定也会了,毕竟我写了前面的
两篇文章!



Made By dengkeng
E-mail:shellc0de@sohu.com
欢迎转载,请保持文章的完整性