首页
社区
课程
招聘
[原创]『深圳腾讯2010安全技术竞赛』 [第二阶段 第一题] VM指令转换
发表于: 2010-11-1 12:10 13386

[原创]『深圳腾讯2010安全技术竞赛』 [第二阶段 第一题] VM指令转换

2010-11-1 12:10
13386
- 纯手工打造:


CRCMatricInit:                                ;0x100 * 0x4 * 0x8

0x40cdd0 -> Ins:1 type:0 op1:0 op2:0          ;Backup_Flag_0_To_60

0x40cde0 -> Ins:4 type:0 op1:0 op2:4          ;Mov [0x40],Base4_ESP
0x40cdf0 -> Ins:6 type:0 op1:1 op2:-4         ;Mov [0x44],-4
0x40ce00 -> Ins:9 type:0 op1:0 op2:0          ;Add [0x40],[0x44]
0x40ce10 -> Ins:3 type:0 op1:4 op2:0          ;Mov Base4_ESP,[0x40]    ;Base4_ESP -= 4

0x40ce20 -> Ins:4 type:0 op1:1 op2:2          ;Mov [0x44],Base2_ESI
0x40ce30 -> Ins:7 type:0 op1:0 op2:1          ;Mov ptr [0x40],[0x44]   ;*Base4_ESP = Base2_ESI

0x40ce40 -> Ins:4 type:0 op1:0 op2:6          ;Mov [0x40],Base6_EDX
0x40ce50 -> Ins:4 type:0 op1:1 op2:6          ;Mov [0x44],Base6_EDX
0x40ce60 -> Ins:15 type:0 op1:0 op2:0         ;XOR [0x40],[0x44]
0x40ce70 -> Ins:2 type:0 op1:0 op2:0          ;Restore_Flag_60_To_0
0x40ce80 -> Ins:3 type:0 op1:6 op2:0          ;Mov Base6_EDX,[0x40]    ;Base6_EDX = 0
0x40ce90 -> Ins:6 type:0 op1:0 op2:40ece0     ;Mov [0x40],40ece0

Loop2:
0x40cea0 -> Ins:3 type:0 op1:7 op2:0          ;Mov Base7_ECX,[0x40]    ;Base7_ECX = 40ece0

0x40ceb0 -> Ins:4 type:0 op1:0 op2:6          ;Mov [0x40],Base6_EDX
0x40cec0 -> Ins:3 type:0 op1:8 op2:0          ;Mov Base8_EAX,[0x40]    ;Base8_EAX = Base6_EDX

0x40ced0 -> Ins:6 type:0 op1:0 op2:8          ;Mov [0x40],8

Loop1:
0x40cee0 -> Ins:3 type:0 op1:2 op2:0          ;Mov Base2_ESI,[0x40]    ;Base2_ESI = 8

0x40cef0 -> Ins:4 type:0 op1:0 op2:8          ;Mov [0x40],Base8_EAX
0x40cf00 -> Ins:6 type:0 op1:1 op2:1          ;Mov [0x44],1
0x40cf10 -> Ins:13 type:2 op1:0 op2:0         ;TEST [0x40],[0x44]
0x40cf20 -> Ins:d type:0 op1:1 op2:0          ;Check_Flag_60_To_64     ;if (Base8_EAX & 1 == 0) jmp Next1
0x40cf30 -> Ins:e type:0 op1:a op2:0          ;Jmp 10, ByFlagCheckResult64  ---> 0x40cfe0

0x40cf40 -> Ins:4 type:0 op1:0 op2:8          ;Mov [0x40],Base8_EAX
0x40cf50 -> Ins:6 type:0 op1:1 op2:1          ;Mov [0x44],1
0x40cf60 -> Ins:18 type:0 op1:0 op2:0         ;SHR [0x40],[0x44]
0x40cf70 -> Ins:3 type:0 op1:8 op2:0          ;Mov Base8_EAX,[0x40]    ;Base8_EAX >> 1

0x40cf80 -> Ins:4 type:0 op1:0 op2:8          ;Mov [0x40],Base8_EAX
0x40cf90 -> Ins:6 type:0 op1:1 op2:edb08320   ;Mov [0x44],edb08320
0x40cfa0 -> Ins:15 type:0 op1:0 op2:0         ;XOR [0x40],[0x44]
0x40cfb0 -> Ins:3 type:0 op1:8 op2:0          ;Mov Base8_EAX,[0x40]    ;Base8_EAX ^= edb08320
0x40cfc0 -> Ins:d type:0 op1:0 op2:0          ;Check_Flag_60_To_64
0x40cfd0 -> Ins:e type:0 op1:4 op2:0          ;Jmp 4, ByFlagCheckResult64   ---> 0x40d020 jmp Next2

Next1:
0x40cfe0 -> Ins:4 type:0 op1:0 op2:8          ;Mov [0x40],Base8_EAX
0x40cff0 -> Ins:6 type:0 op1:1 op2:1          ;Mov [0x44],1
0x40d000 -> Ins:18 type:0 op1:0 op2:0         ;SHR [0x40],[0x44]      
0x40d010 -> Ins:3 type:0 op1:8 op2:0          ;Mov Base8_EAX,[0x40]    ;Base8_EAX >> 1

Next2:
0x40d020 -> Ins:4 type:0 op1:0 op2:2          ;Mov [0x40],Base2_ESI
0x40d030 -> Ins:6 type:0 op1:1 op2:1          ;Mov [0x44],1
0x40d040 -> Ins:10 type:0 op1:0 op2:0         ;SubEx [0x40],[0x44]
0x40d050 -> Ins:3 type:0 op1:2 op2:0          ;Mov Base2_ESI,[0x40]     ;Base2_ESI -= 1
0x40d060 -> Ins:d type:0 op1:2 op2:0          ;Check_Flag_60_To_64      ;if (Base2_ESI > 0) jmp Loop1
0x40d070 -> Ins:e type:0 op1:-25 op2:0        ;Jmp -25, ByFlagCheckResult64 ---> 0x40cee0 Loop1

0x40d080 -> Ins:4 type:0 op1:1 op2:8          ;Mov [0x44],Base8_EAX
0x40d090 -> Ins:4 type:0 op1:0 op2:7          ;Mov [0x40],Base7_ECX
0x40d0a0 -> Ins:7 type:0 op1:0 op2:1          ;Mov ptr [0x40],[0x44]    ;*Base7_ECX = Base8_EAX

0x40d0b0 -> Ins:4 type:0 op1:0 op2:7          ;Mov [0x40],Base7_ECX
0x40d0c0 -> Ins:6 type:0 op1:1 op2:4          ;Mov [0x44],4
0x40d0d0 -> Ins:f type:0 op1:0 op2:0          ;AddEx [0x40],[0x44]
0x40d0e0 -> Ins:3 type:0 op1:7 op2:0          ;Mov Base7_ECX,[0x40]     ;Base7_ECX += 4

0x40d0f0 -> Ins:4 type:0 op1:0 op2:6          ;Mov [0x40],Base6_EDX
0x40d100 -> Ins:6 type:0 op1:1 op2:1          ;Mov [0x44],1
0x40d110 -> Ins:f type:0 op1:0 op2:0          ;AddEx [0x40],[0x44]
0x40d120 -> Ins:3 type:0 op1:6 op2:0          ;Mov Base6_EDX,[0x40]     ;Base6_EDX += 1

0x40d130 -> Ins:4 type:0 op1:0 op2:7          ;Mov [0x40],Base7_ECX
0x40d140 -> Ins:6 type:0 op1:1 op2:40f0e0     ;Mov [0x44],40f0e0
0x40d150 -> Ins:10 type:0 op1:0 op2:0         ;SubEx [0x40],[0x44]
0x40d160 -> Ins:d type:0 op1:3 op2:0          ;Check_Flag_60_To_64      ;if (Base7_ECX < 0x40f0e0) jmp Loop2
0x40d170 -> Ins:e type:0 op1:-45 op2:0        ;Jmp -45, ByFlagCheckResult64 ---> 0x40cea0 Loop2

0x40d180 -> Ins:4 type:0 op1:0 op2:4          ;Mov [0x40],Base4_ESP
0x40d190 -> Ins:8 type:0 op1:1 op2:0          ;Mov [0x44],ptr [0x40]
0x40d1a0 -> Ins:3 type:0 op1:2 op2:1          ;Mov Base2_ESI,[0x44]     ;Base2_ESI = *Base4_ESP

0x40d1b0 -> Ins:4 type:0 op1:0 op2:4          ;Mov [0x40],Base4_ESP
0x40d1c0 -> Ins:6 type:0 op1:1 op2:4          ;Mov [0x44],4
0x40d1d0 -> Ins:9 type:0 op1:0 op2:0          ;Add [0x40],[0x44]
0x40d1e0 -> Ins:3 type:0 op1:4 op2:0          ;Mov Base4_ESP,[0x40]     ;Base4_ESP += 4

0x40d1f0 -> Ins:4 type:0 op1:0 op2:4          ;Mov [0x40],Base4_ESP
0x40d200 -> Ins:8 type:0 op1:7 op2:0          ;Mov [0x5C],ptr [0x40]    ;[0x5c] = *Base4_ESP ; return to eip of last normal call

0x40d210 -> Ins:4 type:0 op1:0 op2:4          ;Mov [0x40],Base4_ESP
0x40d220 -> Ins:6 type:0 op1:1 op2:4          ;Mov [0x44],4
0x40d230 -> Ins:9 type:0 op1:0 op2:0          ;Add [0x40],[0x44]
0x40d240 -> Ins:3 type:0 op1:4 op2:0          ;Mov Base4_ESP,[0x40]     ;Base4_ESP += 4

0x40d250 -> Ins:2 type:0 op1:0 op2:0          ;Restore_Flag_60_To_0
0x40d260 -> Ins:0 type:0 op1:0 op2:0          ;RestoreStack



CalculateCRC:

0x40d270 -> Ins:1 type:0 op1:0 op2:0          ;Backup_Flag_0_To_60

0x40d280 -> Ins:4 type:0 op1:0 op2:4          ;Mov [0x40],Base4_ESP
0x40d290 -> Ins:6 type:0 op1:1 op2:-4         ;Mov [0x44],-4
0x40d2a0 -> Ins:9 type:0 op1:0 op2:0          ;Add [0x40],[0x44]
0x40d2b0 -> Ins:3 type:0 op1:4 op2:0          ;Mov Base4_ESP,[0x40]     ;Base4_ESP -= 4

0x40d2c0 -> Ins:4 type:0 op1:1 op2:2          ;Mov [0x44],Base2_ESI
0x40d2d0 -> Ins:7 type:0 op1:0 op2:1          ;Mov ptr [0x40],[0x44]    ;*Base4_ESP = Base2_ESI ; Backup ESI

0x40d2e0 -> Ins:4 type:0 op1:0 op2:4          ;Mov [0x40],Base4_ESP
0x40d2f0 -> Ins:6 type:0 op1:1 op2:c          ;Mov [0x44],c
0x40d300 -> Ins:9 type:0 op1:0 op2:0          ;Add [0x40],[0x44]
0x40d310 -> Ins:8 type:0 op1:0 op2:0          ;Mov [0x40],ptr [0x40]
0x40d320 -> Ins:3 type:0 op1:2 op2:0          ;Mov Base2_ESI,[0x40]     ;Base2_ESI = *(Base4_ESP+0x0c) ;Length


0x40d330 -> Ins:4 type:0 op1:0 op2:8          ;Mov [0x40],Base8_EAX
0x40d340 -> Ins:6 type:0 op1:1 op2:ffffffff   ;Mov [0x44],ffffffff
0x40d350 -> Ins:16 type:0 op1:0 op2:0         ;OR [0x40],[0x44]
0x40d360 -> Ins:3 type:0 op1:8 op2:0          ;Mov Base8_EAX,[0x40]     ;Base8_EAX = 0xffffffff

0x40d370 -> Ins:4 type:0 op1:0 op2:2          ;Mov [0x40],Base2_ESI
0x40d380 -> Ins:4 type:0 op1:1 op2:2          ;Mov [0x44],Base2_ESI
0x40d390 -> Ins:13 type:0 op1:0 op2:0         ;TEST [0x40],[0x44]
0x40d3a0 -> Ins:d type:0 op1:4 op2:0          ;Check_Flag_60_To_64      ;if (Base2_ESI) jmp Next1 ; if (Length == 0) jmp Next1
0x40d3b0 -> Ins:e type:0 op1:3f op2:0         ;Jmp 63, ByFlagCheckResult64

0x40d3c0 -> Ins:4 type:0 op1:0 op2:4          ;Mov [0x40],Base4_ESP
0x40d3d0 -> Ins:6 type:0 op1:1 op2:8          ;Mov [0x44],8
0x40d3e0 -> Ins:9 type:0 op1:0 op2:0          ;Add [0x40],[0x44]
0x40d3f0 -> Ins:8 type:0 op1:0 op2:0          ;Mov [0x40],ptr [0x40]
0x40d400 -> Ins:3 type:0 op1:7 op2:0          ;Mov Base7_ECX,[0x40]     ;Base7_ECX = *(Base4_ESP+8); GetDataPointer

0x40d410 -> Ins:4 type:0 op1:0 op2:4          ;Mov [0x40],Base4_ESP
0x40d420 -> Ins:6 type:0 op1:1 op2:-4         ;Mov [0x44],-4
0x40d430 -> Ins:9 type:0 op1:0 op2:0          ;Add [0x40],[0x44]
0x40d440 -> Ins:3 type:0 op1:4 op2:0          ;Mov Base4_ESP,[0x40]     ;Base4_ESP -= 4

0x40d450 -> Ins:4 type:0 op1:1 op2:5          ;Mov [0x44],Base5_EBX

0x40d460 -> Ins:7 type:0 op1:0 op2:1          ;Mov ptr [0x40],[0x44]    ;*Base4_ESP = Base5_EBX

Loop1:
0x40d470 -> Ins:4 type:0 op1:0 op2:8          ;Mov [0x40],Base8_EAX
0x40d480 -> Ins:3 type:0 op1:6 op2:0          ;Mov Base6_EDX,[0x40]     ;Base6_EDX = Base8_EAX

0x40d490 -> Ins:4 type:0 op1:0 op2:5          ;Mov [0x40],Base5_EBX
0x40d4a0 -> Ins:4 type:0 op1:1 op2:5          ;Mov [0x44],Base5_EBX
0x40d4b0 -> Ins:15 type:0 op1:0 op2:0         ;XOR [0x40],[0x44]
0x40d4c0 -> Ins:2 type:0 op1:0 op2:0          ;Restore_Flag_60_To_0
0x40d4d0 -> Ins:3 type:0 op1:5 op2:0          ;Mov Base5_EBX,[0x40]     ;Base5_EBX = 0

0x40d4e0 -> Ins:4 type:0 op1:0 op2:7          ;Mov [0x40],Base7_ECX
0x40d4f0 -> Ins:8 type:2 op1:0 op2:0          ;Mov [0x40],ptr [0x40]
0x40d500 -> Ins:3 type:2 op1:5 op2:0          ;Mov Base5_EBX,[0x40]     ;Base5_EBX = *Base7_ECX

0x40d510 -> Ins:4 type:0 op1:0 op2:6          ;Mov [0x40],Base6_EDX
0x40d520 -> Ins:6 type:0 op1:1 op2:ff         ;Mov [0x44],ff
0x40d530 -> Ins:14 type:0 op1:0 op2:0         ;AND [0x40],[0x44]
0x40d540 -> Ins:3 type:0 op1:6 op2:0          ;Mov Base6_EDX,[0x40]     ;Base6_EDX &= 0xff

0x40d550 -> Ins:4 type:0 op1:0 op2:6          ;Mov [0x40],Base6_EDX
0x40d560 -> Ins:4 type:0 op1:1 op2:5          ;Mov [0x44],Base5_EBX
0x40d570 -> Ins:15 type:0 op1:0 op2:0         ;XOR [0x40],[0x44]
0x40d580 -> Ins:2 type:0 op1:0 op2:0          ;Restore_Flag_60_To_0
0x40d590 -> Ins:3 type:0 op1:6 op2:0          ;Mov Base6_EDX,[0x40]     ;Base6_EDX ^= Base5_EBX

0x40d5a0 -> Ins:4 type:0 op1:0 op2:8          ;Mov [0x40],Base8_EAX
0x40d5b0 -> Ins:6 type:0 op1:1 op2:8          ;Mov [0x44],8
0x40d5c0 -> Ins:18 type:0 op1:0 op2:0         ;SHR [0x40],[0x44]
0x40d5d0 -> Ins:3 type:0 op1:8 op2:0          ;Mov Base8_EAX,[0x40]     ;Base8_EAX >> 8

0x40d5e0 -> Ins:4 type:0 op1:0 op2:6          ;Mov [0x40],Base6_EDX
0x40d5f0 -> Ins:6 type:0 op1:1 op2:4          ;Mov [0x44],4
0x40d600 -> Ins:b type:0 op1:0 op2:0          ;MUL [0x40],[0x44]
0x40d610 -> Ins:6 type:0 op1:1 op2:40ece0     ;Mov [0x44],40ece0
0x40d620 -> Ins:9 type:0 op1:0 op2:0          ;Add [0x40],[0x44]
0x40d630 -> Ins:8 type:0 op1:0 op2:0          ;Mov [0x40],ptr [0x40]
0x40d640 -> Ins:3 type:0 op1:6 op2:0          ;Mov Base6_EDX,[0x40]     ;Base6_EDX = *(0x40ece0 + Base6_EDX*4)

0x40d650 -> Ins:4 type:0 op1:0 op2:8          ;Mov [0x40],Base8_EAX
0x40d660 -> Ins:4 type:0 op1:1 op2:6          ;Mov [0x44],Base6_EDX
0x40d670 -> Ins:16 type:0 op1:0 op2:0         ;OR [0x40],[0x44]
0x40d680 -> Ins:2 type:0 op1:0 op2:0          ;Restore_Flag_60_To_0
0x40d690 -> Ins:3 type:0 op1:8 op2:0          ;Mov Base8_EAX,[0x40]     ;Base8_EAX |= Base6_EDX

0x40d6a0 -> Ins:4 type:0 op1:0 op2:7          ;Mov [0x40],Base7_ECX
0x40d6b0 -> Ins:6 type:0 op1:1 op2:1          ;Mov [0x44],1
0x40d6c0 -> Ins:f type:0 op1:0 op2:0          ;AddEx [0x40],[0x44]
0x40d6d0 -> Ins:3 type:0 op1:7 op2:0          ;Mov Base7_ECX,[0x40]     ;Base7_ECX += 1

0x40d6e0 -> Ins:4 type:0 op1:0 op2:2          ;Mov [0x40],Base2_ESI
0x40d6f0 -> Ins:6 type:0 op1:1 op2:1          ;Mov [0x44],1
0x40d700 -> Ins:10 type:0 op1:0 op2:0         ;SubEx [0x40],[0x44]
0x40d710 -> Ins:3 type:0 op1:2 op2:0          ;Mov Base2_ESI,[0x40]     ;Base2_ESI -= 1

0x40d720 -> Ins:d type:0 op1:2 op2:0          ;Check_Flag_60_To_64      ;if (Base2_ESI > 0 ) jmp Loop1
0x40d730 -> Ins:e type:0 op1:-45 op2:0        ;Jmp -45, ByFlagCheckResult64 ; jmp 0x40d470

0x40d740 -> Ins:4 type:0 op1:0 op2:4          ;Mov [0x40],Base4_ESP
0x40d750 -> Ins:8 type:0 op1:1 op2:0          ;Mov [0x44],ptr [0x40]
0x40d760 -> Ins:3 type:0 op1:5 op2:1          ;Mov Base5_EBX,[0x44]     ;Base5_EBX = *Base4_ESP

0x40d770 -> Ins:4 type:0 op1:0 op2:4          ;Mov [0x40],Base4_ESP
0x40d780 -> Ins:6 type:0 op1:1 op2:4          ;Mov [0x44],4
0x40d790 -> Ins:9 type:0 op1:0 op2:0          ;Add [0x40],[0x44]

Next1:
0x40d7a0 -> Ins:3 type:0 op1:4 op2:0          ;Mov Base4_ESP,[0x40]     ;Base4_ESP += 4

0x40d7b0 -> Ins:4 type:0 op1:0 op2:8          ;Mov [0x40],Base8_EAX
0x40d7c0 -> Ins:17 type:0 op1:0 op2:0         ;NOT [0x40]
0x40d7d0 -> Ins:3 type:0 op1:8 op2:0          ;Mov Base8_EAX,[0x40]     ;~Base8_EAX

0x40d7e0 -> Ins:4 type:0 op1:0 op2:4          ;Mov [0x40],Base4_ESP
0x40d7f0 -> Ins:8 type:0 op1:1 op2:0          ;Mov [0x44],ptr [0x40]
0x40d800 -> Ins:3 type:0 op1:2 op2:1          ;Mov Base2_ESI,[0x44]     ;Base2_ESI = *Base4_ESP

0x40d810 -> Ins:4 type:0 op1:0 op2:4          ;Mov [0x40],Base4_ESP
0x40d820 -> Ins:6 type:0 op1:1 op2:4          ;Mov [0x44],4
0x40d830 -> Ins:9 type:0 op1:0 op2:0          ;Add [0x40],[0x44]
0x40d840 -> Ins:3 type:0 op1:4 op2:0          ;Mov Base4_ESP,[0x40]     ;Base4_ESP += 4

0x40d850 -> Ins:4 type:0 op1:0 op2:4          ;Mov [0x40],Base4_ESP
0x40d860 -> Ins:8 type:0 op1:7 op2:0          ;Mov [0x5c],ptr [0x40]    ;[0x5c] = *Base4_ESP ; return to eip of last normal call

0x40d870 -> Ins:4 type:0 op1:0 op2:4          ;Mov [0x40],Base4_ESP
0x40d880 -> Ins:6 type:0 op1:1 op2:4          ;Mov [0x44],4
0x40d890 -> Ins:9 type:0 op1:0 op2:0          ;Add [0x40],[0x44]
0x40d8a0 -> Ins:3 type:0 op1:4 op2:0          ;Mov Base4_ESP,[0x40]     ;Base4_ESP += 4

0x40d8b0 -> Ins:2 type:0 op1:0 op2:0          ;Restore_Flag_60_To_0
0x40d8c0 -> Ins:0 type:0 op1:0 op2:0          ;RestoreStack


GetLength:

0x40d948 -> Ins:1 type:0 op1:0 op2:0          ;Backup_Flag_0_To_60

0x40d958 -> Ins:4 type:0 op1:0 op2:4          ;Mov [0x40],Base4_ESP
0x40d968 -> Ins:6 type:0 op1:1 op2:-4         ;Mov [0x44],-4
0x40d978 -> Ins:9 type:0 op1:0 op2:0          ;Add [0x40],[0x44]
0x40d988 -> Ins:3 type:0 op1:4 op2:0          ;Mov Base4_ESP,[0x40]     ;Base4_ESP -= 4

0x40d998 -> Ins:4 type:0 op1:1 op2:2          ;Mov [0x44],Base2_ESI
0x40d9a8 -> Ins:7 type:0 op1:0 op2:1          ;Mov ptr [0x40],[0x44]    ;*Base4_ESP = Base2_ESI

0x40d9b8 -> Ins:4 type:0 op1:0 op2:3          ;Mov [0x40],Base3_EBP
0x40d9c8 -> Ins:6 type:0 op1:1 op2:30         ;Mov [0x44],30
0x40d9d8 -> Ins:a type:0 op1:0 op2:0          ;SUB [0x40],[0x44]
0x40d9e8 -> Ins:8 type:0 op1:0 op2:0          ;Mov [0x40],ptr [0x40]
0x40d9f8 -> Ins:3 type:0 op1:2 op2:0          ;Mov Base2_ESI,[0x40]     ;Base2_ESI = *(Base3_EBP - 0x30)  ; --> Data

0x40da08 -> Ins:4 type:0 op1:0 op2:2          ;Mov [0x40],Base2_ESI
0x40da18 -> Ins:6 type:0 op1:1 op2:8          ;Mov [0x44],8
0x40da28 -> Ins:9 type:0 op1:0 op2:0          ;Add [0x40],[0x44]
0x40da38 -> Ins:8 type:0 op1:0 op2:0          ;Mov [0x40],ptr [0x40]
0x40da48 -> Ins:3 type:0 op1:8 op2:0          ;Mov Base8_EAX,[0x40]     ;Base8_EAX = *(Base2_ESI + 8)     ; Data length

0x40da58 -> Ins:4 type:0 op1:0 op2:4          ;Mov [0x40],Base4_ESP
0x40da68 -> Ins:6 type:0 op1:1 op2:-4         ;Mov [0x44],-4
0x40da78 -> Ins:9 type:0 op1:0 op2:0          ;Add [0x40],[0x44]
0x40da88 -> Ins:3 type:0 op1:4 op2:0          ;Mov Base4_ESP,[0x40]     ;Base4_ESP -= 4

0x40da98 -> Ins:4 type:0 op1:1 op2:8          ;Mov [0x44],Base8_EAX
0x40daa8 -> Ins:7 type:0 op1:0 op2:1          ;Mov ptr [0x40],[0x44]    ;*Base4_ESP = Base8_EAX            ; Data length

0x40dab8 -> Ins:4 type:0 op1:0 op2:2          ;Mov [0x40],Base2_ESI
0x40dac8 -> Ins:3 type:0 op1:8 op2:0          ;Mov Base8_EAX,[0x40]     ;Base8_EAX = Base2_ESI

0x40dad8 -> Ins:4 type:0 op1:0 op2:8          ;Mov [0x40],Base8_EAX
0x40dae8 -> Ins:6 type:0 op1:1 op2:10         ;Mov [0x44],10
0x40daf8 -> Ins:f type:0 op1:0 op2:0          ;AddEx [0x40],[0x44]
0x40db08 -> Ins:3 type:0 op1:8 op2:0          ;Mov Base8_EAX,[0x40]     ;Base8_EAX += 0x10

0x40db18 -> Ins:4 type:0 op1:0 op2:4          ;Mov [0x40],Base4_ESP
0x40db28 -> Ins:6 type:0 op1:1 op2:-4         ;Mov [0x44],-4
0x40db38 -> Ins:9 type:0 op1:0 op2:0          ;Add [0x40],[0x44]
0x40db48 -> Ins:3 type:0 op1:4 op2:0          ;Mov Base4_ESP,[0x40]     ;Base4_ESP -= 4

0x40db58 -> Ins:4 type:0 op1:1 op2:8          ;Mov [0x44],Base8_EAX
0x40db68 -> Ins:7 type:0 op1:0 op2:1          ;Mov ptr [0x40],[0x44]    ;*Base4_ESP = Base8_EAX           ;Data body

0x40db78 -> Ins:2 type:0 op1:0 op2:0          ;Restore_Flag_60_To_0


CheckCRC:                                     ;Base2_ESI-->Data, *(Base2_ESI+0x0c)-->CRC; Base8_EAX-->Calculated CRC

0x40db88 -> Ins:1 type:0 op1:0 op2:0          ;Backup_Flag_0_To_60

0x40db98 -> Ins:4 type:0 op1:0 op2:4          ;Mov [0x40],Base4_ESP
0x40dba8 -> Ins:6 type:0 op1:1 op2:8          ;Mov [0x44],8
0x40dbb8 -> Ins:f type:0 op1:0 op2:0          ;AddEx [0x40],[0x44]
0x40dbc8 -> Ins:3 type:0 op1:4 op2:0          ;Mov Base4_ESP,[0x40]    ;Base4_ESP += 8

0x40dbd8 -> Ins:4 type:0 op1:0 op2:2          ;Mov [0x40],Base2_ESI
0x40dbe8 -> Ins:6 type:0 op1:1 op2:c          ;Mov [0x44],c
0x40dbf8 -> Ins:9 type:0 op1:0 op2:0          ;Add [0x40],[0x44]
0x40dc08 -> Ins:8 type:0 op1:1 op2:0          ;Mov [0x44],ptr [0x40]   ;[0x44] = *(Base2_ESI+0x0c)
0x40dc18 -> Ins:4 type:0 op1:0 op2:8          ;Mov [0x40],Base8_EAX   
0x40dc28 -> Ins:10 type:0 op1:0 op2:0         ;SubEx [0x40],[0x44]     ;[0x40] = Base8_EAX - *(Base2_ESI+0x0c))
0x40dc38 -> Ins:d type:0 op1:2 op2:0          ;Check_Flag_60_To_64     ;if ( Base8_EAX > 0 ) jmp Next1
0x40dc48 -> Ins:e type:0 op1:5 op2:0          ;Jmp 5, ByFlagCheckResult64

0x40dc58 -> Ins:4 type:0 op1:0 op2:3          ;Mov [0x40],Base3_EBP
0x40dc68 -> Ins:6 type:0 op1:1 op2:2c         ;Mov [0x44],2c
0x40dc78 -> Ins:a type:0 op1:0 op2:0          ;SUB [0x40],[0x44]       ;[0x40] = Base3_EBP - 0x2c
0x40dc88 -> Ins:6 type:0 op1:1 op2:1          ;Mov [0x44],1            ;[0x44] = 1
0x40dc98 -> Ins:7 type:0 op1:0 op2:1          ;Mov ptr [0x40],[0x44]   ;*[0x40] = [0x44],  1->OK, CRC->Error ; Base3_EBP - 0x2c ->OK, Base8_EAX - *(Base2_ESI+0x0c)) -> Crash

Next1:
0x40dca8 -> Ins:4 type:0 op1:0 op2:4          ;Mov [0x40],Base4_ESP
0x40dcb8 -> Ins:8 type:0 op1:1 op2:0          ;Mov [0x44],ptr [0x40]
0x40dcc8 -> Ins:3 type:0 op1:2 op2:1          ;Mov Base2_ESI,[0x44]    ;Base2_ESI = *Base4_ESP

0x40dcd8 -> Ins:4 type:0 op1:0 op2:4          ;Mov [0x40],Base4_ESP
0x40dce8 -> Ins:6 type:0 op1:1 op2:4          ;Mov [0x44],4
0x40dcf8 -> Ins:9 type:0 op1:0 op2:0          ;Add [0x40],[0x44]
0x40dd08 -> Ins:3 type:0 op1:4 op2:0          ;Mov Base4_ESP,[0x40]    ;Base4_ESP += 4

0x40dd18 -> Ins:2 type:0 op1:0 op2:0          ;Restore_Flag_60_To_0



问题一解决方案、
检测固定CRC值
VM指令修改
0x40dc18 -> Ins:4 type:0 op1:0 op2:8          ;Mov [0x40],Base8_EAX   
---------->     6      0     0     2c09709d                           ;Mov [0x40],0x2c09709d
文件修改
c418 04 -> 06
c420 00 00 00 00 -> 9d 70 09 2c

问题二解决方案、
只检验word长度,0x10016->0x16
VM指令修改
0x40d700 -> Ins:10 type:0 op1:0 op2:0         ;SubEx [0x40],[0x44]
---------->     10      1     0     0
文件修改
bf02 00 -> 01

也许出题者的思路是要求答题者更正CRC算法,但对答题者来说,修改CRC算法部分的VM指令和修改CRC校验部分的VM指令,本质上是一样的,都满足此题目要求。

[课程]FART 脱壳王!加量不加价!FART作者讲授!

上传的附件:
收藏
免费 7
支持
分享
最新回复 (40)
雪    币: 2105
活跃值: (424)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
2
你又NB了,和谐前留名
2010-11-1 12:11
0
雪    币: 233
活跃值: (285)
能力值: ( LV12,RANK:270 )
在线值:
发帖
回帖
粉丝
3
囧……比赛延时了吧……
2010-11-1 12:11
0
雪    币: 2586
活跃值: (920)
能力值: ( LV12,RANK:1010 )
在线值:
发帖
回帖
粉丝
4
nb~~~~~~~~
2010-11-1 12:12
0
雪    币: 101
活跃值: (88)
能力值: ( LV2,RANK:140 )
在线值:
发帖
回帖
粉丝
5
我编辑不了, 管理员删贴吧.
2010-11-1 12:14
0
雪    币: 2586
活跃值: (920)
能力值: ( LV12,RANK:1010 )
在线值:
发帖
回帖
粉丝
6
~~~~~~~~~
2010-11-1 12:16
0
雪    币: 28972
活跃值: (7453)
能力值: ( LV15,RANK:3306 )
在线值:
发帖
回帖
粉丝
7
..............
2010-11-1 12:16
0
雪    币: 6051
活跃值: (1441)
能力值: ( LV15,RANK:1473 )
在线值:
发帖
回帖
粉丝
8
哈哈,这贴杯具了
2010-11-1 12:17
0
雪    币: 468
活跃值: (52)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
9
虚拟机,貌似有点面熟
2010-11-1 12:19
0
雪    币: 8209
活跃值: (4458)
能力值: ( LV15,RANK:2459 )
在线值:
发帖
回帖
粉丝
10
楼主不用怕
貌似只是第二题出题时间的延时,没说第一题答题时间延时
2010-11-1 12:19
0
雪    币: 2105
活跃值: (424)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
11
百度快照里面还有~~~~~~~~
2010-11-1 12:21
0
雪    币: 101
活跃值: (88)
能力值: ( LV2,RANK:140 )
在线值:
发帖
回帖
粉丝
12
浪费我一篇精华...
2010-11-1 12:21
0
雪    币: 28972
活跃值: (7453)
能力值: ( LV15,RANK:3306 )
在线值:
发帖
回帖
粉丝
13
修正了...........
2010-11-1 12:23
0
雪    币: 101
活跃值: (88)
能力值: ( LV2,RANK:140 )
在线值:
发帖
回帖
粉丝
14
管理员动作真快,修改、恢复挥手之间。
多谢了!
2010-11-1 12:29
0
雪    币: 1126
活跃值: (156)
能力值: ( LV9,RANK:210 )
在线值:
发帖
回帖
粉丝
15
貌似题意理解有偏差
2010-11-1 12:31
0
雪    币: 296
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
16
剑走偏峰!!!
2010-11-1 12:35
0
雪    币: 370
活跃值: (52)
能力值: ( LV13,RANK:350 )
在线值:
发帖
回帖
粉丝
17
应该是这样估计
DWORD GetVerifyValue(LPCTSTR Str,DWORD Len)
{
	DWORD VerifyValue=0xFFFFFFFF,Temp;
	DWORD i=0;

	for (i=0;i<Len;i++)
	{
		Temp=VerifyValue&0xFF;
		Temp^=*(PBYTE)(Str+i);
		VerifyValue>>=8;
		Temp*=4;
		Temp=*(PDWORD)(Key+Temp);
		VerifyValue^=Temp;//Bug 原本该异或运算的 写成了或运算了
	//	VerifyValue|=Temp;
	}
	return ~VerifyValue;
}
2010-11-1 12:36
0
雪    币: 59
活跃值: (55)
能力值: ( LV3,RANK:30 )
在线值:
发帖
回帖
粉丝
18
楼主第一个问题解决貌似不是本质吧。
应该是
0040DC38  0D 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00
还原:MOV  VM_Stack[9], ZFSF(VM_Stack[8])  
OP1=2 意思是检测ZF位,应该检测SF
这条指令原来意图应该是检测SF位而不是ZF位,所以这里传递02参数不对改成04就检测SF位。
2010-11-1 12:42
0
雪    币: 8209
活跃值: (4458)
能力值: ( LV15,RANK:2459 )
在线值:
发帖
回帖
粉丝
19
题目的言外之意是如果正确解决了问题,再给你若干个输入文件,都要有正确的输出结果
题目提供的3个输入文件只是3种不同的样本,答题者完美的解决方案要适用于所有的样本
2010-11-1 13:00
0
雪    币: 7309
活跃值: (3778)
能力值: (RANK:1130 )
在线值:
发帖
回帖
粉丝
20
不急,还有2天时间,大家讨论一下,给个最完美的方案一起提交,都是满分
2010-11-1 13:07
0
雪    币: 206
活跃值: (186)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
21
楼主对问题二解决的也不是很完美啊,应该要改为检测byte长度,如果按楼主的解决办法修改EXE文件。那把.dat文件中记录的字串长度由0x10016改为0xFFFF,楼主的改法仍然会引起Crash。
2010-11-1 13:17
0
雪    币: 59
活跃值: (55)
能力值: ( LV3,RANK:30 )
在线值:
发帖
回帖
粉丝
22
你如何知道用户要输入多大范围。
2010-11-1 13:18
0
雪    币: 8209
活跃值: (4458)
能力值: ( LV15,RANK:2459 )
在线值:
发帖
回帖
粉丝
23
局部变量里有个文件大小的值[ebp-20h],可以用来参考计算
2010-11-1 13:22
0
雪    币: 206
活跃值: (186)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
24
限定字串的计算长度即可。不管dat中记录的字符串有多长,最多只计算前面的0xFF字节的CRC32。
既然题目要求的是修正EXE读取DAT时判断字串长度有错误的语句,而不是修正读crash.dat文件错误的问题,按楼主所说的去修改当然会显得不完美了。

题目要求:
1 描述正确文件也会检验失败的问题的原因并进行修正
2 描述异常文件会导致Crash的原因并进行修正

评分标准
4 修正题目要求中的第二点得20分。
2010-11-1 13:26
0
雪    币: 154
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
25
题目要求一
描述正确文件也会检验失败的问题的原因并进行修正?
原因:校验函数(地址401000) 成功与否标志变量未初始化
正确bool result=?
变量result未初始化
解决方法 变量定义时给result=1或者true就可以了

题目二
描述异常文件会导致Crash的原因并进行修正?
原因:两次关闭同一打开文件句柄
解决方法 NOP掉其中一处CALL即可
2010-11-1 13:27
0
游客
登录 | 注册 方可回帖
返回
//