绿斑

本文Python代码针对绿斑文件窃取器运行后产生的流量进行异或解密。
样本来源:
从绿斑APT组织的文件窃取器理解加密流量,生产流量规则以及密文还原

代码

一共有三种加密,都是异或加密。
解密C2是一次性密钥,不具有通用行,脚本应该每次从PE中提取
解密-C2-APT-绿斑
字符串和文件数据分别是两个不同的密钥加密,从流量中获取加密数据,分别通过固定的密钥进行解密。

字符串加密

image.png
image.png

文件数据加密

image.png

流量解密脚本

字符串加密

加密流量来源
image.png

  1. key = [ 0x5D, 0xC6, 0x6F, 0x73, 0xE9, 0xC4, 0x2E, 0xAA, 0x59, 0xA9, 0x35, 0x04, 0xD1, 0xA4, 0x19, 0xAF, 0x66, 0xB7, 0x83, 0x45, 0x95, 0x89, 0x3A, 0x90, 0xF2, 0x06, 0x2B, 0xBF, 0xDA, 0x91, 0x64, 0xA6, 0x88, 0x91, 0xA7, 0xE1, 0xE8, 0x98, 0x4F, 0x3E, 0x68, 0x78, 0xC4, 0xAB, 0xCA, 0xAE, 0x29, 0x4C, 0x25, 0x56, 0x3B, 0x2C, 0x13, 0x33, 0x12, 0xBD, 0x84, 0x33, 0x3F, 0xAF, 0xBD, 0xA1, 0xC0, 0x29, 0x2E, 0x7A, 0x7C, 0xB3, 0xF2, 0x1F, 0x91, 0xEF, 0x22, 0x8C, 0xF6, 0xB7, 0xB2, 0x7A, 0xEC, 0x25, 0x47, 0x59, 0x7A, 0x1B, 0x46, 0x0E, 0x51, 0x8F, 0x6F, 0x35, 0x50, 0x93, 0xC1, 0xFC, 0x36, 0x50, 0x56, 0x1A, 0x95, 0x36, 0xA1, 0xA3, 0x12, 0xD9, 0xAA, 0xEE, 0x26, 0xAB, 0x36, 0xB0, 0x7C, 0x08, 0xE7, 0x10, 0x16, 0x47, 0xE3, 0xE9, 0xCE, 0xC6, 0x73, 0x60, 0x78, 0x2A, 0xB0, 0x3A, 0x57, 0xB2, 0x20, 0xDB, 0x01, 0x93, 0x32, 0x0C, 0xE3, 0xAF, 0x7A, 0x17, 0xD9, 0x44, 0x9B, 0x04, 0x76, 0xA6, 0x1F, 0x7E, 0xD5, 0xA7, 0x02, 0x96, 0x73, 0xAC, 0x54, 0xB0, 0xD9, 0x96, 0xA3, 0x42, 0x1D, 0x7F, 0x6E, 0x4D, 0x27, 0xD1, 0xA4, 0x2E, 0x9F, 0xAC, 0xED, 0xB7, 0x1F, 0x91, 0xEF, 0xB0, 0x0C, 0xE3, 0xAF, 0x7A, 0x04, 0xD1, 0xA4, 0x2E, 0x15, 0x5D, 0xEB, 0x9B, 0x1F, 0x91, 0xEF, 0xB0, 0x85, 0x92, 0x2D, 0x65, 0xDB, 0x01, 0xF5, 0x64, 0xA4, 0xB7, 0x91, 0xEF, 0xB0, 0x0C, 0xE3, 0xAF, 0xE7, 0x5C, 0x8D, 0xD5 ]
  2. lenKey = len(key)
  3. def DecodeFlow(codeHex, lenHex):
  4. cleartext = ''
  5. cout00 = 0
  6. for i in range(lenHex):
  7. xorHex = codeHex[i] ^ key[i % lenKey]
  8. # 隔字节异或
  9. i += 2
  10. if xorHex == 0x00:
  11. # 计算空字符
  12. cout00 += 1
  13. # 当有连续的0x00时,结束
  14. if cout00 == 2:
  15. break
  16. else:
  17. cout00 = 0
  18. cleartext += chr(xorHex)
  19. print(cleartext)
  20. if __name__ == '__main__':
  21. # 输入加密流量的十六进制
  22. flow = [ 0x11, 0xC6, 0x0E, 0x73, 0x9D, 0xC4, 0x5D, 0xAA, 0x0B, 0xA9, 0x5A, 0x04, 0xF1, 0xA4, 0x5B, 0xAF, 0x03, 0xB7, 0xF7, 0x45, 0xF4, 0x89, 0x00, 0x90, 0xA5, 0x06, 0x42, 0xBF, 0xB4, 0x91, 0x00, 0xA6, 0xE7, 0x91, 0xD0, 0xE1, 0x9B, 0x98, 0x6F, 0x3E, 0x38, 0x78, 0xAB, 0xAB, 0xBD, 0xAE, 0x4C, 0x4C, 0x57, 0x56, 0x68, 0x2C, 0x7B, 0x33, 0x77, 0xBD, 0xE8, 0x33, 0x53, 0x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 0xCF, 0x5E, 0x06, 0xB6, 0x54, 0x3D, 0x95, 0xEB, 0xF2, 0x2A, 0x51, 0x59, 0xC7, 0x5E, 0x16, 0xB6, 0x00, 0x3D, 0xD7, 0xEB, 0xF2, 0x2A, 0x5A, 0x59, 0xD1, 0x5E, 0x10, 0xB6, 0x10, 0x3D, 0xDA, 0xEB, 0xB8, 0x2A, 0x58, 0x59, 0xCD, 0x5E, 0x18, 0xB6, 0x19, 0x3D, 0x9B, 0xEB, 0xFE, 0x2A, 0x5F, 0x59, 0x8F, 0x5E, 0x19, 0xB6, 0x1D, 0x3D, 0x94, 0xEB, 0xF5, 0x2A, 0x12, 0x59, 0x82, 0x5E, 0x13, 0xB6, 0x01, 0x3D, 0x94, 0xEB, 0xF3, 0x2A, 0x4F, 0x59, 0xCB, 0x5E, 0x1A, 0xB6, 0x1A, 0x3D, 0x89, 0xEB, 0x90, 0x2A, 0x3B, 0x59, 0xA2, 0x5E, 0x75, 0xB6, 0x59, 0x3D, 0xFA, 0xEB, 0xA1, 0x79, 0x6B, 0x0A, 0xF7, 0x76, 0x39, 0x29, 0x0D, 0xA2, 0xC3, 0xA0, 0x38, 0xFA, 0xDA, 0x8D, 0x8F, 0xBF, 0xA0, 0x45, 0x65, 0x3D, 0xFA, 0xEB, 0x82, 0x2A, 0x3B, 0x59, 0xA2, 0x4D, 0x75, 0xB6, 0x74, 0x3C, 0xFA, 0xEB, 0x90, 0x2A, 0x3B, 0x59, 0xA2, 0x5E, 0x75, 0xB6, 0x74, 0x3D, 0xFA, 0xEB, 0x90 ]
  23. lenFlow = len(flow)
  24. DecodeFlow(flow, lenFlow)

文件内容

加密前

为了方便观察, 在C盘分目录下创建内容全部为“0x00”的文件:
image.png
以及字符串1到C的文件:
image.png

加密后

0x00,此数据适合展示使用,可以很明显的看到异或的结果就是密钥本身:
image.png
1到C用作解密展示,加密后:
image.png

文件数据解密脚本

image.png

  1. key = [ 0xA2, 0x5E, 0x75, 0xB6, 0x74, 0x3D, 0xFA, 0xEB, 0x90, 0x2A, 0x3B, 0x59 ]
  2. lenKey = len(key)
  3. def DecodeFile(codeHex, lenHex):
  4. cleartext = ''
  5. cout00 = 0
  6. for i in range(lenHex):
  7. xorHex = codeHex[i] ^ key[i % lenKey]
  8. i += 1
  9. cleartext += chr(xorHex)
  10. print(cleartext)
  11. if __name__ == '__main__':
  12. # 输入加密流量的十六进制
  13. encryptedFileData = [ 0x93, 0x6C, 0x46, 0x82, 0x41, 0x0B, 0xCD, 0xD3, 0xA9, 0x6B, 0x79, 0x1A, 0x93, 0x6C, 0x46, 0x82, 0x41, 0x0B, 0xCD, 0xD3, 0xA9, 0x6B, 0x79, 0x1A, 0x93, 0x6C, 0x46, 0x82, 0x41, 0x0B, 0xCD, 0xD3, 0xA9, 0x6B, 0x79, 0x1A, 0x93, 0x6C, 0x46, 0x82, 0x41, 0x0B, 0xCD, 0xD3, 0xA9, 0x6B, 0x79, 0x1A ]
  14. lenFile = len(encryptedFileData)
  15. DecodeFile(encryptedFileData, lenFile)