https://buuoj.cn/challenges#[2019%E7%BA%A2%E5%B8%BD%E6%9D%AF]childRE
64 PE
输入 → 置换顺序存在另一个数组里 → UnDecorateSymbolName → 比较
先看最后的比较部分
逆向脚本:
private: char * __thiscall R0Pxx::My_Aut0_PWN(unsigned char *)
UnDecorateSymbolName 函数,作用是按标准去修饰符号名字。修饰符号能增加数据信息,便于重载等高级操作。这里我们需要反过来修饰这个符号得到原来的输入
https://learn.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-undecoratesymbolname UnDecorateSymbolName 定义
https://www.cnblogs.com/Moomin/p/15810785.html WP
这里用 undname
工具尝试恢复出修饰的符号
undname ?My_Aut0_PWN@R0Pxx@@AAEPADPAE@Z
Microsoft (R) C++ Name Undecorator
Copyright (C) Microsoft Corporation. All rights reserved.
Undecoration of :- "?My_Aut0_PWN@R0Pxx@@AAEPADPAE@Z"
is :- "private: char * __thiscall R0Pxx::My_Aut0_PWN(unsigned char *)"
则原来为
?My_Aut0_PWN@R0Pxx@@AAEPADPAE@Z
接下来看看这段
试输入:
ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
动调在:
loc_7FF734FF16B1: ; CODE XREF: main+74↑j
.text:00007FF734FF16B1 lea rbx, outputString
.text:00007FF734FF16B8 xor r9d, r9d ; flags
.text:00007FF734FF16BB mov rdx, rbx ; outputString
.text:00007FF734FF16BE mov r8d, 100h ; maxStringLength
.text:00007FF734FF16C4 mov rcx, r11 ; name
.text:00007FF734FF16C7 call cs:UnDecorateSymbolName
.text:00007FF734FF16CD ; 36: outputString_len = -1i64;
.text:00007FF734FF16CD mov rcx, 0FFFFFFFFFFFFFFFFh
.text:00007FF734FF16D4 ; 38: ++outputString_len;
查看 r11 得到变换后的为:(其实就是二叉树遍历前序转后续啦)
PQHRSIDTUJVWKEBXYLZ[MF\]N^_OGCA
得到变换表:
15,16,7,17,18,8,3,19,20,9,21,22,10,4,1,23,24,11,25,26,12,5,27,28,13,29,30,14,6,2,0
63b148e750fed3a33419168ac58083f5