KCTF2021秋季赛WP

记得当时就做出来到签到题,

现在再来试试

签到题 身在何处

已知

用户名 : 01F845C5B7C52E56
序列号 : 653259165

求出用户名为KCTF的序列号,很明显要求写出注册机

反汇编如下

int __cdecl sub_401340(HWND hDlg)
{
int v1; // ebx
int v2; // ebx
int v3; // eax
int result; // eax
signed int v5; // [esp+Ch] [ebp-260h]
char v6[200]; // [esp+10h] [ebp-25Ch] BYREF
CHAR name[200]; // [esp+D8h] [ebp-194h] BYREF
CHAR serial_number[200]; // [esp+1A0h] [ebp-CCh] BYREF

memset(name, 0, sizeof(name));
memset(v6, 0, sizeof(v6));
memset(serial_number, 0, sizeof(serial_number));
v1 = GetDlgItemTextA(hDlg, 1000, name, 201);
if ( v1
&& (v5 = GetDlgItemTextA(hDlg, 1001, serial_number, 201),
v2 = sub_401260(name, v1),
strspn(serial_number, "0123456789") == strlen(serial_number))
&& v5 <= 10
&& (v3 = sub_40307F((int)serial_number)) != 0
&& (unknown_libname_13(v2 ^ v3, (int)v6, 16), sub_401260(v6, 8) == 330861687) )
{
SetDlgItemTextA(hDlg, 1001, "Success!");
result = 1;
}
else
{
SetDlgItemTextA(hDlg, 1001, "Wrong Serial!");
result = 0;
}
return result;
}

分析得 sub_401260函数要求求得为330861687 则,v6一定为一个固定的值,然后unknown_libname_13(v2 ^ v3, (int)v6, 16),v2为函数 sub_401260(name, v1),的返回值,v3 为函数sub_40307F((int)serial_number的返回值即可求出serial_number

接下来动调

得到v6 35 32 61 31 65 64 35 61 52a1ed5av6=52a1ed5a

KCTF动调得为0x5EE54F4C

print((0x5EE54F4C^0x52a1ed5a))
# 205824534