下载附件,为64位ELF文件。
在IDA中打开,找到主函数观察,找到如下关键函数:
if ( childCheckDebugResult() ) { responseFalse(); } else if ( bufParentRead[0] == 123 ) { if ( strlen(bufParentRead) == 42 ) { if ( !strncmp(&bufParentRead[1], "53fc275d81", 0xAuLL) ) { if ( bufParentRead[strlen(bufParentRead) - 1] == 125 ) { if ( !strncmp(&bufParentRead[31], "4938ae4efd", 0xAuLL) ) { if ( !confuseKey(bufParentRead, 42) ) { responseFalse(); } else if ( !strncmp(bufParentRead, "{daf29f59034938ae4efd53fc275d81053ed5be8c}", 0x2AuLL) ) { responseTrue(); }
在此之前还进行了是否为debug,输入是否为全数字等检测,我们只需要在这段代码中找出正确的flag即可。
跟进 confusekey 函数,观察如下关键代码:
strncpy(szPart1, szKey + 1, 0xAuLL); strncpy(szPart2, szKey + 11, 0xAuLL); strncpy(szPart3, szKey + 21, 0xAuLL); strncpy(szPart4, szKey + 31, 0xAuLL); memset(szKey, 0, iKeyLength); *szKey = 123; strcat(szKey, szPart3); strcat(szKey, szPart4); strcat(szKey, szPart1); strcat(szKey, szPart2);
对输入进行位置上的交换,分为4部分,每部分长10(不包括 { }):Key(1,2,3,4)→key(3,4,1,2)="{daf29f59034938ae4efd53fc275d81053ed5be8c}"
还原出正确的Key:{53fc275d81053ed5be8cdaf29f59034938ae4efd}
在linux运行检测,提示正确。
但是提交flag的时候提示错误,后来才发现flag不需要 { },真滴坑。
解题完毕~~~