北邮两道REVERSE网安杯题目解析
BIN来自https://bbs.pediy.com/thread-225623.htm感谢PEDIY的无名侠提供。
第3道题只能在WIN7以上运行,我的XP跑不了,有时间再来TRY一TRY。
题目的水平确实一般,不水也不难,属于入门稍次级。
第一题:
00401490 .81EC 84000000 sub esp,0x84
00401496 .56 push esi
00401497 .8BF1 mov esi,ecx
00401499 .57 push edi
0040149A .B9 18000000 mov ecx,0x18
0040149F .33C0 xor eax,eax
004014A1 .8D7C24 29 lea edi,dword ptr ss:
004014A5 .C64424 28 00mov byte ptr ss:,0x0
004014AA .B2 52 mov dl,0x52
004014AC .F3:AB rep stos dword ptr es:
004014AE .66:AB stos word ptr es:
004014B0 .AA stos byte ptr es:
004014B1 .B0 43 mov al,0x43
004014B3 .B1 01 mov cl,0x1
004014B5 .884424 12 mov byte ptr ss:,al
004014B9 .884424 1A mov byte ptr ss:,al
004014BD .884424 1D mov byte ptr ss:,al
004014C1 .8D4424 28 lea eax,dword ptr ss:
004014C5 .885424 0F mov byte ptr ss:,dl
004014C9 .885424 16 mov byte ptr ss:,dl
004014CD .6A 64 push 0x64
004014CF .884C24 0F mov byte ptr ss:,cl
004014D3 .B2 57 mov dl,0x57
004014D5 .884C24 28 mov byte ptr ss:,cl
004014D9 .884C24 29 mov byte ptr ss:,cl
004014DD .884C24 2A mov byte ptr ss:,cl
004014E1 .50 push eax
004014E2 .68 E8030000 push 0x3E8
004014E7 .8BCE mov ecx,esi
004014E9 .C64424 18 77mov byte ptr ss:,0x77
004014EE .C64424 19 11mov byte ptr ss:,0x11
004014F3 .C64424 1A 4Dmov byte ptr ss:,0x4D
004014F8 .C64424 1C 6Emov byte ptr ss:,0x6E
004014FD .C64424 1D 17mov byte ptr ss:,0x17
00401502 .C64424 1F 67mov byte ptr ss:,0x67
00401507 .C64424 20 12mov byte ptr ss:,0x12
0040150C .C64424 21 4Dmov byte ptr ss:,0x4D
00401511 .C64424 23 61mov byte ptr ss:,0x61
00401516 .C64424 24 50mov byte ptr ss:,0x50
0040151B .C64424 25 45mov byte ptr ss:,0x45
00401520 .C64424 27 49mov byte ptr ss:,0x49
00401525 .885424 28 mov byte ptr ss:,dl
00401529 .C64424 2A 77mov byte ptr ss:,0x77
0040152E .C64424 2B 53mov byte ptr ss:,0x53
00401533 .C64424 2C 65mov byte ptr ss:,0x65
00401538 .C64424 2D 41mov byte ptr ss:,0x41
0040153D .885424 2E mov byte ptr ss:,dl
00401541 .C64424 2F 79mov byte ptr ss:,0x79
00401546 .C64424 33 00mov byte ptr ss:,0x0
0040154B .E8 EE020000 call <jmp.&MFC42.#CWnd::GetDlgItemTextA_>;取输入
00401550 .83F8 23 cmp eax,0x23 ;长度需要在10 - 35位之间
00401553 .77 05 ja short re1.0040155A
00401555 .83F8 0A cmp eax,0xA
00401558 .73 13 jnb short re1.0040156D
0040155A >6A 00 push 0x0
0040155C .68 94304000 push re1.00403094 ;ASCII "hint"
00401561 .68 64304000 push re1.00403064 ;ASCII "The length of string is too long or too small!"
00401566 .8BCE mov ecx,esi
00401568 .E8 CB020000 call <jmp.&MFC42.#CWnd::MessageBoxA_4224>
0040156D >807C24 28 42cmp byte ptr ss:,0x42 ;'B'
00401572 .0F85 90000000 jnz re1.00401608
00401578 .807C24 29 55cmp byte ptr ss:,0x55 ;'U'
0040157D .0F85 85000000 jnz re1.00401608
00401583 .807C24 2B 54cmp byte ptr ss:,0x54 ;'T'
00401588 .75 7E jnz short re1.00401608
0040158A .807C24 2A 50cmp byte ptr ss:,0x50 ;'P'
0040158F .75 77 jnz short re1.00401608
00401591 .807C24 2C 7Bcmp byte ptr ss:,0x7B ;'{'
00401596 .75 70 jnz short re1.00401608
00401598 .807C24 48 7Dcmp byte ptr ss:,0x7D
0040159D .75 69 jnz short re1.00401608 ;以上对注册码中的特定位进行检查
0040159F .B8 05000000 mov eax,0x5 ;从第5位开始取到第31位
004015A4 >8A4C04 28 mov cl,byte ptr ss: ;CL - 取1位
004015A8 .FEC1 inc cl
004015AA .80F1 23 xor cl,0x23
004015AD .884C04 28 mov byte ptr ss:,cl
004015B1 .40 inc eax
004015B2 .83F8 20 cmp eax,0x20 ;保存
004015B5 .^ 7C ED jl short re1.004015A4
004015B7 .33C0 xor eax,eax
004015B9 >8A5404 2D mov dl,byte ptr ss:
004015BD .8A4C04 0C mov cl,byte ptr ss: ;循环比较数组
004015C1 .3AD1 cmp dl,cl
004015C3 .74 05 je short re1.004015CA
004015C5 .C64424 0B 00mov byte ptr ss:,0x0
004015CA >40 inc eax
004015CB .8D48 05 lea ecx,dword ptr ds:
004015CE .83F9 20 cmp ecx,0x20
004015D1 .^ 7C E6 jl short re1.004015B9
004015D3 .8A4424 0B mov al,byte ptr ss:
004015D7 .6A 00 push 0x0
004015D9 .84C0 test al,al
004015DB .74 1A je short re1.004015F7
004015DD .68 5C304000 push re1.0040305C ;ASCII "Success"
004015E2 .68 48304000 push re1.00403048 ;ASCII "Congratulations!"
004015E7 .8BCE mov ecx,esi
004015E9 .E8 4A020000 call <jmp.&MFC42.#CWnd::MessageBoxA_4224>
004015EE .5F pop edi
004015EF .5E pop esi
004015F0 .81C4 84000000 add esp,0x84
004015F6 .C3 retn
004015F7 >68 40304000 push re1.00403040 ;ASCII "Fail"
004015FC .68 20304000 push re1.00403020 ;ASCII "I'm so Sorry,Please try again!"
00401601 .8BCE mov ecx,esi
00401603 .E8 30020000 call <jmp.&MFC42.#CWnd::MessageBoxA_4224>
00401608 >5F pop edi
00401609 .5E pop esi
0040160A .81C4 84000000 add esp,0x84
00401610 .C3 retn
开头是先固定检验一下注册码的几位。
同时可以推算出,注册码的格式如下。
BUPT{27个字符}
Anyway,这道题目就是把每个字符的ASCII码递增,与0x23异或,最后把结果与一数组比较,等于则成功。
XOR密文如下:
77 11 4D 52 6E 17 43 67 12 4D 52 61 50 45 43 49 57 43 77 53 65 41 57 79 01 01 01
写段代码解出来即可。
int _tmain(int argc, _TCHAR* argv[])
{
char flag[] = {0x77, 0x11, 0x4D, 0x52, 0x6E, 0x17, 0x43, 0x67, 0x12, 0x4D, 0x52,
0x61, 0x50, 0x45, 0x43, 0x49, 0x57, 0x43, 0x77, 0x53, 0x65, 0x41, 0x57, 0x79, 0x01, 0x01, 0x01};
char code = {0};
for (int i = 0; i < sizeof(flag); i++)
code = (flag ^ 0x23) - 1;
printf("%s", code);
getchar();
return 0;
}
最后输出S1mpL3_C0mpAre_is_SoEasY!!!
最终注册码为:BUPT{S1mpL3_C0mpAre_is_SoEasY!!!}
总结:
第一道题目偏易,而且这个注册码大小写的风格,有没有本世纪初的逆向组织的名称的风格?推测出题人也是个密界元老。
第二题:
这一题属于密码学问题,不过开头就说了,Let's do a simple problem。可以猜到,肯定是很常见的加密算法,不会给出什么需要高端数学知识的算法。
题目我没有仔细看,开始看它初始化了一个256大小的数组,我初步猜测是RC4算法。
Anyway,因为猜测是RC4算法,所以我找到了处理加密流程的函数,将题目中搜索到的一串疑似密文的HEX代入,发现可逆,直接解出最终答案。
BUPT{rc4_Cryptography_1sSOEa5y!-_-!!!}
如果是RC4算法的话,那么密文是。
7C553E5F0EB4CCB977BF6BD960E0B968FB11CED2154B0EB5F73E51EE514D5A9C01A0C53AD038
注意是HEX,要转化一下。
密钥是SimpleCryptography。
按我的思路巧解是,输入26个字符,
004010DF|.50 push eax
004010E0|.51 push ecx
004010E1|.E8 CA000000 call re2.004011B0
这里会压入输入的注册码,直接将其修改为密文,进去跟踪,得到注册码的HEX。
转化为字符串即可得到注册码。
腻害腻害,学到了
腻害腻害,学到了
感谢楼主分享 强强强 一脸懵逼 学习大佬操作 感谢分享,看看 太高深了。 谢谢分享
[快捷回复]-软件反汇编逆向分析,软件安全必不可少!
页:
[1]
2