近日在分析样本时发现其收集了一些信息,然后打包加密发送给另一端,于是尝试逆出了其加密算法。想着既然发送了数据对面一定会有对应的解密算法,奈何技不如人,终不得解,特此请教各位大佬指点一二,有些思路讨论也行
代码如下:
#include <windows.h>
#include <stdlib.h>
#include <string>
//抓包数组
unsigned char WireShark[] =
"\xd5\x67\xec\xcb\xa6\x87\x03\xe4\x55\xc1"\
"\x94\x74\x28\x5e\x2f\xce\x6e\xad\xa4\x44\x98\xbb\x8e\xcc\x81\xbf"\
"\x62\x52\x74\xfb\x50\xb1\x27\xe0\x78\xf1\x2c\x3c\x89\xe7\x9a\x34"\
"\xe9\x6c\x2f\x1e\x9d\xed\x04\xa6\x85\xb7\xd1\x16\xf8\x48\xad\x01"\
"\xb6\x93\x07\x98\x3e\x44\x6d\x43\x93\xf0\x74\x5a\x67\x32\x2a\xdd"\
"\xba\x75\xca\xe4\x76\x9d\x16\x55\x30\x0b\x27\x51\xbb\x55\x72\xb2"\
"\x63\xa1\xa4\xe2\x82\x11\x82\x8a\x5c\x4a\x3a\x2a\x06\x50\x0e\xd4"\
"\x82\x91\xc9\x06\xaf\x0a\xe1\xe7\x58\x39\xce\x78\x66\x8f\xd0\x6f"\
"\xc0\xb4\x6b\x1e\xb6\xe0\xe2\x96\x9c\xbf\xd5\x30\x7f\xa5\x4b\x87"\
"\x0a\xbe\x45\xde\x11\x66\x59\x8b\x5f\x98\x83\x3e\xb8\xc0\x7f\xd0"\
"\xa8\x35\x62\x61\xcd\x06\xd5\x0b\xa7\x3f\x35\x38\xf7\x16\xaa\xaf"\
"\x96\x23\x1e\xfc\x3f\xd5\x5d\x97\x66\x1e\x28\xb4\xc2\x0f\x88\xff"\
"\x21\x38\x83\x0d\x58\x19\xfd\xe2\xd7\xe5\xb7\xc4\x6e\x00\xa4\xf0"\
"\x43\x20\xe6\x6c\x10\x85\x75\x04\x6d\xf1\x0c\x7d\x76\x97\x3e\x35"\
"\xd8\x11\x88\xd8\x13\xed\x8e\xa8\x73\x1f\x5e\x65\x22\xf8\xe7\xff"\
"\x8b\x52\xd6\x69\x8a\x83\xb3\xd3\x98\x37\xf7\x2b\x03\x3d\x8f\xf7"\
"\x66\xa2\x66\x24\x47\x2d\x8c\x18\x2b\xbd\x6b\xcd\x7f\x6f\x2a\x45"\
"\x22\x43\xb0\x2c\x32\xda\x98\xbb\x61\x33\xf3\x1d\xf1\x30\x13\xb0"\
"\x34\x2e\x7f\xb7\x15\xbb\xae\xae\x5c\x55\x60\x40\x81\x69\x2e\x39"\
"\x44\xc8\x50\x86\x33\xbd\xc8\x9e\x00\x3e\xf4\x1b\xd9\xce\x95\xb4"\
"\xf5\x86\xf7\xb2\xc0\x83\x59\xc5\x62\x85\x26\x3c\x31\xea\xbb\x6a"\
"\x97\x4f\xea\x00\x38\x40\x2d\xe5\x60\x6f\x43\xdb\x88\x63\x71\x3f"\
"\xcc\xb3\x0f\xb8\xd0\x6a\x65\xa7\x96\xb2\xa3\x06\x28\x62\xf7\x49"\
"\xf2\x9e\x80\x10\xfd\xd1\xe7\x82\x3b\xe7\xd3\x89\x5c\x22\x5d\xb4"\
"\x66\x68\x50\x25\xc0\xd3\xd0\xd3\xdb\xd9\x64\x3e\x84\x40\x15\x65"\
"\xe7\xfc\x0b\x64\x6a\xfd\xc4\x57\x53\x6d\xaa\x1e\x5d\xbe\x58\x2f"\
"\xc7\x7a\xf7\x4c\x0c\x16\xef\xad\xf6\x72\xe4\x24\xb7\x9c\xf7\xe5"\
"\x2a\x14\xe1\x11\x83\xb3\x9a\x42\x82\x96\x64\x66\xff\x42\x77\x5a"\
"\x7e\xcc\x09\x78\xe3\x2e\x41\xd0\xb2\xfe\x13\x41\xeb\x4d\xa0\xcd"\
"\xd0\x82\x3a\x0f\x97\x9e\x07\x05\x1f\xf9\x5e\x03\xbe\x3b\xee";
//------------------------------------------------------------
//----------- Created with 010 Editor -----------
//------ www.sweetscape.com/010editor/ ------
//加密前的源数据
// File : E:\²¡¶¾·ÖÎö\windows-\2019-07\result\ÎÞ¿Ç\·ÖÎöÖÐ\1.txt
// Address : 0 (0x0)
// Size : 473 (0x1D9)
//------------------------------------------------------------
unsigned char SourceData[473] = {
0x4B, 0x75, 0x47, 0x6F, 0x75, 0xD9, 0x01, 0x00, 0x00, 0xC8, 0x01, 0x00, 0x00, 0x66, 0x00, 0xC1,
0x51, 0x9C, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xB1, 0x1D, 0x00,
0x00, 0x02, 0x00, 0x00, 0x00, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20, 0x50, 0x61, 0x63,
0x6B, 0x20, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD3, 0x5D, 0x05, 0x77, 0x1B, 0xE1, 0x95,
0x77, 0x00, 0x00, 0x00, 0x00, 0xA4, 0x03, 0x5A, 0x00, 0x00, 0x00, 0x5A, 0x00, 0x50, 0x01, 0x5A,
0x00, 0x47, 0x20, 0x01, 0x00, 0x10, 0x55, 0x12, 0x00, 0xF8, 0x28, 0x5A, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x2F, 0xB9,
0x74, 0x50, 0x01, 0x5A, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE8, 0xF5, 0x5A, 0x00, 0xA4, 0x00, 0x00,
0x00, 0x40, 0x01, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x08, 0x00, 0x00,
0x00, 0xF8, 0x53, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00,
0x00, 0x0C, 0x54, 0x12, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x1E, 0x77, 0x0C, 0x00,
0x00, 0x31, 0x00, 0xB9, 0x74, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x07, 0x00, 0x00, 0x58, 0x55, 0x12,
0x00, 0x40, 0x01, 0x00, 0x41, 0xC0, 0xA8, 0x02, 0xEA, 0x57, 0x49, 0x4E, 0x2D, 0x44, 0x43, 0x53,
0x45, 0x4C, 0x41, 0x46, 0x30, 0x36, 0x52, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xFF, 0x0B, 0x00,
0x00, 0xFD, 0xEF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA7, 0xF7, 0x00, 0x00, 0x30, 0x37, 0x30,
0x33, 0x00, 0x5A, 0x05, 0x77, 0x14, 0x02, 0x00, 0x00, 0x20, 0x02, 0x00, 0x00, 0xE2, 0xF5, 0x5A,
0x00, 0xE0, 0xF5, 0x5A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x40, 0x17, 0x1C, 0x00, 0x7D, 0x2F, 0x1F, 0x77, 0x28, 0xBA, 0x74, 0x17, 0x58, 0x55, 0x32,
0x30, 0x31, 0x39, 0x2D, 0x30, 0x37, 0x2D, 0x31, 0x39, 0x20, 0x31, 0x34, 0x3A, 0x30, 0x37, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xC4, 0xAC, 0xC8, 0xCF, 0xB7, 0xD6, 0xD7, 0xE9, 0x00, 0x57, 0x12, 0x00, 0x0C, 0x00, 0x00,
0x00, 0x03, 0x00, 0x00, 0x00, 0x24, 0x6A, 0x04, 0x77, 0x9C, 0x17, 0x3D, 0x75, 0x6C, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xC4, 0x17, 0x3D, 0x75, 0x64, 0x9E, 0x3A, 0x73, 0x00, 0x00, 0x00,
0x00, 0x6C, 0x01, 0x30, 0xCC, 0xEC, 0x32, 0xCA, 0xB1, 0x33, 0x35, 0xB7, 0xD6, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE8, 0xF5, 0x5A,
0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x1C, 0x00, 0x00
};
//------------------------------------------------------------
//----------- Created with 010 Editor -----------
//------ www.sweetscape.com/010editor/ ------
//加密后的数据
// File : E:\²¡¶¾·ÖÎö\windows-\2019-07\result\ÎÞ¿Ç\·ÖÎöÖÐ\1-Encrypt.txt
// Address : 0 (0x0)
// Size : 473 (0x1D9)
//------------------------------------------------------------
unsigned char CryptData[473] = {
0xD5, 0x67, 0xEC, 0xCB, 0xA6, 0x87, 0x03, 0xE4, 0x55, 0xC1, 0x94, 0x74, 0x28, 0x5E, 0x2F, 0xCE,
0x6E, 0xAD, 0xA4, 0x44, 0x98, 0xBB, 0x8E, 0xCC, 0x81, 0xBF, 0x62, 0x52, 0x74, 0xFB, 0x50, 0xB1,
0x27, 0xE0, 0x78, 0xF1, 0x2C, 0x3C, 0x89, 0xE7, 0x9A, 0x34, 0xE9, 0x6C, 0x2F, 0x1E, 0x9D, 0xED,
0x04, 0xA6, 0x85, 0xB7, 0xD1, 0x16, 0xF8, 0x48, 0xAD, 0x01, 0xB6, 0x93, 0x07, 0x98, 0x3E, 0x44,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x83, 0xB3,
0x9A, 0x42, 0x82, 0x96, 0x64, 0x66, 0xFF, 0x42, 0x77, 0x5A, 0x7E, 0xCC, 0x09, 0x78, 0xE3, 0x2E,
0x41, 0xD0, 0xB2, 0xFE, 0x13, 0x41, 0xEB, 0x4D, 0xA0, 0xCD, 0xD0, 0x82, 0x3A, 0x0F, 0x97, 0x9E,
0x07, 0x05, 0x1F, 0xF9, 0x5E, 0x03, 0xBE, 0x3B, 0xEE
};
//------------------------------------------------------------
//----------- Created with 010 Editor -----------
//------ www.sweetscape.com/010editor/ ------
//加密前的密码表
// File : E:\²¡¶¾·ÖÎö\windows-\2019-07\result\ÎÞ¿Ç\·ÖÎöÖÐ\2.txt
// Address : 0 (0x0)
// Size : 256 (0x100)
//------------------------------------------------------------
unsigned char EncryptTable[256] = {
0x17, 0x67, 0x9F, 0xDB, 0x31, 0x4D, 0x86, 0x18, 0xFE, 0x73, 0xE8, 0x5C, 0xFD, 0x71, 0x13, 0x7F,
0xCA, 0x47, 0x8C, 0xCB, 0xD3, 0x54, 0x4A, 0x19, 0x4B, 0x20, 0x07, 0x3B, 0x83, 0xE9, 0xD4, 0x78,
0xCE, 0x99, 0x63, 0x41, 0xC6, 0x12, 0xB5, 0x9E, 0x7C, 0xF4, 0x49, 0xA7, 0x03, 0x66, 0x95, 0x40,
0x93, 0xF3, 0x46, 0x94, 0x51, 0x24, 0xCF, 0x27, 0x2B, 0xDC, 0xEA, 0xB0, 0x44, 0x84, 0xF8, 0x32,
0xAA, 0xD6, 0x53, 0x81, 0x14, 0x04, 0x7A, 0x89, 0x33, 0x96, 0x22, 0x01, 0x62, 0x28, 0xED, 0x42,
0x09, 0x55, 0xB7, 0x9D, 0x65, 0xAF, 0xDD, 0x2E, 0xEB, 0x57, 0x60, 0x79, 0x4C, 0x7E, 0x8F, 0xC7,
0x1C, 0x00, 0x02, 0x72, 0x92, 0x0F, 0xBC, 0xC0, 0xA5, 0x0B, 0x8D, 0xBD, 0x36, 0xB2, 0x0C, 0x68,
0x6A, 0x11, 0x1B, 0xAE, 0xE5, 0x38, 0x1E, 0x88, 0xDA, 0x3C, 0xEF, 0xB1, 0xF7, 0xAC, 0xA1, 0xC9,
0x0E, 0x58, 0xEE, 0x91, 0xBE, 0xB4, 0x77, 0xDE, 0xC8, 0xBA, 0x5F, 0x2A, 0xA0, 0xA6, 0xAD, 0x3F,
0xE6, 0x34, 0x8E, 0x6B, 0x15, 0x9B, 0xF6, 0xD7, 0x1F, 0xC4, 0xA8, 0x76, 0xB9, 0x98, 0x39, 0x06,
0x6F, 0x82, 0xBB, 0x9C, 0xC3, 0xB6, 0x61, 0x6E, 0x64, 0x25, 0x5D, 0xB8, 0xCC, 0x52, 0x2C, 0xE1,
0x1D, 0x10, 0x59, 0x97, 0xF5, 0x56, 0x85, 0xC2, 0x26, 0x80, 0x69, 0x7B, 0xFA, 0xA4, 0x6C, 0xD0,
0xE7, 0x43, 0xE2, 0xCD, 0xDF, 0xFF, 0x23, 0x16, 0xD1, 0x30, 0x08, 0xD2, 0x5E, 0x7D, 0x74, 0x3D,
0xE0, 0xE4, 0xC1, 0x5A, 0xAB, 0x0A, 0x3E, 0x37, 0xF2, 0xBF, 0xF0, 0x2F, 0x48, 0xE3, 0x87, 0x05,
0xC5, 0xF9, 0x90, 0x1A, 0x0D, 0xB3, 0xD8, 0xD9, 0xFC, 0xD5, 0x50, 0x21, 0x8B, 0xA2, 0x3A, 0xFB,
0x45, 0x5B, 0x29, 0x8A, 0xEC, 0x4E, 0x70, 0x9A, 0x4F, 0xA3, 0xF1, 0x75, 0xA9, 0x35, 0x2D, 0x6D
};
//------------------------------------------------------------
//----------- Created with 010 Editor -----------
//------ www.sweetscape.com/010editor/ ------
//加密后的密码表,可用于解密用
// File : E:\²¡¶¾·ÖÎö\windows-\2019-07\result\ÎÞ¿Ç\·ÖÎöÖÐ\2-Encrypt.txt
// Address : 0 (0x0)
// Size : 256 (0x100)
//------------------------------------------------------------
unsigned char DecryptTable[256] = {
0xEF, 0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, 0x9F, 0xF6, 0x34, 0xA7, 0xD7, 0x64, 0x2A, 0x54,
0x49, 0x9C, 0xE7, 0x84, 0x3D, 0x8D, 0x60, 0x7C, 0x16, 0x38, 0x98, 0xBB, 0x19, 0x8A, 0x61, 0x42,
0xDE, 0xFA, 0x3E, 0x73, 0xB5, 0x3B, 0x2D, 0xE2, 0x3F, 0x33, 0xD8, 0xD0, 0xC3, 0x65, 0x39, 0xC7,
0xE6, 0xF2, 0x07, 0x58, 0x01, 0x8B, 0x85, 0x71, 0xDF, 0x46, 0x6C, 0x02, 0x82, 0x48, 0x45, 0xCB,
0x1B, 0xF9, 0xF7, 0x04, 0x4C, 0x44, 0x32, 0xCF, 0xA9, 0xEC, 0xFE, 0x15, 0x6F, 0xCE, 0xD2, 0xC9
};
//-------------加密函数-------------
//参数说明:参数1:被加密数组,参数2:密码表数组,参数三:加密长度
//备注:使用unsigned 为了防止异或结果错误。作为测试只加密前0x200字节
//返回值与:无 对参数影响:无
//修改时间:2019年7月18日17:12:48
//-------------异或加密-------------
void EncryptFunc(unsigned char *SourceBytes,unsigned char *EncryptBytes,DWORD nLength)
{
DWORD nOffsetNum = 0, nTargetNum = 0,nLastNum=0;
unsigned char TargetCode = '\x0', OffsetCode = '\x0', LastCode = '\x0';
unsigned char* NewEncode = new unsigned char[0x200];
for (DWORD i = 0; i < nLength; i++)
{
//取密码表标志位Code
TargetCode = EncryptBytes[((i + 1) % 0x100)];
//取偏移Code的偏移
nOffsetNum = (TargetCode + nOffsetNum) % 0x100;
//取密码表偏移Code
OffsetCode = EncryptBytes[nOffsetNum];
//交换密码表数值
EncryptBytes[nOffsetNum % 0x100] = EncryptBytes[((i + 1) % 0x100)];
EncryptBytes[((i + 1) % 0x100)] = OffsetCode;
//取最终加密Code偏移
nLastNum = (TargetCode + OffsetCode) % 0x100;
//获取异或用的字符串
LastCode = EncryptBytes[nLastNum];
//取被加密的字符,异或
NewEncode[i] = LastCode ^ SourceBytes[i];
}
//在此下断观察NewEncode和NetBytes
delete[]NewEncode;
return;
}
int main()
{
//加密
DWORD nLength = 0;
nLength = sizeof(SourceData);
EncryptFunc(SourceData, EncryptTable, nLength);
//解密
return 0;
}
[注意]APP应用上架合规检测服务,协助应用顺利上架!