2020-钓鱼城杯
re reg 打开程序发现调用方式很奇怪,调试直接运行然后暂停通过stack trace找到输入函数,以宽字符输入然后处理成字符串,接着生成了两串数据,在这里绕了很久,总在找生成逻辑,实际上生成的数和输入没有关系,每次运行都会生成同样的数
1 2 e3 dfb24 a5553 edac13 ff65 ac7 b5 f3170   9 d25 dde0 c 137862132 ec0 c 324 cfbf046 
发现之后接着调试,程序调用了wincrypt的API用来加密,根据传入的数据查到AES加密,整个程序的逻辑为,用生成的两串数作为iv和key,输入作为明文,输出经过base64编码之后显示到终端并写入到文件里,所以直接解密即可
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 from  Crypto.Cipher import  AESfrom  binascii import  b2a_hex, a2b_hexdef  add_to_16 (text ):    if  len (text.encode('utf-8' )) % 16 :         add = 16  - (len (text.encode('utf-8' )) % 16 )     else :         add = 0      text = text + ('\0'  * add)     return  text.encode('utf-8' ) def  decrypt (text ):    key = b"\xe3\xdf\xb2\x4a\x55\x53\xed\xac\x13\xff\x65\xac\x7b\x5f\x31\x70"      iv = b"\x9d\x25\xdd\xe0\xc1\x37\x86\x21\x32\xec\x0c\x32\x4c\xfb\xf0\x46"      mode = AES.MODE_CBC     cryptos = AES.new(key, mode, iv)     plain_text = cryptos.decrypt(a2b_hex(text))     return  plain_text if  __name__ == '__main__' :    d = decrypt(         b"F10014173233C3482DACB7915297AC89E45781087077C39F4F00C832B6C12DA6D2C75E4133CE84FB6440B10FD124A72A" )     print ("解密:" , d) 
 
    
    
Comments