4道题做了3道,都不太方便纯静态,动调倒是都挺简单的。最后一题unity的游戏没什么经验,不知道怎么下手,CE也没下就放弃了。赛后又看了一下unity,也挺简单,只是好久没用dnspy,跟本没展开源码。
一
easy_xor
int __cdecl main(int argc, const char **argv, const char **envp)
{
int result; // eax
char v4; // [esp+0h] [ebp-1CCh]
sub_401020("please input your flag:", v4);
__asm { retn }
return result;
}
call $+5
,内联了一个没有用的函数,同时加了垃圾指令。.text:00401560 83 C4 04 add esp, 4
.text:00401563 55 push ebp
.text:00401564 E8 00 00 00 00 call $+5
.text:00401564
.text:00401569
.text:00401569 loc_401569: ; DATA XREF: _main+2B↓o
.text:00401569 5D pop ebp
.text:0040156A 48 dec eax
.text:0040156B 83 C5 08 add ebp, (offset loc_401570+1 - offset loc_401569)
.text:0040156E 55 push ebp
.text:0040156F C3 retn
.text:0040156F
.text:0040156F _main endp ; sp-analysis failed
.text:0040156F
.text:00401570 ; ---------------------------------------------------------------------------
.text:00401570
.text:00401570 loc_401570: ; DATA XREF: _main+2B↑o
.text:00401570 08 5D 8D or [ebp-73h], bl
int __cdecl main(int argc, const char **argv, const char **envp)
{
int i; // ecx
int v4; // ecx
char v6; // [esp-8h] [ebp-1D4h]
char v7; // [esp-4h] [ebp-1D0h]
char v8; // [esp+0h] [ebp-1CCh]
char flag[264]; // [esp+54h] [ebp-178h] BYREF
__int128 v10[4]; // [esp+15Ch] [ebp-70h]
int v11; // [esp+19Ch] [ebp-30h]
int v12; // [esp+1A0h] [ebp-2Ch]
int v13; // [esp+1A4h] [ebp-28h]
int v14; // [esp+1A8h] [ebp-24h]
int v15; // [esp+1ACh] [ebp-20h]
int v16; // [esp+1B0h] [ebp-1Ch]
int v17; // [esp+1B4h] [ebp-18h]
int v18; // [esp+1B8h] [ebp-14h]
int v19[3]; // [esp+1BCh] [ebp-10h] BYREF
sub_401020("please input your flag:", v8);
v11 = 50462976;
v12 = 117835012;
v13 = 185207048;
v14 = 252579084;
v15 = 319951120;
v16 = 387323156;
v17 = 454695192;
v18 = 522067228;
v19[0] = 0;
v19[1] = 1241513984;
v19[2] = 0;
memset(flag, 0, 0xC8u);
printf("%s", (char)flag);
if ( strlen(flag) == 46 )
{
v10[0] = *(_OWORD *)flag;
v10[1] = *(_OWORD *)&flag[16];
v10[2] = *(_OWORD *)&flag[32];
sub_401370(46);
sub_401080(v19);
for ( i = 0; i < 64; ++i )
{
if ( i >= 46 )
break;
*((_BYTE *)&v10[3] + i) = *((_BYTE *)v10 + i) ^ flag[i + 200];
}
v4 = 0;
while ( *((_BYTE *)&v10[3] + v4) == byte_403114[v4] )
{
if ( ++v4 >= 46 )
{
sub_401020("you get your flag,the flag is your input!", v7);
sub_401020("n", v6);
getchar();
return 0;
}
}
sub_401020("errorn", v7);
}
else
{
sub_401020("length error!", v7);
}
return 0;
}
*((_BYTE *)&v10[3] + i) = *((_BYTE *)v10 + i) ^ flag[i + 200];
flag[i+200]
是个很怪的地方,问题只能出在sub_401370
和sub_401080
上。void sub_401370()
{
__asm { retn }
}
int __usercall sub_401370@<eax>(unsigned __int8 *a1@<edx>, _DWORD *a2@<ecx>, int a3, unsigned __int8 *a4)
{
int v5; // ecx
int v6; // esi
int v7; // ecx
int v8; // eax
int v9; // ecx
int v10; // eax
int v11; // ecx
int v12; // eax
int v13; // ecx
int v14; // eax
int v15; // ecx
int v16; // eax
int v17; // ecx
int v18; // eax
int v19; // ecx
int v20; // eax
int v22; // ecx
int v23; // eax
int v24; // ecx
int v25; // eax
int v26; // ecx
int result; // eax
v5 = a1[7] << 8;
v6 = *((unsigned __int16 *)a1 + 1);
qmemcpy(a2, "expand 32-byte k", 16);
v7 = a1[5] | ((a1[6] | v5) << 8);
a2[4] = *a1 | ((a1[1] | (v6 << 8)) << 8);
v8 = a1[10];
a2[5] = a1[4] | (v7 << 8);
v9 = a1[8] | ((a1[9] | ((v8 | (a1[11] << 8)) << 8)) << 8);
v10 = a1[14];
a2[6] = v9;
v11 = a1[12] | ((a1[13] | ((v10 | (a1[15] << 8)) << 8)) << 8);
v12 = a1[18];
a2[7] = v11;
v13 = a1[16] | ((a1[17] | ((v12 | (a1[19] << 8)) << 8)) << 8);
v14 = a1[22];
a2[8] = v13;
v15 = a1[20] | ((a1[21] | ((v14 | (a1[23] << 8)) << 8)) << 8);
v16 = a1[26];
a2[9] = v15;
v17 = a1[24] | ((a1[25] | ((v16 | (a1[27] << 8)) << 8)) << 8);
v18 = a1[30];
a2[10] = v17;
v19 = a1[29] | ((v18 | (a1[31] << 8)) << 8);
v20 = a1[28];
a2[11] = v20 | (v19 << 8);
v22 = *((unsigned __int16 *)a4 + 1);
a2[12] = 1111;
v23 = a4[6];
a2[13] = *a4 | ((a4[1] | (v22 << 8)) << 8);
v24 = a4[4] | ((a4[5] | ((v23 | (a4[7] << 8)) << 8)) << 8);
v25 = a4[10];
a2[14] = v24;
v26 = a4[9] | ((v25 | (a4[11] << 8)) << 8);
result = a4[8];
a2[15] = result | (v26 << 8);
return result;
}
int __cdecl main(int argc, const char **argv, const char **envp)
{
int i; // ecx
int v4; // ecx
char v6; // [esp-8h] [ebp-1D4h]
char v7; // [esp-4h] [ebp-1D0h]
char v8; // [esp+0h] [ebp-1CCh]
__m128i v9[4]; // [esp+14h] [ebp-1B8h] BYREF
char flag[200]; // [esp+54h] [ebp-178h] BYREF
char xor_array[64]; // [esp+11Ch] [ebp-B0h] BYREF
char flag2[64]; // [esp+15Ch] [ebp-70h]
int v13[8]; // [esp+19Ch] [ebp-30h] BYREF
int v14[3]; // [esp+1BCh] [ebp-10h] BYREF
sub_401020("please input your flag:", v8);
v13[0] = 50462976;
v13[1] = 117835012;
v13[2] = 185207048;
v13[3] = 252579084;
v13[4] = 319951120;
v13[5] = 387323156;
v13[6] = 454695192;
v13[7] = 522067228;
v14[0] = 0;
v14[1] = 1241513984;
v14[2] = 0;
memset(flag, 0, sizeof(flag));
printf("%s", (char)flag);
if ( strlen(flag) == 46 )
{
*(_OWORD *)flag2 = *(_OWORD *)flag;
*(_OWORD *)&flag2[16] = *(_OWORD *)&flag[16];
*(_OWORD *)&flag2[32] = *(_OWORD *)&flag[32];
init((unsigned __int8 *)v13, v9, 46, (unsigned __int8 *)v14);
enc(v9, (int)xor_array);
for ( i = 0; i < 64; ++i )
{
if ( i >= 46 )
break;
flag2[i + 48] = flag2[i] ^ xor_array[i];
}
v4 = 0;
while ( flag2[v4 + 48] == cipher[v4] )
{
if ( ++v4 >= 46 )
{
sub_401020("you get your flag,the flag is your input!", v7);
sub_401020("n", v6);
getchar();
return 0;
}
}
sub_401020("errorn", v7);
}
else
{
sub_401020("length error!", v7);
}
return 0;
}
xor_array
数组,也与输入无关,那么动调可以直接得到。xor_array = [0xFF, 0x24, 0x3F, 0xDA, 0xBE, 0xA9, 0xB6, 0xF7, 0x12, 0x8F, 0x29, 0xD0, 0x73, 0xF7, 0xF7, 0xA2, 0x83, 0xAD, 0x5F, 0xB0, 0x51, 0x90, 0x3F, 0x68, 0xF6, 0x8C, 0xC1, 0x0A, 0xB7, 0xB5, 0xBC,
0x82, 0xCC, 0xFC, 0x67, 0xDE, 0xE9, 0xFF, 0x5B, 0xCB, 0xC9, 0x67, 0xEA, 0xF6, 0xA6, 0x1A, 0x39, 0x56, 0xCA, 0x23, 0x46, 0xE3, 0xC8, 0x71, 0x43, 0x53, 0xFF, 0x72, 0x2F, 0xC3, 0x5C, 0x1C, 0x5B, 0x94]
cipher = [0x99, 0x48, 0x5E, 0xBD, 0xC5, 0x9B, 0x85, 0x96, 0x20, 0xFC, 0x18, 0xB2, 0x00, 0xC5, 0xDA, 0xC0, 0xB1, 0xC8, 0x6C, 0x81, 0x63, 0xBD,
0x09, 0x50, 0xC2, 0xBB, 0xEC, 0x33, 0xD6, 0xD7, 0x8F, 0xAF, 0xAD, 0xCE, 0x14, 0xED, 0x8C, 0xCE, 0x6F, 0xA9, 0xA8, 0x02, 0x8C, 0x90, 0x94, 0x67]
for i in range(len(cipher)):
cipher[i] ^= xor_array[i]
print(bytes(cipher))
flag{23a2s1bs2-b2e312-6847-9ab3-a2s3e14baeff2}
二
T4ee
int __cdecl main_0(int argc, const char **argv, const char **envp)
{
__CheckForDebuggerJustMyCode(&unk_D8E0A7);
val1[0] = ret_address((int)j_part_1); // 将函数J_program_start地址传递到val1中
// 读取flag
j_add_address(val1[0], (int)part_2, val2); // 添加part_2地址到val1+4位置
// flag length
j_add_address(val1[0], (int)j_part_3, val3); // 添加part_3地址到val1+8位置
// arr1 ^= arr2
j_add_address(*(_DWORD *)(val1[0] + 4), (int)j_part_4, val2);// 添加part_4地址到val1+8的位置
// arr1等于打乱后的flag
j_add_address(*(_DWORD *)(val1[0] + 4), (int)j_part_5, val3);// 添加part_4地址到val1+12的位置
// rc4 key=GoodLuck
j_add_address(*(_DWORD *)(val1[0] + 8), (int)part_6, val2);// 添加part_4地址到val1+12的位置
// strcmp(arr1, cipher)
run(val1[0]);
return 0;
}
int __cdecl main(int argc, const char **argv, const char **envp) 0
{
int result; // eax
char v4; // [esp+0h] [ebp-1CCh]
sub_401020("please input your flag:", v4);
__asm { retn }
return result;
}
int __cdecl main(int argc, const char **argv, const char **envp) 1
{
int result; // eax
char v4; // [esp+0h] [ebp-1CCh]
sub_401020("please input your flag:", v4);
__asm { retn }
return result;
}
part4
int __cdecl main(int argc, const char **argv, const char **envp) 2
{
int result; // eax
char v4; // [esp+0h] [ebp-1CCh]
sub_401020("please input your flag:", v4);
__asm { retn }
return result;
}
part5
int __cdecl main(int argc, const char **argv, const char **envp) 3
{
int result; // eax
char v4; // [esp+0h] [ebp-1CCh]
sub_401020("please input your flag:", v4);
__asm { retn }
return result;
}
GoodLuck。
part3
int __cdecl main(int argc, const char **argv, const char **envp) 4
{
int result; // eax
char v4; // [esp+0h] [ebp-1CCh]
sub_401020("please input your flag:", v4);
__asm { retn }
return result;
}
int __cdecl main(int argc, const char **argv, const char **envp) 5
{
int result; // eax
char v4; // [esp+0h] [ebp-1CCh]
sub_401020("please input your flag:", v4);
__asm { retn }
return result;
}
int __cdecl main(int argc, const char **argv, const char **envp) 6
{
int result; // eax
char v4; // [esp+0h] [ebp-1CCh]
sub_401020("please input your flag:", v4);
__asm { retn }
return result;
}
flag{T4ee_Travel_M@kes_me_H@ppy!!}
int __cdecl main(int argc, const char **argv, const char **envp) 7
{
int result; // eax
char v4; // [esp+0h] [ebp-1CCh]
sub_401020("please input your flag:", v4);
__asm { retn }
return result;
}
int __cdecl main(int argc, const char **argv, const char **envp) 8
{
int result; // eax
char v4; // [esp+0h] [ebp-1CCh]
sub_401020("please input your flag:", v4);
__asm { retn }
return result;
}
REFTQ1RGe2hhc2FraS1wZHR6cHR6LXZ4bmZudX0=
)得到一个flagDASCTF{hasaki-pdtzptz-vxnfnu}
int __cdecl main(int argc, const char **argv, const char **envp) 9
{
int result; // eax
char v4; // [esp+0h] [ebp-1CCh]
sub_401020("please input your flag:", v4);
__asm { retn }
return result;
}
DASCTF{hasaki-pdtzptz-vxnfnu}
中的第一个部分hasaki
可以通过。.text:00401560 83 C4 04 add esp, 4 0
.text:00401563 55 push ebp
.text:00401564 E8 00 00 00 00 call $+5
.text:00401564
.text:00401569
.text:00401569 loc_401569: ; DATA XREF: _main+2B↓o
.text:00401569 5D pop ebp
.text:0040156A 48 dec eax
.text:0040156B 83 C5 08 add ebp, (offset loc_401570+1 - offset loc_401569)
.text:0040156E 55 push ebp
.text:0040156F C3 retn
.text:0040156F
.text:0040156F _main endp ; sp-analysis failed
.text:0040156F
.text:00401570 ; ---------------------------------------------------------------------------
.text:00401570
.text:00401570 loc_401570: ; DATA XREF: _main+2B↑o
.text:00401570 08 5D 8D or [ebp-73h], bl
unfnxv
rot13加密后得到的就是hasaki
,所以第一关的输入就是hasaki
DASCTF{hasaki-pdtzptz-vxnfnu}
中的第三个部分vxnfnu
可以通过。vxnfnu。
.text:00401560 83 C4 04 add esp, 4 1
.text:00401563 55 push ebp
.text:00401564 E8 00 00 00 00 call $+5
.text:00401564
.text:00401569
.text:00401569 loc_401569: ; DATA XREF: _main+2B↓o
.text:00401569 5D pop ebp
.text:0040156A 48 dec eax
.text:0040156B 83 C5 08 add ebp, (offset loc_401570+1 - offset loc_401569)
.text:0040156E 55 push ebp
.text:0040156F C3 retn
.text:0040156F
.text:0040156F _main endp ; sp-analysis failed
.text:0040156F
.text:00401570 ; ---------------------------------------------------------------------------
.text:00401570
.text:00401570 loc_401570: ; DATA XREF: _main+2B↑o
.text:00401570 08 5D 8D or [ebp-73h], bl
DASCTF{hasaki-pdtzptz-vxnfnu}
的形式,只是中间那一段被处理了,我们调试这一部分。hasaki
,vxnfnu
,第三个直接输入错误的flag,通过调试看看差别在哪里。.text:00401560 83 C4 04 add esp, 4 2
.text:00401563 55 push ebp
.text:00401564 E8 00 00 00 00 call $+5
.text:00401564
.text:00401569
.text:00401569 loc_401569: ; DATA XREF: _main+2B↓o
.text:00401569 5D pop ebp
.text:0040156A 48 dec eax
.text:0040156B 83 C5 08 add ebp, (offset loc_401570+1 - offset loc_401569)
.text:0040156E 55 push ebp
.text:0040156F C3 retn
.text:0040156F
.text:0040156F _main endp ; sp-analysis failed
.text:0040156F
.text:00401570 ; ---------------------------------------------------------------------------
.text:00401570
.text:00401570 loc_401570: ; DATA XREF: _main+2B↑o
.text:00401570 08 5D 8D or [ebp-73h], bl
.text:00401560 83 C4 04 add esp, 4 3
.text:00401563 55 push ebp
.text:00401564 E8 00 00 00 00 call $+5
.text:00401564
.text:00401569
.text:00401569 loc_401569: ; DATA XREF: _main+2B↓o
.text:00401569 5D pop ebp
.text:0040156A 48 dec eax
.text:0040156B 83 C5 08 add ebp, (offset loc_401570+1 - offset loc_401569)
.text:0040156E 55 push ebp
.text:0040156F C3 retn
.text:0040156F
.text:0040156F _main endp ; sp-analysis failed
.text:0040156F
.text:00401570 ; ---------------------------------------------------------------------------
.text:00401570
.text:00401570 loc_401570: ; DATA XREF: _main+2B↑o
.text:00401570 08 5D 8D or [ebp-73h], bl
pdtzptz
,变成了uiyeuye。
.text:00401560 83 C4 04 add esp, 4 4
.text:00401563 55 push ebp
.text:00401564 E8 00 00 00 00 call $+5
.text:00401564
.text:00401569
.text:00401569 loc_401569: ; DATA XREF: _main+2B↓o
.text:00401569 5D pop ebp
.text:0040156A 48 dec eax
.text:0040156B 83 C5 08 add ebp, (offset loc_401570+1 - offset loc_401569)
.text:0040156E 55 push ebp
.text:0040156F C3 retn
.text:0040156F
.text:0040156F _main endp ; sp-analysis failed
.text:0040156F
.text:00401570 ; ---------------------------------------------------------------------------
.text:00401570
.text:00401570 loc_401570: ; DATA XREF: _main+2B↑o
.text:00401570 08 5D 8D or [ebp-73h], bl
DASCTF{hasaki-kyoukou-vxnfnu}
.text:00401560 83 C4 04 add esp, 4 5
.text:00401563 55 push ebp
.text:00401564 E8 00 00 00 00 call $+5
.text:00401564
.text:00401569
.text:00401569 loc_401569: ; DATA XREF: _main+2B↓o
.text:00401569 5D pop ebp
.text:0040156A 48 dec eax
.text:0040156B 83 C5 08 add ebp, (offset loc_401570+1 - offset loc_401569)
.text:0040156E 55 push ebp
.text:0040156F C3 retn
.text:0040156F
.text:0040156F _main endp ; sp-analysis failed
.text:0040156F
.text:00401570 ; ---------------------------------------------------------------------------
.text:00401570
.text:00401570 loc_401570: ; DATA XREF: _main+2B↑o
.text:00401570 08 5D 8D or [ebp-73h], bl
Robbie gave up/Robbie gave up_Data/Managed/Assembly-CSharp.dll
,使用dnspy打开Assembly-CSharp.dll就可以看到具体的逻辑代码了。WinZone。
.text:00401560 83 C4 04 add esp, 4 6
.text:00401563 55 push ebp
.text:00401564 E8 00 00 00 00 call $+5
.text:00401564
.text:00401569
.text:00401569 loc_401569: ; DATA XREF: _main+2B↓o
.text:00401569 5D pop ebp
.text:0040156A 48 dec eax
.text:0040156B 83 C5 08 add ebp, (offset loc_401570+1 - offset loc_401569)
.text:0040156E 55 push ebp
.text:0040156F C3 retn
.text:0040156F
.text:0040156F _main endp ; sp-analysis failed
.text:0040156F
.text:00401570 ; ---------------------------------------------------------------------------
.text:00401570
.text:00401570 loc_401570: ; DATA XREF: _main+2B↑o
.text:00401570 08 5D 8D or [ebp-73h], bl
ClassLibrary1.Class1
类,然后调用其中的方法得到flag。.text:00401560 83 C4 04 add esp, 4 7
.text:00401563 55 push ebp
.text:00401564 E8 00 00 00 00 call $+5
.text:00401564
.text:00401569
.text:00401569 loc_401569: ; DATA XREF: _main+2B↓o
.text:00401569 5D pop ebp
.text:0040156A 48 dec eax
.text:0040156B 83 C5 08 add ebp, (offset loc_401570+1 - offset loc_401569)
.text:0040156E 55 push ebp
.text:0040156F C3 retn
.text:0040156F
.text:0040156F _main endp ; sp-analysis failed
.text:0040156F
.text:00401570 ; ---------------------------------------------------------------------------
.text:00401570
.text:00401570 loc_401570: ; DATA XREF: _main+2B↑o
.text:00401570 08 5D 8D or [ebp-73h], bl
.text:00401560 83 C4 04 add esp, 4 8
.text:00401563 55 push ebp
.text:00401564 E8 00 00 00 00 call $+5
.text:00401564
.text:00401569
.text:00401569 loc_401569: ; DATA XREF: _main+2B↓o
.text:00401569 5D pop ebp
.text:0040156A 48 dec eax
.text:0040156B 83 C5 08 add ebp, (offset loc_401570+1 - offset loc_401569)
.text:0040156E 55 push ebp
.text:0040156F C3 retn
.text:0040156F
.text:0040156F _main endp ; sp-analysis failed
.text:0040156F
.text:00401570 ; ---------------------------------------------------------------------------
.text:00401570
.text:00401570 loc_401570: ; DATA XREF: _main+2B↑o
.text:00401570 08 5D 8D or [ebp-73h], bl
あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやよらりるれろわをぐげござじずぞだぢづでばびぶべぱぴぷぺぽ
はりずめはばぐだすだちずそぬけびせやのぞはとらよはやこらのとほめせだむばのだのぢはやよぢせりにやのばぢ
flag{33419b8662e9df2ea7a787c64f946ecc}
看雪ID:mi1itray.axe
https://bbs.kanxue.com/user-home-900501.htm
# 往期推荐
1、
2、
3、
4、
5、
6、
球分享
球点赞
球在看
推荐站内搜索:最好用的开发软件、免费开源系统、渗透测试工具云盘下载、最新渗透测试资料、最新黑客工具下载……
还没有评论,来说两句吧...